Skip to content

Commit

Permalink
Merge pull request #290 from rabbitmq/erlang_vars-extra-vars
Browse files Browse the repository at this point in the history
Add extra variables to erlang_vars rules
  • Loading branch information
pjk25 committed Jun 14, 2024
2 parents 628356f + f75854b commit 29d3613
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tools/erlang_vars.bzl
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
ERLANG_VARS_ENV_MAP = {
"OTP_VERSION": "$(OTP_VERSION)",
"OTP_VERSION_FILE_PATH": "$(OTP_VERSION_FILE_PATH)",
"OTP_VERSION_FILE_SHORT_PATH": "$(OTP_VERSION_FILE_SHORT_PATH)",
"ERLANG_HOME": "$(ERLANG_HOME)",
}

ERLANG_VARS_ENV_MAP_INTERNAL = ERLANG_VARS_ENV_MAP | {
"OTP_INSTALL_PATH": "$(OTP_INSTALL_PATH)",
"ERLANG_RELEASE_TAR_PATH": "$(ERLANG_RELEASE_TAR_PATH)",
"ERLANG_RELEASE_TAR_SHORT_PATH": "$(ERLANG_RELEASE_TAR_SHORT_PATH)",
}

def _impl(ctx):
otpinfo = ctx.toolchains["//tools:toolchain_type"].otpinfo
vars = {
"OTP_VERSION": otpinfo.version,
"OTP_VERSION_FILE_PATH": otpinfo.version_file.path,
"OTP_VERSION_FILE_SHORT_PATH": otpinfo.version_file.short_path,
"ERLANG_HOME": otpinfo.erlang_home,
}
if otpinfo.release_dir_tar != None:
vars["OTP_INSTALL_PATH"] = otpinfo.install_path
vars["ERLANG_RELEASE_TAR_PATH"] = otpinfo.release_dir_tar.path
vars["ERLANG_RELEASE_TAR_SHORT_PATH"] = otpinfo.release_dir_tar.short_path

return [platform_common.TemplateVariableInfo(vars)]
return [
platform_common.TemplateVariableInfo(vars),
]

erlang_vars = rule(
implementation = _impl,
Expand Down

0 comments on commit 29d3613

Please sign in to comment.