Skip to main content

erlang_release

name

def name(
*,
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
_apple_platforms: dict[str, str] = ...,
_toolchain: str = ...,
applications: list[str | (str, str)],
contacts: list[str] = ...,
include_erts: bool = ...,
labels: list[str] = ...,
multi_toolchain: None | list[str] = ...,
os_env: None | dict[str, str] = ...,
overlays: dict[str, list[str]] = ...,
release_name: None | str = ...,
version: str = ...,
) -> None

The erlang_release target builds OTP releases. Please refer to the OTP documentation for more details about releases.

Parameters

  • name: name of the target
  • default_target_platform: specifies the default target platform, used when no platforms are specified on the command line
  • target_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configuration
  • compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configuration
  • exec_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
  • visibility: a list of visibility patterns restricting what targets can depend on this one
  • within_view: a list of visibility patterns restricting what this target can depend on
  • metadata: a key-value map of metadata associated with this target
  • tests: a list of targets that provide tests for this one
  • modifiers: an array of modifiers associated with this target
  • applications: This field specifies the list of applications that the release should start in the given order, and optionally the start type. Top-level applications without given start type are started with type permanent.
  • include_erts: This field controls whether OTP applications and the Erlang runtime system should be included as part of the release. Please note, that at the moment the erts folder is just erts/.
  • multi_toolchain: This field controls whether the release should be built with a single toolchain, or multiple toolchains. In the latter case, all output paths are prefixed with the toolchain name.
  • os_env: This attribute allows to set additional values for the operating system environment for invocations to the Erlang toolchain.
  • overlays: Overlays can be used to add files to the release. They are specified as mapping from path (from the release root) to list of targets. The targets files are places flat at the target location with their basename.
  • release_name: The release name can explicitly be set by this field. This overwrites the default from the target name.
  • version: The version field specifies the release version. The release version is used in the release resource file, and is part of the path for the folder containing the boot scripts.

Details

The erlang_release target does by default (without overlays) package:

  • applications that are required to start the release
  • release resource file <relname>.rel (see rel(4))
  • boot script start.script (see rel(4))
  • binary boot script start.boot
  • bin/release_variables

The release_variables file contains release name, version, and erts version in shell syntax, e.g.

ERTS_VSN="12.1.2"
REL_NAME="rel1"
REL_VSN="1.0.0"

The target name doubles as the default release name. If the release_name attribute is used, the release name will be sources from there instead.

Examples:

erlang_release(
name = "world",
version = "1.0.0",
applications = [
"//apps//app_a:app_a",
"//apps//app_b:app_b",
],
overlays = {
"releases/1.0.0": [
":sys.config.src",
],
"bin": [
":start.sh",
],
},
)

export_file(
name = "sys.config.src",
src = "sys.config",
)

export_file(
name = "start.sh",
src = "start.sh",
)