Precompiled.Env (Precompiled v0.3.2)

Copy Markdown View Source

What the two places the client runs answer differently: a Mix project at build time (Precompiled.Env.MixProject) and the project Mix.install/2 keeps on a device (Precompiled.Env.MixInstall). Everything else in the client is shared.

Summary

Types

How Mix builds a dependency in this project: the manager it resolved ("mix", "rebar3", "make", or nil when unknown) and the options among :manager, :compile and :system_env its declaration sets.

Every Hex dependency's build_method/0, or {:unknown, why} when Mix could not load the dependencies, in which case no build matches.

t()

Functions

The locked Hex entries among apps, in the order given. envs names each app's own compile env (Mix compiles a dep as :prod unless the project overrides it, e.g. {:foo, "~> 1.0", env: :dev}); an app missing from it gets "prod".

The options among :manager, :compile and :system_env that a dependency's declaration sets, in that order; an empty list or map sets nothing. Each makes Mix build the dependency another way than the portal did, so no build matches it.

Types

build_method()

@type build_method() :: %{manager: String.t() | nil, overrides: [atom()]}

How Mix builds a dependency in this project: the manager it resolved ("mix", "rebar3", "make", or nil when unknown) and the options among :manager, :compile and :system_env its declaration sets.

build_methods()

@type build_methods() ::
  %{optional(atom()) => build_method()} | {:unknown, String.t()}

Every Hex dependency's build_method/0, or {:unknown, why} when Mix could not load the dependencies, in which case no build matches.

candidate()

@type candidate() :: %{
  name: atom(),
  version: String.t(),
  lock_entry: tuple(),
  dep_env: String.t()
}

t()

@type t() :: %Precompiled.Env{
  build_lib: Path.t(),
  build_methods: build_methods(),
  candidates: [candidate()],
  deps_path: Path.t(),
  installed: [atom()],
  installed_envs: %{optional(atom()) => String.t()},
  lock: map(),
  mix_target: String.t(),
  system: {String.t(), String.t()} | nil,
  tooling: [atom()] | nil
}

Functions

hex_candidates(lock, apps, envs \\ %{})

@spec hex_candidates(map(), [atom()], %{optional(atom()) => String.t()}) :: [
  candidate()
]

The locked Hex entries among apps, in the order given. envs names each app's own compile env (Mix compiles a dep as :prod unless the project overrides it, e.g. {:foo, "~> 1.0", env: :dev}); an app missing from it gets "prod".

overrides(opts)

@spec overrides(keyword()) :: [atom()]

The options among :manager, :compile and :system_env that a dependency's declaration sets, in that order; an empty list or map sets nothing. Each makes Mix build the dependency another way than the portal did, so no build matches it.