summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRin Kuryloski <kuryloskip@vmware.com>2022-10-18 15:57:51 +0200
committerRin Kuryloski <kuryloskip@vmware.com>2022-10-18 15:57:51 +0200
commit16300cc4ba86740fecd5d6936217c03245ca685d (patch)
tree0b827991f2b27f8d23eee7bfd7a392ed178cdf65
parent0b5f16f47e0193d8d7a99c61dcb1a9c5743c106c (diff)
downloadrabbitmq-server-git-16300cc4ba86740fecd5d6936217c03245ca685d.tar.gz
Adopt rules_erlang 3.8.3
and apply corresponding changes to the elixir build
-rw-r--r--.github/workflows/oci.yaml8
-rw-r--r--MODULE.bazel2
-rw-r--r--bazel/repositories/BUILD_external.tpl3
-rw-r--r--bazel/repositories/BUILD_internal.tpl3
-rw-r--r--bazel/repositories/elixir_config.bzl46
5 files changed, 23 insertions, 39 deletions
diff --git a/.github/workflows/oci.yaml b/.github/workflows/oci.yaml
index c150883106..5bd606497c 100644
--- a/.github/workflows/oci.yaml
+++ b/.github/workflows/oci.yaml
@@ -78,10 +78,6 @@ jobs:
echo "otp=$(cat bazel-bin/otp_version.txt)" >> $GITHUB_OUTPUT
echo "elixir=$(cat bazel-bin/elixir_version.txt)" >> $GITHUB_OUTPUT
- # clean so that when we next run bazelisk, the host erlang version
- # is re-detected
- bazelisk clean --expunge
-
- name: Configure OTP & Elixir
uses: erlef/setup-beam@v1.13
with:
@@ -90,7 +86,9 @@ jobs:
- name: Validate otp version embedded in OCI
run: |
- bazel cquery //packaging/docker-image:otp_source --output=build
+ bazel cquery //packaging/docker-image:otp_source \
+ --config=buildbuddy \
+ --output=build
- name: Build
run: |
diff --git a/MODULE.bazel b/MODULE.bazel
index cd7ae230f7..7dae28d396 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -25,7 +25,7 @@ bazel_dep(
bazel_dep(
name = "rules_erlang",
- version = "3.8.2",
+ version = "3.8.3",
)
erlang_config = use_extension(
diff --git a/bazel/repositories/BUILD_external.tpl b/bazel/repositories/BUILD_external.tpl
index b85df75924..d8649ce15b 100644
--- a/bazel/repositories/BUILD_external.tpl
+++ b/bazel/repositories/BUILD_external.tpl
@@ -25,7 +25,8 @@ toolchain(
exec_compatible_with = [
"//:elixir_external",
],
- target_compatible_with = [%{TARGET_COMPATIBLE_WITH}
+ target_compatible_with = [
+ "//:elixir_%{ELIXIR_VERSION_ID}",
],
toolchain = ":elixir",
toolchain_type = "%{RABBITMQ_SERVER_WORKSPACE}//bazel/elixir:toolchain_type",
diff --git a/bazel/repositories/BUILD_internal.tpl b/bazel/repositories/BUILD_internal.tpl
index 96758b58d9..6592e8e7a7 100644
--- a/bazel/repositories/BUILD_internal.tpl
+++ b/bazel/repositories/BUILD_internal.tpl
@@ -27,7 +27,8 @@ toolchain(
exec_compatible_with = [
"//:elixir_internal",
],
- target_compatible_with = [%{TARGET_COMPATIBLE_WITH}
+ target_compatible_with = [
+ "//:elixir_%{ELIXIR_VERSION_ID}",
],
toolchain = ":elixir",
toolchain_type = "%{RABBITMQ_SERVER_WORKSPACE}//bazel/elixir:toolchain_type",
diff --git a/bazel/repositories/elixir_config.bzl b/bazel/repositories/elixir_config.bzl
index 553e5b4865..1d59cbf863 100644
--- a/bazel/repositories/elixir_config.bzl
+++ b/bazel/repositories/elixir_config.bzl
@@ -41,22 +41,13 @@ def _impl(repository_ctx):
)
for (name, props) in elixir_installations.items():
- target_compatible_with = [
- "//:elixir_{}".format(props.identifier),
- ]
-
- target_compatible_with = "".join([
- "\n \"%s\"," % c
- for c in target_compatible_with
- ])
-
if props.type == INSTALLATION_TYPE_EXTERNAL:
repository_ctx.template(
"{}/BUILD.bazel".format(name),
Label("//bazel/repositories:BUILD_external.tpl"),
{
"%{ELIXIR_HOME}": props.elixir_home,
- "%{TARGET_COMPATIBLE_WITH}": target_compatible_with,
+ "%{ELIXIR_VERSION_ID}": props.identifier,
"%{RABBITMQ_SERVER_WORKSPACE}": rabbitmq_server_workspace,
},
False,
@@ -66,11 +57,10 @@ def _impl(repository_ctx):
"{}/BUILD.bazel".format(name),
Label("//bazel/repositories:BUILD_internal.tpl"),
{
- "%{ELIXIR_VERSION}": props.version,
"%{URL}": props.url,
"%{STRIP_PREFIX}": props.strip_prefix or "",
"%{SHA_256}": props.sha256 or "",
- "%{TARGET_COMPATIBLE_WITH}": target_compatible_with,
+ "%{ELIXIR_VERSION_ID}": props.identifier,
"%{RABBITMQ_SERVER_WORKSPACE}": rabbitmq_server_workspace,
},
False,
@@ -114,8 +104,10 @@ elixir_config = repository_rule(
"elixir_homes": attr.string_dict(),
},
environ = [
- "ELIXIR_HOME",
+ ELIXIR_HOME_ENV_VAR,
+ "PATH",
],
+ local = True,
)
def _elixir_home_from_elixir_path(repository_ctx, elixir_path):
@@ -185,8 +177,6 @@ def _default_elixir_dict(repository_ctx):
}
def _build_file_content(elixir_installations):
- default_installation = elixir_installations[_DEFAULT_EXTERNAL_ELIXIR_PACKAGE_NAME]
-
build_file_content = """\
package(
default_visibility = ["//visibility:public"],
@@ -197,27 +187,11 @@ constraint_setting(
default_constraint_value = ":elixir_external",
)
-constraint_setting(
- name = "elixir_version",
- default_constraint_value = ":elixir_{default_identifier}",
-)
-
constraint_value(
name = "elixir_external",
constraint_setting = ":elixir_internal_external",
)
-""".format(
- default_identifier = default_installation.identifier,
- )
-
- external_installations = {
- name: props
- for (name, props) in elixir_installations.items()
- if props.type == INSTALLATION_TYPE_EXTERNAL
- }
- if len(elixir_installations) > len(external_installations):
- build_file_content += """\
constraint_value(
name = "elixir_internal",
constraint_setting = ":elixir_internal_external",
@@ -225,6 +199,16 @@ constraint_value(
"""
+ default_installation = elixir_installations[_DEFAULT_EXTERNAL_ELIXIR_PACKAGE_NAME]
+
+ build_file_content += """\
+constraint_setting(
+ name = "elixir_version",
+ default_constraint_value = ":elixir_{}",
+)
+
+""".format(default_installation.identifier)
+
unique_identifiers = {
props.identifier: name
for (name, props) in elixir_installations.items()