Precompiled.Env (Precompiled v0.7.3)

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.

The order mix deps.compile compiles this project's dependencies in, and what each one finds loaded when it compiles, or {:ambiguous, why, deps} when there is no single order (a partitioned compile). Read only by this library.

Per dependency, its children as Mix loads them for the current env and target: an optional dependency nothing in this env brings in is not there, even when mix.lock has it (e.g. a project's only: :test dependency in dev). Read only by this library.

t()

Functions

The transitive deps of app in tree (a present_deps/0), sorted, without app itself: what Mix has loaded when it compiles app in the current env. nil when the tree is unknown or does not have app.

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()
}

compile_order()

@type compile_order() :: map() | {:ambiguous, String.t(), map()}

The order mix deps.compile compiles this project's dependencies in, and what each one finds loaded when it compiles, or {:ambiguous, why, deps} when there is no single order (a partitioned compile). Read only by this library.

present_deps()

@type present_deps() :: %{optional(atom()) => [atom()]}

Per dependency, its children as Mix loads them for the current env and target: an optional dependency nothing in this env brings in is not there, even when mix.lock has it (e.g. a project's only: :test dependency in dev). Read only by this library.

t()

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

Functions

closure(tree, app)

@spec closure(present_deps() | nil, atom()) :: [atom()] | nil

The transitive deps of app in tree (a present_deps/0), sorted, without app itself: what Mix has loaded when it compiles app in the current env. nil when the tree is unknown or does not have app.

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.