MobDev.OtpDownloader (mob_dev v0.5.16)

Copy Markdown View Source

Downloads and caches pre-built OTP releases from GitHub for Android and iOS simulator.

Artifacts are cached at ~/.mob/cache/ and reused across projects.

Summary

Functions

Returns the cached Android OTP directory path (may not exist yet).

Reads the Elixir vsn from otp_dir/lib/elixir/ebin/elixir.app, or nil.

Ensures the Android OTP release is cached. Returns {:ok, path} or {:error, reason}.

Ensures the iOS device OTP release is cached. Returns {:ok, path} or {:error, reason}.

Ensures the iOS simulator OTP release is cached. Returns {:ok, path} or {:error, reason}.

Returns the cached iOS device OTP directory path (may not exist yet).

Returns the cached iOS simulator OTP directory path (may not exist yet).

Warns (does not fail) when the build's Elixir minor version differs from the Elixir bundled in the device OTP runtime at otp_dir.

Functions

android_otp_dir(abi \\ "arm64-v8a")

@spec android_otp_dir(String.t()) :: String.t()

Returns the cached Android OTP directory path (may not exist yet).

bundled_elixir_version(otp_dir)

@spec bundled_elixir_version(String.t()) :: String.t() | nil

Reads the Elixir vsn from otp_dir/lib/elixir/ebin/elixir.app, or nil.

ensure_android(abi \\ "arm64-v8a")

@spec ensure_android(String.t()) :: {:ok, String.t()} | {:error, term()}

Ensures the Android OTP release is cached. Returns {:ok, path} or {:error, reason}.

ensure_ios_device()

@spec ensure_ios_device() :: {:ok, String.t()} | {:error, term()}

Ensures the iOS device OTP release is cached. Returns {:ok, path} or {:error, reason}.

ensure_ios_sim()

@spec ensure_ios_sim() :: {:ok, String.t()} | {:error, term()}

Ensures the iOS simulator OTP release is cached. Returns {:ok, path} or {:error, reason}.

ios_device_otp_dir()

@spec ios_device_otp_dir() :: String.t()

Returns the cached iOS device OTP directory path (may not exist yet).

ios_sim_otp_dir()

@spec ios_sim_otp_dir() :: String.t()

Returns the cached iOS simulator OTP directory path (may not exist yet).

warn_on_elixir_skew(otp_dir)

@spec warn_on_elixir_skew(String.t()) :: :ok

Warns (does not fail) when the build's Elixir minor version differs from the Elixir bundled in the device OTP runtime at otp_dir.

This is the Enum.__in__/2 class of breakage: the in operator and other macros expand differently per Elixir minor, so beams compiled by 1.20 call functions a 1.19.5 runtime lacks → :undef at boot → black screen with no obvious cause. Warning (not failing) is deliberate: rc/patch transitions are common and usually fine, and a hard fail would block legitimate builds — but a loud warning would have turned that debugging saga into one line.