Main Mix task to generate the monolithic binary.
This task orchestrates the fetching of ERTS, packaging of the release/escript, and compilation of the Rust wrapper.
Batamanta supports two output formats:
:release(default) - Full OTP release with supervisor tree:escript- Lightweight escript with embedded Elixir runtime
For projects using mix escript.build, use:
batamanta: [
format: :escript
]User specifies, user owns. If you specify otp_version, that exact version
is used. If not specified (auto mode), a conservative fallback is used.
batamanta: [
]In auto mode (no version specified), the system tries:
- 28.0 → 28.1 → 28.2 → ... (fallback to first available)
Batamanta handles its own garbage. After each successful compilation, it:
- Removes
bat_cargo_cachefrom the system temp directory - Deletes
bat_pkg_*andbat_build_*intermediate folders - Preserves the ERTS cache (
~/.cache/batamanta) for sub-second repeat builds
To manually wipe the entire cache (including downloaded ERTS), use mix batamanta.clean.
Use :erts_target for unified platform specification:
batamanta: [
execution_mode: :cli,
compression: 3,
]| Target Atom | Description |
|---|---|
:auto | Auto-detect host platform (default) |
:ubuntu_22_04_x86_64 | Linux x86_64 glibc (Debian, Ubuntu, Arch, CachyOS) |
:ubuntu_22_04_arm64 | Linux aarch64 glibc |
:alpine_3_19_x86_64 | Linux x86_64 musl (Alpine) |
:alpine_3_19_arm64 | Linux aarch64 musl |
:macos_12_x86_64 | macOS Intel |
:macos_12_arm64 | macOS Apple Silicon |
:windows_x86_64 | Windows x86_64 |
Force specific platform regardless of host:
batamanta: [
force_arch: "x86_64",
force_libc: "musl",
]You can force the binary name by setting :binary_name in the config:
batamanta: [
binary_name: "my_custom_binary"
]
mix batamanta--erts-target- Override ERTS target atom--otp-version- Specify exact OTP version (e.g., "28.1")--force-os- Force OS (linux, macos, windows)--force-arch- Force architecture (x86_64, aarch64)--force-libc- Force libc (gnu, musl) - Linux only--compression- Zstd compression level (1-19)--format- Output format: escript or release (default: release)
Summary
Functions
Builds override config from options and config.
Parses command-line options.
Resolves ERTS target from options and config.
Resolves the output format from options, config, or auto-detection.
Resolves OTP version from options and config.
Validates required system tools
Functions
Builds override config from options and config.
Parses command-line options.
Resolves ERTS target from options and config.
Resolves the output format from options, config, or auto-detection.
Priority:
- CLI option
--format - Config
format:key - Auto-detect: if project has
:escriptconfig, use:escript, else:release
Resolves OTP version from options and config.
Returns a tuple with:
version string
mode: :explicit (user specified) or :auto (detected from system)
If user specifies
otp_versionin config or CLI, that exact version is usedIf no version specified (auto mode), uses conservative fallback (tries 28.0, 28.1, etc.)
Validates required system tools