defmodule ExecutionPlaneProcess.MixProject do use Mix.Project @version "0.1.0" @source_url "https://github.com/nshkrdotcom/execution_plane" @homepage_url "https://hex.pm/packages/execution_plane_process" @docs_url "https://hexdocs.pm/execution_plane_process" @ground_plane_contracts_version "~> 0.1.0" @ground_plane_contracts_source [ github: "nshkrdotcom/ground_plane", branch: "main", subdir: "core/ground_plane_contracts" ] @execution_plane_version "~> 0.2.0" @execution_plane_source [ github: "nshkrdotcom/execution_plane", branch: "main", subdir: "core/execution_plane" ] def project do [ app: :execution_plane_process, name: "ExecutionPlaneProcess", version: @version, elixir: "~> 1.18", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, description: "Execution Plane process launch, stdio, PTY, and process-session runtime.", source_url: @source_url, homepage_url: @homepage_url, package: package(), docs: docs(), dialyzer: dialyzer(), deps: deps(), aliases: aliases() ] end def application do [ extra_applications: [:crypto, :logger], mod: {ExecutionPlane.Process.Application, []} ] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_env), do: ["lib"] defp deps do [ execution_plane_dep(), ground_plane_contracts_dep(), {:erlexec, "~> 2.3.4"}, {:jason, "~> 1.4.5"}, {:telemetry, "~> 1.4.2"}, {:ex_doc, "~> 0.40.3", only: :dev, runtime: false}, {:credo, "~> 1.7.19", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4.7", only: [:dev, :test], runtime: false} ] end defp ground_plane_contracts_dep do case workspace_dep_path("../../../ground_plane/core/ground_plane_contracts") do nil -> external_ground_plane_contracts_dep() path -> {:ground_plane_contracts, path: path} end end defp external_ground_plane_contracts_dep do if hex_packaging_task?() do {:ground_plane_contracts, @ground_plane_contracts_version} else {:ground_plane_contracts, @ground_plane_contracts_source} end end defp execution_plane_dep do case workspace_dep_path("../../core/execution_plane") do nil -> external_execution_plane_dep() path -> {:execution_plane, path: path} end end defp external_execution_plane_dep do if hex_packaging_task?() do {:execution_plane, @execution_plane_version} else {:execution_plane, @execution_plane_source} end end defp workspace_dep_path(relative_path) do if local_workspace_deps?() do path = Path.expand(relative_path, __DIR__) if File.dir?(path), do: path end end defp local_workspace_deps? do not hex_packaging_task?() and not Enum.member?(Path.split(__DIR__), "deps") end defp hex_packaging_task? do Enum.any?(System.argv(), &(&1 in ["hex.build", "hex.publish"])) end defp package do [ maintainers: ["nshkrdotcom"], name: "execution_plane_process", licenses: ["MIT"], links: %{ "GitHub" => @source_url, "Hex" => @homepage_url, "HexDocs" => @docs_url, "Changelog" => "#{@source_url}/blob/main/runtimes/execution_plane_process/CHANGELOG.md", "License" => "#{@source_url}/blob/main/runtimes/execution_plane_process/LICENSE" }, files: ~w(.formatter.exs CHANGELOG.md LICENSE README.md assets guides lib mix.exs) ] end defp docs do [ main: "readme", source_ref: "execution_plane_process-v#{@version}", source_url: @source_url, source_url_pattern: "#{@source_url}/blob/execution_plane_process-v#{@version}/runtimes/execution_plane_process/%{path}#L%{line}", homepage_url: @docs_url, logo: "assets/execution_plane_process.svg", assets: %{"assets" => "assets"}, extras: [ {"README.md", title: "Overview", filename: "readme"}, {"CHANGELOG.md", title: "Changelog", filename: "changelog"}, {"LICENSE", title: "License", filename: "license"}, {"guides/index.md", title: "Guide Index", filename: "guides_index"}, {"guides/installation.md", title: "Installation", filename: "installation"}, {"guides/usage.md", title: "Usage", filename: "usage"}, {"guides/publishing.md", title: "Publishing", filename: "publishing"} ], groups_for_extras: [ Package: ["README.md", "CHANGELOG.md", "LICENSE"], Guides: [ "guides/index.md", "guides/installation.md", "guides/usage.md", "guides/publishing.md" ] ] ] end defp dialyzer do [ plt_add_apps: [:mix, :ex_unit], plt_core_path: "_build/plts/core", plt_local_path: "_build/plts", flags: [:error_handling, :underspecs] ] end defp aliases do [ ci: [ "format --check-formatted", "compile --warnings-as-errors", "cmd env MIX_ENV=test mix test", "credo --strict", "cmd env MIX_ENV=test mix dialyzer --force-check", "docs --warnings-as-errors" ] ] end end