defmodule ExVrp.MixProject do use Mix.Project @version "0.4.2" @github_url "https://github.com/sephianl/ex_vrp" def project do [ app: :ex_vrp, version: @version, elixir: "~> 1.15", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, deps: deps(), compilers: [:elixir_make] ++ Mix.compilers(), make_targets: ["all"], make_clean: ["clean"], make_args: ["-j#{System.schedulers_online()}"], make_env: &make_env/0, make_precompiler: make_precompiler(), make_precompiler_url: "#{@github_url}/releases/download/v#{@version}/@{artefact_filename}", make_precompiler_filename: "ex_vrp_nif", make_precompiler_nif_versions: [versions: ["2.17"]], cc_precompiler: [ cleanup: "clean", compilers: %{ {:unix, :linux} => %{:include_default_ones => true}, {:unix, :darwin} => %{:include_default_ones => true} } ], # Hex description: "Elixir bindings for PyVRP - a state-of-the-art vehicle routing problem solver", package: package(), # Docs name: "ExVrp", docs: docs(), # Testing test_coverage: [tool: ExCoveralls], # Dialyzer dialyzer: [ plt_add_apps: [:mix] ], aliases: aliases() ] end def cli do [ preferred_envs: [ coveralls: :test, "coveralls.detail": :test, "coveralls.post": :test, "coveralls.html": :test ] ] end def application do [ extra_applications: [:logger], mod: {ExVrp.Application, []} ] end defp aliases do [ "hex.publish": ["elixir_make.checksum --all --ignore-unavailable", "hex.publish"] ] end # Precompiled binaries are downloaded when this package is installed as # a hex dependency. When working in this repo, mix always builds from source. defp make_precompiler, do: {:nif, CCPrecompiler} defp make_env do fine_dir = if Code.ensure_loaded?(Fine) do Fine.include_dir() else Path.join(Mix.Project.deps_path(), "fine/c_include") end %{"FINE_INCLUDE_DIR" => fine_dir} end defp elixirc_paths(:test), do: ["lib", "dev", "credo"] defp elixirc_paths(:dev), do: ["lib", "dev"] defp elixirc_paths(_), do: ["lib"] defp deps do [ # NIF compilation {:elixir_make, "~> 0.8", runtime: false}, {:cc_precompiler, "~> 0.1", runtime: false}, {:fine, "~> 0.1.4"}, {:nx, "~> 0.10"}, # Testing {:stream_data, "~> 1.0", only: [:test, :dev]}, {:excoveralls, "~> 0.18", only: :test}, # Benchmarking {:benchee, "~> 1.3", only: [:dev, :test]}, {:jason, "~> 1.4", only: [:dev, :test]}, # Mix check {:ex_check, "~> 0.16.0", only: [:dev, :test], runtime: false}, # Static code analysis {:credo, ">= 0.0.0", only: [:dev, :test], runtime: false}, {:dialyxir, ">= 0.0.0", only: [:dev, :test], runtime: false}, {:ex_doc, ">= 0.0.0", only: [:dev, :test], runtime: false}, {:sobelow, ">= 0.0.0", only: [:dev, :test], runtime: false}, {:mix_audit, ">= 0.0.0", only: [:dev, :test], runtime: false}, # Formatting {:styler, "~> 1.4", only: [:dev, :test], runtime: false} ] end defp package do [ maintainers: ["Sephian"], licenses: ["MIT"], links: %{"GitHub" => @github_url}, files: ~w(lib c_src/ex_vrp_nif.cpp c_src/pyvrp mix.exs Makefile README.md LICENSE checksum.exs) ] end defp docs do [ main: "ExVrp", extras: ["README.md"], source_url: @github_url, source_ref: "v#{@version}", groups_for_modules: [ "Problem Definition": [ ExVrp.Model, ExVrp.Client, ExVrp.Depot, ExVrp.VehicleType, ExVrp.ClientGroup, ExVrp.SameVehicleGroup ], Solving: [ ExVrp.Solver, ExVrp.StoppingCriteria, ExVrp.PenaltyManager, ExVrp.PenaltyManager.Params, ExVrp.IteratedLocalSearch, ExVrp.IteratedLocalSearch.Params ], Results: [ ExVrp.Solution, ExVrp.Route, ExVrp.ScheduledVisit, ExVrp.IteratedLocalSearch.Result ] ] ] end end