diff --git a/.bazelrc b/.bazelrc index 2b18b0e..a836d06 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,5 +1,4 @@ build --registry=https://bcr.bazel.build/ -build --registry=https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/ build --incompatible_strict_action_env diff --git a/.bazelversion b/.bazelversion index a0f9a4b..deeb3d6 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -latest +9.2.0 diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json index a75fb59..5512ac7 100644 --- a/.bcr/metadata.template.json +++ b/.bcr/metadata.template.json @@ -1,15 +1,15 @@ { - "homepage": "https://github.com/rabbitmq/rules_elixir", + "homepage": "https://github.com/bazelverse/rules_elixir", "maintainers": [ { - "email": "rin.kuryloski@broadcom.com", - "github": "pjk25", - "name": "Rin Kuryloski" + "email": "marvin.hansen@gmail.com", + "github": "marvin-hansen", + "name": "Marvin Hansen" } ], "repository": [ - "github:rabbitmq/rules_elixir" + "github:bazelverse/rules_elixir" ], "versions": [], "yanked_versions": {} -} \ No newline at end of file +} diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index b0769e5..3102257 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -1,3 +1,11 @@ +# Erlang comes from kerl, built from source, and is activated so that the Elixir +# archive below finds an ERTS to run on. Elixir comes from the precompiled +# release asset for the matching OTP major: upstream publishes one asset per +# supported major, so ELIXIR_VERSION and OTP_MAJOR have to move together. See the +# supported versions table in README.md. +# +# The external Elixir toolchain reads ELIXIR_HOME before falling back to +# `which elixir`, which is what makes the unpacked archive visible to the build. shell_commands: &shell_commands - curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl - chmod a+x kerl @@ -6,23 +14,26 @@ shell_commands: &shell_commands - ./kerl install ${ERLANG_VERSION} ~/kerl/${ERLANG_VERSION} - . ~/kerl/${ERLANG_VERSION}/activate - cd ~ -- curl -LO https://github.com/elixir-lang/elixir/releases/download/v1.17.2/elixir-otp-26.zip -- mkdir elixir-otp-26 -- unzip elixir-otp-26.zip -d elixir-otp-26 -- ~/elixir-otp-26/bin/iex --version +- curl -LO https://github.com/elixir-lang/elixir/releases/download/v${ELIXIR_VERSION}/elixir-otp-${OTP_MAJOR}.zip +- mkdir -p elixir-otp-${OTP_MAJOR} +- unzip -q elixir-otp-${OTP_MAJOR}.zip -d elixir-otp-${OTP_MAJOR} +- ~/elixir-otp-${OTP_MAJOR}/bin/iex --version matrix: bazel: - - 7.x + - 8.x + - 9.x tasks: verify_targets_macos: name: Verify build targets (macos) platform: macos bazel: ${{ bazel }} environment: - ERLANG_VERSION: "26.2" - ERLANG_HOME: /Users/buildkite/kerl/26.2 - ELIXIR_HOME: /Users/buildkite/elixir-otp-26 + ERLANG_VERSION: "29.0.5" + ERLANG_HOME: /Users/buildkite/kerl/29.0.5 + ELIXIR_VERSION: "1.20.3" + OTP_MAJOR: "29" + ELIXIR_HOME: /Users/buildkite/elixir-otp-29 shell_commands: *shell_commands build_flags: - --incompatible_strict_action_env @@ -33,9 +44,11 @@ tasks: platform: ubuntu2004 bazel: ${{ bazel }} environment: - ERLANG_VERSION: "26.2" - ERLANG_HOME: /var/lib/buildkite-agent/kerl/26.2 - ELIXIR_HOME: /var/lib/buildkite-agent/elixir-otp-26 + ERLANG_VERSION: "29.0.5" + ERLANG_HOME: /var/lib/buildkite-agent/kerl/29.0.5 + ELIXIR_VERSION: "1.20.3" + OTP_MAJOR: "29" + ELIXIR_HOME: /var/lib/buildkite-agent/elixir-otp-29 shell_commands: *shell_commands build_flags: - --incompatible_strict_action_env diff --git a/.bcr/source.template.json b/.bcr/source.template.json index 199d92a..8f7b6fe 100644 --- a/.bcr/source.template.json +++ b/.bcr/source.template.json @@ -1,5 +1,5 @@ { "integrity": "", "strip_prefix": "{REPO}-{VERSION}", - "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_elixir-{TAG}.tar.gz" + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_elixir-{VERSION}.tar.gz" } diff --git a/.github/workflows/publish-rabbitmq-bcr.yml b/.github/workflows/publish-rabbitmq-bcr.yml deleted file mode 100644 index b58efa9..0000000 --- a/.github/workflows/publish-rabbitmq-bcr.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Add to rabbitmq/bazel-central-registry@erlang-packages -on: - release: - types: [published] - workflow_dispatch: -jobs: - add-module: - runs-on: ubuntu-latest - steps: - - name: CHECKOUT - uses: actions/checkout@v4 - with: - path: rules_elixir - - name: CHECKOUT rabbitmq/bazel-central-registry@erlang-packages - uses: actions/checkout@v4 - with: - repository: rabbitmq/bazel-central-registry - path: bazel-central-registry - ref: erlang-packages - - name: PUBLISH TO rabbitmq/bazel-central-registry@erlang-packages - working-directory: bazel-central-registry - env: - MODULE_NAME: rules_elixir - REPO_NAME: rules_elixir - run: | - VERSION="${{ github.ref_name }}" - VERSION="${VERSION#v}" - MAJOR="${VERSION:0:1}" - - echo "VERSION: ${VERSION}" - echo "MAJOR: ${MAJOR}" - - cat << EOF > ${MODULE_NAME}.json - { - "build_file": null, - "build_targets": [ - "@${MODULE_NAME}//..." - ], - "compatibility_level": "${MAJOR}", - "deps": [], - "module_dot_bazel": "${{ github.workspace }}/${REPO_NAME}/MODULE.bazel", - "name": "${MODULE_NAME}", - "patch_strip": 0, - "patches": [], - "presubmit_yml": "${{ github.workspace }}/${REPO_NAME}/.bcr/presubmit.yml", - "strip_prefix": "${REPO_NAME}-${VERSION}", - "test_module_build_targets": [], - "test_module_path": null, - "test_module_test_targets": [], - "url": "https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${REPO_NAME}-${VERSION}.tar.gz", - "version": "${VERSION}" - } - EOF - - jq '.' ${MODULE_NAME}.json - - pip install -r tools/requirements_lock.txt - python3 tools/add_module.py \ - --input=${MODULE_NAME}.json - - git diff - - name: CREATE PULL REQUEST - uses: peter-evans/create-pull-request@v6.0.4 - with: - token: ${{ secrets.REPO_SCOPED_TOKEN }} - path: bazel-central-registry - title: Add ${{ github.repository }}@${{ github.ref_name }} - body: > - Automated changes created by - ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - using the [create-pull-request](https://github.com/peter-evans/create-pull-request) - GitHub action in the ${{ github.workflow }} workflow. - commit-message: | - Add ${{ github.repository }}@${{ github.ref_name }} - branch: add-${{ github.repository }}@${{ github.ref_name }} - delete-branch: true diff --git a/.github/workflows/publish-to-bcr.yml b/.github/workflows/publish-to-bcr.yml new file mode 100644 index 0000000..313d6f6 --- /dev/null +++ b/.github/workflows/publish-to-bcr.yml @@ -0,0 +1,37 @@ +# Opens a PR against the Bazel Central Registry when a release is published. +# +# Prerequisites, both one-time and both outside this repository: +# 1. A fork of bazelbuild/bazel-central-registry under the bazelverse org. +# 2. A classic PAT with `repo` and `workflow` scopes, stored as the +# BCR_PUBLISH_TOKEN Actions secret. +# +# Replaces a workflow that published to rabbitmq/bazel-central-registry@erlang-packages, +# a private registry fork this project can no longer write to. +# +# Note that rules_elixir cannot actually land in the registry until rules_erlang +# 3.18.0 does, because the BCR presubmit resolves the full module graph and +# overrides do not apply to a non-root module. +name: Publish to BCR +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag_name: + description: Release tag to publish + required: true + type: string + +jobs: + publish: + uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.4.2 + with: + tag_name: ${{ inputs.tag_name || github.ref_name }} + registry_fork: bazelverse/bazel-central-registry + attest: true + permissions: + attestations: write + contents: write + id-token: write + secrets: + publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index eaed835..fa5e2e5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,3 +1,11 @@ +# CI covers the latest two Elixir minors against the latest two OTP majors. +# Elixir supports a moving window of OTP majors (1.20 covers 27-29, 1.19 covers +# 26-28), so the pairs are pinned explicitly rather than crossed: crossing them +# would generate combinations Elixir does not support. Earlier versions may work +# but are not tested here. See the supported versions table in README.md. +# +# The Bazel matrix lives in .bcr/presubmit.yml, which covers 8.x and 9.x. These +# jobs use the version pinned in .bazelversion. name: Test on: push: @@ -7,43 +15,62 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - otp: "28.5" + elixir: "1.19.5-otp-28" + - otp: "29.0" + elixir: "1.20.3-otp-29" steps: - name: CHECKOUT REPOSITORY uses: actions/checkout@v4 - name: SETUP ERLANG/ELIXIR uses: erlef/setup-beam@v1 with: - otp-version: 26 - elixir-version: 1.15 + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} - name: CONFIGURE run: | - echo "build --color=yes" >> .bazelrc + echo "build --color=yes" >> user.bazelrc - name: BUILD run: | bazelisk build //... \ --verbose_failures test: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - otp: "28.5" + elixir: "1.19.5-otp-28" + - otp: "29.0" + elixir: "1.20.3-otp-29" steps: - name: CHECKOUT REPOSITORY uses: actions/checkout@v4 - name: SETUP ERLANG/ELIXIR uses: erlef/setup-beam@v1 with: - otp-version: 26 - elixir-version: 1.15 + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} - name: CONFIGURE working-directory: test run: | - echo "build --color=yes" >> .bazelrc + echo "build --color=yes" >> user.bazelrc - name: BUILD & TEST working-directory: test run: | bazelisk test //... - name: CHECK LOGS working-directory: test + # Elixir 1.20 replaced "N tests, M failures" with "Result: N passed", so + # both spellings are accepted while the matrix spans 1.19 and 1.20. run: | - grep "2 tests, 0 failures" bazel-testlogs/two_file_test/test.log + grep -E "Result: 2 passed|2 tests, 0 failures" \ + bazel-testlogs/two_file_test/test.log - name: EXPECTED FAILURES FAIL working-directory: test run: | @@ -54,23 +81,31 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: bazel-testlogs + name: bazel-testlogs-${{ matrix.otp }} path: | test/bazel-testlogs/* examples-basic: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - otp: "28.5" + elixir: "1.19.5-otp-28" + - otp: "29.0" + elixir: "1.20.3-otp-29" steps: - name: CHECKOUT REPOSITORY uses: actions/checkout@v4 - name: SETUP ERLANG/ELIXIR uses: erlef/setup-beam@v1 with: - otp-version: 26 - elixir-version: 1.15 + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} - name: CONFIGURE working-directory: examples/basic run: | - echo "build --color=yes" >> .bazelrc + echo "build --color=yes" >> user.bazelrc - name: BUILD & TEST working-directory: examples/basic run: | @@ -79,10 +114,12 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: bazel-testlogs-examples-basic + name: bazel-testlogs-examples-basic-${{ matrix.otp }} path: | examples/basic/bazel-testlogs/* examples-internal-elixir: + # Builds both Erlang and Elixir from source, so it pins its own versions in + # MODULE.bazel and takes no setup-beam. Single configuration by design. runs-on: ubuntu-latest steps: - name: CHECKOUT REPOSITORY @@ -104,21 +141,17 @@ jobs: - name: CONFIGURE working-directory: examples/internal-elixir run: | - cat << EOF >> .bazelrc + cat << EOF >> user.bazelrc build --disk_cache=/home/runner/disk-cache build --color=yes EOF - # - name: Setup tmate session - # uses: mxschmitt/action-tmate@v3 - name: BUILD & TEST working-directory: examples/internal-elixir env: ELIXIR_ERL_OPTIONS: +fnu run: | bazelisk test //... \ - --config=ie-26_2 \ - --toolchain_resolution_debug='@@rules_erlang~//tools:toolchain_type' \ - --toolchain_resolution_debug='@@rules_elixir~//:toolchain_type' \ + --config=ie-29 \ --verbose_failures - name: UPLOAD TEST LOGS if: always() diff --git a/.gitignore b/.gitignore index a6ef824..3829a81 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ /bazel-* +/user.bazelrc +.agents +.claude +.code/ +.idea/ +.DS_Store +MODULE.bazel.lock diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cb1910d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,185 @@ +# Changelog + +## 1.2.0 + +First release from . + +Continues from the **v1.1.0** tag of the unmaintained upstream, carrying the +fixes that were being kept downstream as a vendored copy. Requires +`rules_erlang` **3.18.0**. + +Every change is a separate commit, so `git diff v1.1.0..v1.2.0` is exactly this +list and nothing else. + +### Fixed + +- **Skip system Elixir** (`repositories/elixir_config.bzl`). Honour + `RULES_ELIXIR_SKIP_SYSTEM=1`, so a build can use a hermetic toolchain instead + of probing the host for an Elixir install. + +- **Portable tarball extraction** (`private/elixir_build.bzl`). The same GNU-tar + assumption fixed in rules_erlang 3.18.0. `--transform` does not exist in the + bsdtar that macOS ships, so every Elixir target failed on macOS before + compiling anything. + +- **Allow an empty `LICENSE` glob** (`elixir_app.bzl`). `elixir_app` hard-failed + on any package without a `LICENSE` file. + +- **Compile-time data** (`elixir_app.bzl`, `private/elixir_bytecode.bzl`). + `elixir_bytecode` could not declare compile-time file inputs, so a package + reading a file during compilation, or declaring `@external_resource`, failed in + the sandbox. + +- **ExUnit test headers** (`private/ex_unit_test.bzl`). `ex_unit_test` staged its + dependencies without their `include/` directories, so a test using + `Record.extract(from_lib: ...)` died before running a case. Compilation rules + stage headers; tests now do too. + +- **ExUnit workspace layout** (`private/ex_unit_test.bzl`). `ex_unit_test` + flattened `srcs` and `data` by stripping the package prefix, which breaks any + test resolving a repository-relative path off `__DIR__`. + +- **Stage test inputs into `TEST_TMPDIR`** (`private/ex_unit_test.bzl`). + `ex_unit_test` copied every `srcs` and `data` file into + `TEST_UNDECLARED_OUTPUTS_DIR` and ran there. Bazel treats that directory as + artifacts the test *produced*, so it stats and mime-types every entry to build + the manifest, then uploads them. Each target shipped a few thousand of its own + inputs to the CAS per run. On a remote executor carrying no `file(1)` it also + emitted roughly 2,150 "command not found" lines per test. Nothing was ever + collected from there on purpose. + +- **Migrate off the deprecated Windows condition** (`ex_unit_test.bzl`). + `@bazel_tools//src/conditions:host_windows` is deprecated and warned on every + `ex_unit_test` target; it is now the `@platforms//os:windows` constraint. This + is also a semantic correction. The old key matched the *host*, while the flag + decides whether the generated runner is a batch file or a shell script, a + property of the platform the test *executes* on. For a test rule that is the + target platform. + + The key is a `Label`, not a bare string. A `select()` key written as a string + resolves against the repo mapping of the package that *instantiates* the macro, + so a string would have obliged every consumer to add + `bazel_dep(name = "platforms")` of their own and failed with "No repository + visible as `@platforms`" if they did not. The question never arose while the + key was `@bazel_tools//...`, because `bazel_tools` is an implicit dependency of + every module and is visible from everywhere. + +- **ExUnit result detection under Elixir 1.20** (`private/ex_unit_test.bzl`). The + runner asserted on the summary text, matching `0 failure` and `[0-9] test`. + Elixir 1.20 replaced `N tests, M failures` with `Result: N passed`, so under it + every *passing* suite failed its own assertion. + + Failure detection now rests on the exit code, which the `set -eo pipefail` at + the top of the runner already carried through the `tee`, and which does not + change between releases. + + One assertion on the summary text remains, because there is exactly one thing + the exit code cannot express: a suite that executed no tests reports success, + which would let a target whose sources stopped matching any test pass forever. + It fires only when nothing ran *and* nothing was excluded. A target that + filters by tag and excludes everything it has is doing what it was asked to, + and is a normal way to shard a suite, so an exclusion count means the summary + is honest and the target passes. Both spellings are read while the supported + window spans Elixir 1.19 and 1.20. + + This is the one behavioural difference from 1.1.0. A suite that defines no + tests at all, and excludes none, passed before and now fails. That is the case + `//:empty_test` has always asserted should fail. + +### Added + +- **`mix_archive_build`** (`mix_archive_build.bzl`, + `private/mix_archive_build.bzl`): build a `.ez` Mix archive. The rules could + already compile an Elixir app but could not produce an archive, and + `mix archive.install` is the only way to give Mix something it needs *before* + it can resolve a project. Adapted from rabbitmq-server's + `bazel/elixir/mix_archive_build.bzl` (MPL-2.0), the same lineage as this + ruleset. + +- **`hex` module extension** (`bzlmod/extensions.bzl`): builds Hex itself from + source as a Mix archive, exported as `@hex//:archive`. + + Every consumer needs this and cannot discover it. Mix aborts with "Could not + find an SCM for dependency" on any dependency entry in a `mix.exs` unless Hex + is installed as an archive, including in a build that supplies all + dependencies from Bazel and passes `--no-deps-check`. Hex has no dependencies + of its own, so it bootstraps with an empty dependency graph. The version + defaults to `DEFAULT_HEX_VERSION` and is overridable with the + `from_github_release` tag, mirroring `internal_elixir_from_github_release`. + +### Removed + +- **Bazel 7 support**, declared as `bazel_compatibility = [">=8.0.0"]`. This + follows `rules_erlang` 3.18.0, which requires Bazel 8 and which this release + requires in turn, so 7 was already unreachable in practice. + +### Changed + +- **Dependencies moved to current stable.** + + | | from | to | + | --- | --- | --- | + | rules_erlang | 3.16.0 | 3.18.0 | + | bazel_skylib | 1.7.1 | 1.9.2 | + | platforms | - | 1.1.0 (new) | + + `platforms` is new because `ex_unit_test` selects on `@platforms//os:windows`; + see the Windows condition entry above for why the dependency belongs here + rather than in every consumer. + +- **`sh_test` loads from `@rules_shell`** (`test/BUILD.bazel`, + `test/MODULE.bazel`). It stopped being a native rule in Bazel 8, so the test + module gained both the load statement and a `rules_shell` dependency. + +- **`@platforms//host:host` replaces `@local_config_platform//:host`** + (`examples/internal-elixir`). Bazel 8 removed the autoconfigured + `local_config_platform` repository. The example's platforms also register + themselves as execution platforms, which Bazel 9 requires of any target + platform that has to run tests. + +- **The `internal-elixir` example builds OTP 29.0.5 and Elixir 1.20.3**, up from + OTP 26.2.5 and Elixir 1.16.1. It is the only from-source coverage there is, and + it was pinned two OTP majors behind the supported window. + +- **CI covers the latest two Elixir minors against the latest two OTP majors**, + currently 1.20 on OTP 29 and 1.19 on OTP 28. Elixir supports a moving window of + OTP majors, so the matrix tests pairs rather than crossing the two lists. The + Bazel matrix lives in the registry presubmit, which covers 8.x and 9.x. + +- **The registry presubmit installs Elixir**, which it never did. It built + `@rules_elixir//...` with only Erlang on the machine, leaving the external + Elixir toolchain nothing to resolve. It also moves from the `platforms:` + mapping to the `tasks:` schema, and activates the kerl build so the Elixir + archive finds an ERTS to run on. + + The structure here comes from rabbitmq/rules_elixir#7, merged from upstream's + final state; the versions are this project's. + +- **Fix the registry source template's archive name** (`.bcr/source.template.json`). + It asked for `rules_elixir-{TAG}.tar.gz`, but the release workflow uploads + `rules_elixir-{VERSION}.tar.gz`, and this repository tags with a leading `v`. + The two are only equal when the tag carries no prefix, so the published URL + would have been `rules_elixir-v1.2.0.tar.gz` and returned a 404. + +- **Publishing targets the Bazel Central Registry.** The workflow that pushed to + `rabbitmq/bazel-central-registry@erlang-packages`, a private registry fork this + project cannot write to, is replaced by `bazel-contrib/publish-to-bcr`. The + registry entry for that fork is also dropped from every `.bazelrc`; it served + `rules_erlang` 3.15.x and nothing reads it now. + +### Compatibility + +For a bzlmod consumer, 1.2.0 is a drop-in replacement for 1.1.0: no rule, macro, +provider or attribute changed. The `rules_erlang` dependency moves from 3.16.0 to +3.18.0, which is itself a drop-in replacement. + +One behaviour differs, described under the ExUnit entry above: an `ex_unit_test` +that runs no tests and excludes none now fails rather than passes. A target that +excludes everything by tag is unaffected. + +Requires Bazel 8 or newer. Tested on Bazel 8.7.0 and 9.2.0. + +Neither module is on the Bazel Central Registry yet, so a consumer needs an +override for `rules_elixir` **and** one for `rules_erlang`. Overrides only take +effect in the root module, which is why both are needed even though only one is a +direct dependency. See the Installation section of the README. diff --git a/COPYRIGHT.md b/COPYRIGHT.md new file mode 100644 index 0000000..dc18c32 --- /dev/null +++ b/COPYRIGHT.md @@ -0,0 +1,29 @@ +# Copyright + +## Original work + +(c) 2020-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved. + +This project began as rabbitmq's `rules_elixir` and consists substantially of +that work. The notice above is reproduced verbatim from the upstream `README.md` +as it stood at tag `v1.1.0`, the last release published there. + +Portions of `mix_archive_build` are adapted from +[rabbitmq-server](https://github.com/rabbitmq/rabbitmq-server)'s +`bazel/elixir/mix_archive_build.bzl`, which is MPL-2.0 and shares this ruleset's +lineage. + +## Subsequent work + +Modifications made in this repository after the fork point (upstream tag +`v1.1.0`, commit `42f412b`) are copyright their respective authors and are +contributed under the same dual license as the original work. See +[CHANGELOG.md](./CHANGELOG.md) for what those modifications are, and the git +history for who made them. `git log v1.1.0..` lists exactly the post-fork +commits. + +## License + +For the terms under which this software may be used +and redistributed, see [LICENSE](./LICENSE) and the section of the same name in +[README.md](./README.md). diff --git a/MODULE.bazel b/MODULE.bazel index abacfe9..73e9aae 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,15 +1,39 @@ module( name = "rules_elixir", - version = "1.1.0", + version = "1.2.0", + bazel_compatibility = [">=8.0.0"], ) bazel_dep( name = "bazel_skylib", - version = "1.7.1", + version = "1.9.2", +) + +# ex_unit_test selects on @platforms//os:windows. See the comment in +# //:ex_unit_test.bzl for why the dependency belongs here rather than in every +# consumer's MODULE.bazel. +bazel_dep( + name = "platforms", + version = "1.1.0", ) bazel_dep( name = "rules_erlang", - version = "3.16.0", + version = "3.18.0", +) + +# rules_erlang 3.18.0 is not on the Bazel Central Registry yet; ownership of the +# registry entry is being transferred from rabbitmq. Until that lands the +# bazel_dep above cannot resolve on its own, and every module in the graph that +# needs it has to override it. +# +# Overrides only take effect in the root module, so this one covers this +# repository's own build and nothing else. A consumer of rules_elixir needs the +# same block in its own MODULE.bazel; see the Installation section of README.md. +# Drop it once rules_erlang is published. +git_override( + module_name = "rules_erlang", + remote = "https://github.com/bazelverse/rules_erlang.git", + commit = "5531a30ab87ed7e2a63eb1a901c4eeac1bb2bcc6", # 3.18.0 ) elixir_config = use_extension( diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock deleted file mode 100644 index f318a77..0000000 --- a/MODULE.bazel.lock +++ /dev/null @@ -1,305 +0,0 @@ -{ - "lockFileVersion": 11, - "registryFileHashes": { - "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", - "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", - "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", - "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/source.json": "7e3a9adf473e9af076ae485ed649d5641ad50ec5c11718103f34de03170d94ad", - "https://bcr.bazel.build/modules/apple_support/1.5.0/MODULE.bazel": "50341a62efbc483e8a2a6aec30994a58749bd7b885e18dd96aa8c33031e558ef", - "https://bcr.bazel.build/modules/apple_support/1.5.0/source.json": "eb98a7627c0bc486b57f598ad8da50f6625d974c8f723e9ea71bd39f709c9862", - "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", - "https://bcr.bazel.build/modules/bazel_features/1.11.0/source.json": "c9320aa53cd1c441d24bd6b716da087ad7e4ff0d9742a9884587596edfe53015", - "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", - "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", - "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", - "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", - "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", - "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", - "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", - "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953", - "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", - "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", - "https://bcr.bazel.build/modules/gazelle/0.32.0/MODULE.bazel": "b499f58a5d0d3537f3cf5b76d8ada18242f64ec474d8391247438bf04f58c7b8", - "https://bcr.bazel.build/modules/gazelle/0.33.0/MODULE.bazel": "a13a0f279b462b784fb8dd52a4074526c4a2afe70e114c7d09066097a46b3350", - "https://bcr.bazel.build/modules/gazelle/0.33.0/source.json": "ddd6c264f75051b9dded4a256b96351f8464c73abc657c364bc0a0b7f5e32d9e", - "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", - "https://bcr.bazel.build/modules/googletest/1.11.0/source.json": "c73d9ef4268c91bd0c1cd88f1f9dfa08e814b1dbe89b5f594a9f08ba0244d206", - "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", - "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", - "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", - "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", - "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", - "https://bcr.bazel.build/modules/platforms/0.0.9/source.json": "cd74d854bf16a9e002fb2ca7b1a421f4403cda29f824a765acd3a8c56f8d43e6", - "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", - "https://bcr.bazel.build/modules/protobuf/21.7/source.json": "bbe500720421e582ff2d18b0802464205138c06056f443184de39fbb8187b09b", - "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", - "https://bcr.bazel.build/modules/protobuf/3.19.2/MODULE.bazel": "532ffe5f2186b69fdde039efe6df13ba726ff338c6bc82275ad433013fa10573", - "https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858", - "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", - "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", - "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", - "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", - "https://bcr.bazel.build/modules/rules_cc/0.0.9/source.json": "1f1ba6fea244b616de4a554a0f4983c91a9301640c8fe0dd1d410254115c8430", - "https://bcr.bazel.build/modules/rules_erlang/3.15.3/MODULE.bazel": "not found", - "https://bcr.bazel.build/modules/rules_go/0.41.0/MODULE.bazel": "55861d8e8bb0e62cbd2896f60ff303f62ffcb0eddb74ecb0e5c0cbe36fc292c8", - "https://bcr.bazel.build/modules/rules_go/0.41.0/source.json": "a46e5f523176e3bd60b1c9cfdcb6c878b9cd14c21fe1a563c4ba0e6d0e7c4dd8", - "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", - "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", - "https://bcr.bazel.build/modules/rules_java/7.6.1/source.json": "8f3f3076554e1558e8e468b2232991c510ecbcbed9e6f8c06ac31c93bcf38362", - "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", - "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/source.json": "a075731e1b46bc8425098512d038d416e966ab19684a10a34f4741295642fc35", - "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", - "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", - "https://bcr.bazel.build/modules/rules_license/0.0.7/source.json": "355cc5737a0f294e560d52b1b7a6492d4fff2caf0bef1a315df5a298fca2d34a", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/source.json": "c2557066e0c0342223ba592510ad3d812d4963b9024831f7f66fd0584dd8c66c", - "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/source.json": "d57902c052424dfda0e71646cb12668d39c4620ee0544294d9d941e7d12bc3a9", - "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", - "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7", - "https://bcr.bazel.build/modules/rules_python/0.22.1/source.json": "57226905e783bae7c37c2dd662be078728e48fa28ee4324a7eabcafb5a43d014", - "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", - "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", - "https://bcr.bazel.build/modules/stardoc/0.5.1/source.json": "a96f95e02123320aa015b956f29c00cb818fa891ef823d55148e1a362caacf29", - "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", - "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/source.json": "f1ef7d3f9e0e26d4b23d1c39b5f5de71f584dd7d1b4ef83d9bbba6ec7a6a6459", - "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", - "https://bcr.bazel.build/modules/zlib/1.2.12/MODULE.bazel": "3b1a8834ada2a883674be8cbd36ede1b6ec481477ada359cd2d3ddc562340b27", - "https://bcr.bazel.build/modules/zlib/1.3/MODULE.bazel": "6a9c02f19a24dcedb05572b2381446e27c272cd383aed11d41d99da9e3167a72", - "https://bcr.bazel.build/modules/zlib/1.3/source.json": "b6b43d0737af846022636e6e255fd4a96fee0d34f08f3830e6e0bac51465c37c", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/modules/rules_erlang/3.15.3/MODULE.bazel": "0d3c1351779355e23f87bbe3213125538930c3dd2aaad292b293867ea8ce60c0", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/modules/rules_erlang/3.15.3/source.json": "8284c4ade6b9d517d611cd45affecce41bf75ee682d929f7048ec77d8765cacd" - }, - "selectedYankedVersions": {}, - "moduleExtensions": { - "//bzlmod:extensions.bzl%elixir_config": { - "general": { - "bzlTransitiveDigest": "ohoT9jmBnvAHOfB4OsOb7JBw77WEicWKthjpKqEIdR4=", - "usagesDigest": "YpOlYB/yIHoUkO6xYHsWGiR0HGmlETgSi8lMqz6EDro=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "elixir_config": { - "bzlFile": "@@//repositories:elixir_config.bzl", - "ruleClassName": "elixir_config", - "attributes": { - "types": {}, - "versions": {}, - "urls": {}, - "strip_prefixs": {}, - "sha256s": {}, - "elixir_homes": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "", - "rules_erlang", - "rules_erlang~" - ] - ] - } - }, - "@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": { - "general": { - "bzlTransitiveDigest": "PjIds3feoYE8SGbbIq2SFTZy3zmxeO2tQevJZNDo7iY=", - "usagesDigest": "aLmqbvowmHkkBPve05yyDNGN7oh7QE9kBADr3QIZTZs=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "local_config_apple_cc": { - "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf", - "attributes": {} - }, - "local_config_apple_cc_toolchains": { - "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf_toolchains", - "attributes": {} - } - }, - "recordedRepoMappingEntries": [ - [ - "apple_support~", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, - "@@gazelle~//internal/bzlmod:non_module_deps.bzl%non_module_deps": { - "general": { - "bzlTransitiveDigest": "idtJXxcHUd75fcvggtK/s6naCFjcaysxF0U5OKBm2LE=", - "usagesDigest": "2GrCenk3V2jcu4jPJC70X5rsF4uSsnyO6PT3nq2PFls=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_gazelle_is_bazel_module": { - "bzlFile": "@@gazelle~//internal:is_bazel_module.bzl", - "ruleClassName": "is_bazel_module", - "attributes": { - "is_bazel_module": true - } - }, - "bazel_gazelle_go_repository_tools": { - "bzlFile": "@@gazelle~//internal:go_repository_tools.bzl", - "ruleClassName": "go_repository_tools", - "attributes": { - "go_cache": "@@gazelle~~non_module_deps~bazel_gazelle_go_repository_cache//:go.env" - } - }, - "bazel_gazelle_go_repository_cache": { - "bzlFile": "@@gazelle~//internal:go_repository_cache.bzl", - "ruleClassName": "go_repository_cache", - "attributes": { - "go_sdk_name": "@rules_go~~go_sdk~go_default_sdk", - "go_env": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "gazelle~", - "bazel_gazelle_go_repository_cache", - "gazelle~~non_module_deps~bazel_gazelle_go_repository_cache" - ], - [ - "gazelle~", - "go_host_compatible_sdk_label", - "rules_go~~go_sdk~go_host_compatible_sdk_label" - ], - [ - "rules_go~~go_sdk~go_host_compatible_sdk_label", - "go_default_sdk", - "rules_go~~go_sdk~go_default_sdk" - ] - ] - } - }, - "@@platforms//host:extension.bzl%host_platform": { - "general": { - "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", - "usagesDigest": "meSzxn3DUCcYEhq4HQwExWkWtU4EjriRBQLsZN+Q0SU=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "host_platform": { - "bzlFile": "@@platforms//host:extension.bzl", - "ruleClassName": "host_platform_repo", - "attributes": {} - } - }, - "recordedRepoMappingEntries": [] - } - }, - "@@rules_erlang~//bzlmod:extensions.bzl%erlang_config": { - "general": { - "bzlTransitiveDigest": "cKDB+SYgzLJKzBBfy42/kejTy+1rUzE3TYs1J4nJtWA=", - "usagesDigest": "+EutKOgJf/CnYiqV+kcpZeYjtXNK7EIww4cjakt5EXo=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "erlang_config": { - "bzlFile": "@@rules_erlang~//repositories:erlang_config.bzl", - "ruleClassName": "erlang_config", - "attributes": { - "rules_erlang_workspace": "@rules_erlang", - "types": {}, - "versions": {}, - "urls": {}, - "strip_prefixs": {}, - "sha256s": {}, - "erlang_homes": {}, - "pre_configure_cmdss": {}, - "extra_configure_optss": {}, - "post_configure_cmdss": {}, - "extra_make_optss": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_erlang~", - "bazel_skylib", - "bazel_skylib~" - ], - [ - "rules_erlang~", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, - "@@rules_go~//go:extensions.bzl%go_sdk": { - "general": { - "bzlTransitiveDigest": "EJ2jI5PPSo7sHmzcmLtJ0MyhdsySDOSbGoU59oYFq6g=", - "usagesDigest": "zKi6eOBEOZOxjpiMDmtTYD8ZESGY9dbIW0TNFNpFnYw=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "go_default_sdk": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.20.2" - } - }, - "go_host_compatible_sdk_label": { - "bzlFile": "@@rules_go~//go/private:extensions.bzl", - "ruleClassName": "host_compatible_toolchain", - "attributes": { - "toolchain": "@go_default_sdk//:ROOT" - } - }, - "go_toolchains": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_multiple_toolchains", - "attributes": { - "prefixes": [ - "_0000_go_default_sdk_" - ], - "geese": [ - "" - ], - "goarchs": [ - "" - ], - "sdk_repos": [ - "go_default_sdk" - ], - "sdk_types": [ - "remote" - ], - "sdk_versions": [ - "1.20.2" - ] - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_go~", - "bazel_tools", - "bazel_tools" - ] - ] - } - } - } -} diff --git a/README.md b/README.md index 62412f0..a283661 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,197 @@ # rules_elixir -Bazel rules for Elixir sources +Bazel rules for building Elixir applications. Compile an app, run its ExUnit +suites, build a Mix archive, and evaluate code with `iex`. -Compatible with [rules_erlang](https://github.com/rabbitmq/rules_erlang) +Built on [rules_erlang](https://github.com/bazelverse/rules_erlang), and requires +it. Elixir applications are OTP applications, so the Erlang toolchain, the app +metadata and the `ERL_LIBS` staging all come from there. -## Maintenance Status +## Supported versions -Team RabbitMQ were using Bazel heavily alongside `erlang.mk` for a few years for its parallel -builds and caching features. +Requires bzlmod and `rules_erlang` 3.18.0 or newer. Bazel 7 is not supported; +the Bazel Central Registry presubmit covers 8.x and 9.x, and `.bazelversion` +pins what GitHub CI runs. -However, `erlang.mk` has caught up and Bazel fell out of use. +CI covers the **latest two Elixir minors** against the **latest two OTP +majors**. Elixir supports a moving window of OTP majors, so the pairs are tested +as pairs rather than crossed: -Therefore, **this project is not actively maintained**. It has been forked, and an actively maintained version is located at [marvin-hansen/rules_elixir](https://github.com/marvin-hansen/rules_elixir). +| Elixir | Erlang/OTP | +| --- | --- | +| 1.20 | 29 | +| 1.19 | 28 | -## Examples +Earlier versions may well work, and nothing has been deliberately broken for +them, but they are untested here. Treat them as use-at-your-own-risk. + +## Status + +This repository continues rabbitmq's `rules_elixir`, which is unmaintained. +`v1.1.0` was its last release. + +**For a bzlmod consumer, 1.2.0 is a drop-in replacement for 1.1.0.** No rule, +macro, provider or attribute changed; every commit between the two tags is one +documented fix or addition. See [CHANGELOG.md](./CHANGELOG.md). + +## Installation + +> **Git pre-release only.** `rules_elixir` and `rules_erlang` are both awaiting +> Bazel Central Registry entries, so `bazel_dep` alone will not resolve and you +> need an override for each. Overrides only take effect in the **root module**, +> which is why you declare both even though only one is a direct dependency. +> Once the registry entries land, delete the overrides and keep the `bazel_dep` +> lines; nothing else changes. + +```starlark +bazel_dep(name = "rules_elixir", version = "1.2.0") +bazel_dep(name = "rules_erlang", version = "3.18.0") + +git_override( + module_name = "rules_elixir", + remote = "https://github.com/bazelverse/rules_elixir.git", + commit = "0000000000000000000000000000000000000000", # v1.2.0 +) + +git_override( + module_name = "rules_erlang", + remote = "https://github.com/bazelverse/rules_erlang.git", + commit = "5531a30ab87ed7e2a63eb1a901c4eeac1bb2bcc6", # 3.18.0 +) +``` + +`commit` takes a full SHA, not a tag. Pin the commit a release tag points at +rather than the tag itself: a SHA cannot be moved, and it is the same thing the +registry will hand you later. `git rev-list -n1 v1.2.0` prints it. + +The `version` in `bazel_dep` is still required. It is what the module reports to +the rest of the graph; the override decides what is actually fetched. + +### Then, in the same `MODULE.bazel` + +```starlark +elixir_config = use_extension( + "@rules_elixir//bzlmod:extensions.bzl", + "elixir_config", +) +use_repo(elixir_config, "elixir_config") + +register_toolchains("@elixir_config//external:toolchain") +``` + +That uses the Elixir already on the machine. To have Bazel fetch and build a +pinned Elixir instead: + +```starlark +elixir_config.internal_elixir_from_github_release( + version = "1.20.3", + sha256 = "ff22a894b130631443db1a193b4e8cb4762f697128566e43da848fd16c3777bd", +) +``` + +The `sha256` is of the source archive the extension fetches, which is +`https://github.com/elixir-lang/elixir/archive/refs/tags/v.tar.gz`, not +one of the precompiled release assets. + +Building Elixir from source needs an Erlang to build it with, so pair this with +`internal_erlang_from_github_release` from `rules_erlang` and keep the two +versions compatible. `examples/internal-elixir` is a working setup of exactly +that. + +Set `RULES_ELIXIR_SKIP_SYSTEM=1` to stop the extension probing the host for an +Elixir install at all. That is what you want when every toolchain is hermetic: + +``` +build --repo_env=RULES_ELIXIR_SKIP_SYSTEM=1 +build --repo_env=RULES_ERLANG_SKIP_SYSTEM=1 +``` -See the `examples` directory +## Rules + +| Rule | What it does | +| --- | --- | +| `elixir_app` | Compile an Elixir application into an OTP app | +| `elixir_external` | Wrap an Elixir installation outside the build | +| `ex_unit_test` | Run an ExUnit suite as a Bazel test | +| `mix_archive_build` | Build a `.ez` Mix archive | +| `iex_eval` | Evaluate Elixir code with `iex` | +| `elixir_build` | Build Elixir itself from source | +| `elixir_toolchain` | Declare an Elixir toolchain | + +### Compiling an application + +```starlark +load("@rules_elixir//:elixir_app.bzl", "elixir_app") + +elixir_app( + name = "my_app", + srcs = glob(["lib/**/*.ex"]), + app_name = "my_app", + app_version = "0.1.0", +) +``` + +Declare anything read at compile time, whether reached through `File.read!/1` or +`@external_resource`. Undeclared files do not exist in the sandbox. + +### Running tests + +```starlark +load("@rules_elixir//:ex_unit_test.bzl", "ex_unit_test") + +ex_unit_test( + name = "my_app_test", + srcs = glob(["test/**/*_test.exs"]), + deps = [":my_app"], +) +``` + +Test inputs keep their package-relative layout, so a test resolving a path off +`__DIR__` finds what it expects. + +## Hex + +Mix will not resolve a project at all unless Hex is installed as an archive. Any +dependency entry in a `mix.exs` aborts with *"Could not find an SCM for +dependency"*, even a dev-only one that would never be compiled, and even in a +build that supplies every dependency from Bazel and passes `--no-deps-check`. + +The `hex` extension builds Hex from source and exports it as `@hex//:archive`: + +```starlark +hex = use_extension("@rules_elixir//bzlmod:extensions.bzl", "hex") +use_repo(hex, "hex") +``` + +Pin a different version with the `from_github_release` tag: + +```starlark +hex.from_github_release( + version = "2.5.1", + sha256 = "...", +) +``` + +Hex has no dependencies of its own, so it bootstraps through +`mix_archive_build` with an empty dependency graph. That is why this can live +here rather than in every consuming module. + +Fetching Hex *packages* is a different job from installing Hex the tool. For a +handful of packages see `rules_erlang`'s `erlang_package` extension; for a whole +application closure, its `hex_packages_extension`. + +## Examples -## Copyright and License +See the `examples` directory. -(c) 2020-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved. +## License -Dual licensed under the Apache License Version 2.0 and -Mozilla Public License Version 2.0. +Dual licensed under the Apache License Version 2.0 and the Mozilla Public +License Version 2.0. -This means that the user can consider the library to be licensed under -**any of the licenses from the list** above. For example, you may -choose the Apache Public License 2.0 and include this library into a -commercial product. +You may consider this library to be licensed under **any of the licenses in that +list**. For example, you may choose the Apache License 2.0 and include this +library in a commercial product. -See [LICENSE](./LICENSE) for details. +See [LICENSE](./LICENSE) for details. Copyright, including the notice for the +original upstream work, is covered separately in [COPYRIGHT.md](./COPYRIGHT.md). diff --git a/bzlmod/extensions.bzl b/bzlmod/extensions.bzl index 377cdaa..4abc3e2 100644 --- a/bzlmod/extensions.bzl +++ b/bzlmod/extensions.bzl @@ -1,3 +1,4 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load( "//repositories:elixir_config.bzl", "INSTALLATION_TYPE_EXTERNAL", @@ -85,3 +86,69 @@ elixir_config = module_extension( "internal_elixir_from_github_release": internal_elixir_from_github_release, }, ) + +# Hex, the package manager, built from source as a Mix archive. +# +# Not for fetching anything. Mix needs Hex installed as an archive before it can resolve a +# project at all: without it, `{:dep, "~> x.y"}` in a mix.exs aborts with "Could not find an +# SCM for dependency", even for a dev-only dep that would never be compiled. A build that +# supplies every dependency from Bazel and runs `mix --no-deps-check` still trips over this. +# +# Hex has no dependencies of its own, so it bootstraps through mix_archive_build with an +# empty dep graph -- which is why this can live here rather than in the consuming module. +DEFAULT_HEX_VERSION = "2.5.1" + +DEFAULT_HEX_SHA256 = "dabd99ea48ba8064c32bc2e97d59ab1b1055a38a1dd178c5389d95c35e985d2d" + +_HEX_BUILD_FILE = """\ +load("@rules_elixir//:mix_archive_build.bzl", "mix_archive_build") + +# Consumed via `mix archive.install`, not as an ERL_LIBS dependency, so it has to be a .ez. +mix_archive_build( + name = "archive", + srcs = ["mix.exs"] + glob(["lib/**/*"]), + out = "hex.ez", + visibility = ["//visibility:public"], +) +""" + +def _hex(ctx): + version = DEFAULT_HEX_VERSION + sha256 = DEFAULT_HEX_SHA256 + + # Last tag wins, and the root module's tags are evaluated last, so a consumer can pin a + # version without every dependency in the graph having to agree on one. + for mod in ctx.modules: + for hex in mod.tags.from_github_release: + version = hex.version + sha256 = hex.sha256 + + http_archive( + name = "hex", + build_file_content = _HEX_BUILD_FILE, + sha256 = sha256, + strip_prefix = "hex-{}".format(version), + urls = ["https://github.com/hexpm/hex/archive/refs/tags/v{}.zip".format(version)], + ) + + return ctx.extension_metadata( + root_module_direct_deps = ["hex"], + root_module_direct_dev_deps = [], + reproducible = True, + ) + +from_github_release = tag_class(attrs = { + "version": attr.string( + default = DEFAULT_HEX_VERSION, + ), + "sha256": attr.string( + default = DEFAULT_HEX_SHA256, + ), +}) + +hex = module_extension( + implementation = _hex, + tag_classes = { + "from_github_release": from_github_release, + }, +) diff --git a/elixir_app.bzl b/elixir_app.bzl index 27cc301..33d8c26 100644 --- a/elixir_app.bzl +++ b/elixir_app.bzl @@ -8,6 +8,7 @@ def elixir_app( app_name = None, extra_apps = [], srcs = None, + data = [], elixirc_opts = [], ez_deps = [], deps = [], @@ -36,6 +37,7 @@ def elixir_app( elixir_bytecode( name = "beam_files", srcs = srcs, + data = data, dest = "beam_files", elixirc_opts = elixirc_opts, ez_deps = ez_deps, @@ -72,7 +74,10 @@ def elixir_app( app_name = app_name, beam = [":ebin"], extra_apps = extra_apps, - license_files = native.glob(["LICENSE*"]), + # allow_empty: plenty of Hex packages ship no LICENSE file (ash among them), and + # with --incompatible_disallow_empty_glob on -- the default since Bazel 7 -- an + # empty glob is a hard error, so those packages could not be built at all. + license_files = native.glob(["LICENSE*"], allow_empty = True), priv = [], visibility = ["//visibility:public"], deps = [ diff --git a/ex_unit_test.bzl b/ex_unit_test.bzl index 5d43074..6849dce 100644 --- a/ex_unit_test.bzl +++ b/ex_unit_test.bzl @@ -3,11 +3,23 @@ load( _ex_unit_test = "ex_unit_test", ) +# Label() rather than the bare string "@platforms//os:windows". A select() key +# written as a string is resolved against the repo mapping of the package that +# *instantiates* the macro, so a bare string would oblige every consumer to +# declare bazel_dep(name = "platforms") of their own, and fail with "No +# repository visible as '@platforms'" if they did not. Label() resolves against +# this module's repo mapping instead, where the dependency is declared. +# +# This did not arise while the key was @bazel_tools//src/conditions:host_windows, +# because bazel_tools is an implicit dependency of every module and is therefore +# visible from everywhere. +_IS_WINDOWS = select({ + Label("@platforms//os:windows"): True, + "//conditions:default": False, +}) + def ex_unit_test(**kwargs): _ex_unit_test( - is_windows = select({ - "@bazel_tools//src/conditions:host_windows": True, - "//conditions:default": False, - }), + is_windows = _IS_WINDOWS, **kwargs ) diff --git a/examples/basic/.bazelrc b/examples/basic/.bazelrc index d7277da..a836d06 100644 --- a/examples/basic/.bazelrc +++ b/examples/basic/.bazelrc @@ -1,7 +1,5 @@ build --registry=https://bcr.bazel.build/ -build --registry=https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/ build --incompatible_strict_action_env -build --bes_results_url=https://app.buildbuddy.io/invocation/ -build --bes_backend=grpcs://remote.buildbuddy.io +try-import %workspace%/user.bazelrc diff --git a/examples/basic/MODULE.bazel b/examples/basic/MODULE.bazel index 5b4d4a4..0a36994 100644 --- a/examples/basic/MODULE.bazel +++ b/examples/basic/MODULE.bazel @@ -5,13 +5,22 @@ module( bazel_dep( name = "rules_erlang", - version = "3.16.0", + version = "3.18.0", ) bazel_dep( name = "rules_elixir", - version = "0.1.0", + version = "1.2.0", ) local_path_override( module_name = "rules_elixir", path = "../..", ) + +# See the note in the root MODULE.bazel. This example is its own module, so it +# needs its own override; the one in the ruleset it depends on does not carry +# over. +git_override( + module_name = "rules_erlang", + remote = "https://github.com/bazelverse/rules_erlang.git", + commit = "5531a30ab87ed7e2a63eb1a901c4eeac1bb2bcc6", # 3.18.0 +) diff --git a/examples/basic/MODULE.bazel.lock b/examples/basic/MODULE.bazel.lock deleted file mode 100644 index 6ab5e1d..0000000 --- a/examples/basic/MODULE.bazel.lock +++ /dev/null @@ -1,304 +0,0 @@ -{ - "lockFileVersion": 11, - "registryFileHashes": { - "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", - "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", - "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", - "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/source.json": "7e3a9adf473e9af076ae485ed649d5641ad50ec5c11718103f34de03170d94ad", - "https://bcr.bazel.build/modules/apple_support/1.5.0/MODULE.bazel": "50341a62efbc483e8a2a6aec30994a58749bd7b885e18dd96aa8c33031e558ef", - "https://bcr.bazel.build/modules/apple_support/1.5.0/source.json": "eb98a7627c0bc486b57f598ad8da50f6625d974c8f723e9ea71bd39f709c9862", - "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", - "https://bcr.bazel.build/modules/bazel_features/1.11.0/source.json": "c9320aa53cd1c441d24bd6b716da087ad7e4ff0d9742a9884587596edfe53015", - "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", - "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", - "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", - "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", - "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", - "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", - "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/source.json": "082ed5f9837901fada8c68c2f3ddc958bb22b6d654f71dd73f3df30d45d4b749", - "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", - "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", - "https://bcr.bazel.build/modules/gazelle/0.32.0/MODULE.bazel": "b499f58a5d0d3537f3cf5b76d8ada18242f64ec474d8391247438bf04f58c7b8", - "https://bcr.bazel.build/modules/gazelle/0.33.0/MODULE.bazel": "a13a0f279b462b784fb8dd52a4074526c4a2afe70e114c7d09066097a46b3350", - "https://bcr.bazel.build/modules/gazelle/0.33.0/source.json": "ddd6c264f75051b9dded4a256b96351f8464c73abc657c364bc0a0b7f5e32d9e", - "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", - "https://bcr.bazel.build/modules/googletest/1.11.0/source.json": "c73d9ef4268c91bd0c1cd88f1f9dfa08e814b1dbe89b5f594a9f08ba0244d206", - "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", - "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", - "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", - "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", - "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", - "https://bcr.bazel.build/modules/platforms/0.0.9/source.json": "cd74d854bf16a9e002fb2ca7b1a421f4403cda29f824a765acd3a8c56f8d43e6", - "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", - "https://bcr.bazel.build/modules/protobuf/21.7/source.json": "bbe500720421e582ff2d18b0802464205138c06056f443184de39fbb8187b09b", - "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", - "https://bcr.bazel.build/modules/protobuf/3.19.2/MODULE.bazel": "532ffe5f2186b69fdde039efe6df13ba726ff338c6bc82275ad433013fa10573", - "https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858", - "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", - "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", - "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", - "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", - "https://bcr.bazel.build/modules/rules_cc/0.0.9/source.json": "1f1ba6fea244b616de4a554a0f4983c91a9301640c8fe0dd1d410254115c8430", - "https://bcr.bazel.build/modules/rules_erlang/3.15.2/MODULE.bazel": "not found", - "https://bcr.bazel.build/modules/rules_go/0.41.0/MODULE.bazel": "55861d8e8bb0e62cbd2896f60ff303f62ffcb0eddb74ecb0e5c0cbe36fc292c8", - "https://bcr.bazel.build/modules/rules_go/0.41.0/source.json": "a46e5f523176e3bd60b1c9cfdcb6c878b9cd14c21fe1a563c4ba0e6d0e7c4dd8", - "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", - "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", - "https://bcr.bazel.build/modules/rules_java/7.6.1/source.json": "8f3f3076554e1558e8e468b2232991c510ecbcbed9e6f8c06ac31c93bcf38362", - "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", - "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/source.json": "a075731e1b46bc8425098512d038d416e966ab19684a10a34f4741295642fc35", - "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", - "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", - "https://bcr.bazel.build/modules/rules_license/0.0.7/source.json": "355cc5737a0f294e560d52b1b7a6492d4fff2caf0bef1a315df5a298fca2d34a", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/source.json": "c2557066e0c0342223ba592510ad3d812d4963b9024831f7f66fd0584dd8c66c", - "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/source.json": "d57902c052424dfda0e71646cb12668d39c4620ee0544294d9d941e7d12bc3a9", - "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", - "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7", - "https://bcr.bazel.build/modules/rules_python/0.22.1/source.json": "57226905e783bae7c37c2dd662be078728e48fa28ee4324a7eabcafb5a43d014", - "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", - "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", - "https://bcr.bazel.build/modules/stardoc/0.5.1/source.json": "a96f95e02123320aa015b956f29c00cb818fa891ef823d55148e1a362caacf29", - "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", - "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/source.json": "f1ef7d3f9e0e26d4b23d1c39b5f5de71f584dd7d1b4ef83d9bbba6ec7a6a6459", - "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", - "https://bcr.bazel.build/modules/zlib/1.2.12/MODULE.bazel": "3b1a8834ada2a883674be8cbd36ede1b6ec481477ada359cd2d3ddc562340b27", - "https://bcr.bazel.build/modules/zlib/1.3/MODULE.bazel": "6a9c02f19a24dcedb05572b2381446e27c272cd383aed11d41d99da9e3167a72", - "https://bcr.bazel.build/modules/zlib/1.3/source.json": "b6b43d0737af846022636e6e255fd4a96fee0d34f08f3830e6e0bac51465c37c", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/modules/rules_erlang/3.15.2/MODULE.bazel": "75e0cadd4428a0f33b09632791491cdf35ff8cdd5b8e1af87bb9b3e18a459544", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/modules/rules_erlang/3.15.2/source.json": "85ea30b062cf2bea8ce3f2d59228ca22f1b8e6d58eaa0f2c3a037a4850ffb344" - }, - "selectedYankedVersions": {}, - "moduleExtensions": { - "@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": { - "general": { - "bzlTransitiveDigest": "PjIds3feoYE8SGbbIq2SFTZy3zmxeO2tQevJZNDo7iY=", - "usagesDigest": "aLmqbvowmHkkBPve05yyDNGN7oh7QE9kBADr3QIZTZs=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "local_config_apple_cc": { - "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf", - "attributes": {} - }, - "local_config_apple_cc_toolchains": { - "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf_toolchains", - "attributes": {} - } - }, - "recordedRepoMappingEntries": [ - [ - "apple_support~", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, - "@@gazelle~//internal/bzlmod:non_module_deps.bzl%non_module_deps": { - "general": { - "bzlTransitiveDigest": "idtJXxcHUd75fcvggtK/s6naCFjcaysxF0U5OKBm2LE=", - "usagesDigest": "2GrCenk3V2jcu4jPJC70X5rsF4uSsnyO6PT3nq2PFls=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_gazelle_is_bazel_module": { - "bzlFile": "@@gazelle~//internal:is_bazel_module.bzl", - "ruleClassName": "is_bazel_module", - "attributes": { - "is_bazel_module": true - } - }, - "bazel_gazelle_go_repository_tools": { - "bzlFile": "@@gazelle~//internal:go_repository_tools.bzl", - "ruleClassName": "go_repository_tools", - "attributes": { - "go_cache": "@@gazelle~~non_module_deps~bazel_gazelle_go_repository_cache//:go.env" - } - }, - "bazel_gazelle_go_repository_cache": { - "bzlFile": "@@gazelle~//internal:go_repository_cache.bzl", - "ruleClassName": "go_repository_cache", - "attributes": { - "go_sdk_name": "@rules_go~~go_sdk~go_default_sdk", - "go_env": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "gazelle~", - "bazel_gazelle_go_repository_cache", - "gazelle~~non_module_deps~bazel_gazelle_go_repository_cache" - ], - [ - "gazelle~", - "go_host_compatible_sdk_label", - "rules_go~~go_sdk~go_host_compatible_sdk_label" - ], - [ - "rules_go~~go_sdk~go_host_compatible_sdk_label", - "go_default_sdk", - "rules_go~~go_sdk~go_default_sdk" - ] - ] - } - }, - "@@platforms//host:extension.bzl%host_platform": { - "general": { - "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", - "usagesDigest": "meSzxn3DUCcYEhq4HQwExWkWtU4EjriRBQLsZN+Q0SU=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "host_platform": { - "bzlFile": "@@platforms//host:extension.bzl", - "ruleClassName": "host_platform_repo", - "attributes": {} - } - }, - "recordedRepoMappingEntries": [] - } - }, - "@@rules_elixir~//bzlmod:extensions.bzl%elixir_config": { - "general": { - "bzlTransitiveDigest": "bPlGPeHK26/+R0kJbyn93U7fs2348xBA6T+N//6n1Yw=", - "usagesDigest": "kp8/iOWoD/eSCkneQ1qVmUrdmavBigjxvFHiN4zXYZI=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "elixir_config": { - "bzlFile": "@@rules_elixir~//repositories:elixir_config.bzl", - "ruleClassName": "elixir_config", - "attributes": { - "types": {}, - "versions": {}, - "urls": {}, - "strip_prefixs": {}, - "sha256s": {}, - "elixir_homes": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_elixir~", - "rules_erlang", - "rules_erlang~" - ] - ] - } - }, - "@@rules_erlang~//bzlmod:extensions.bzl%erlang_config": { - "general": { - "bzlTransitiveDigest": "cKDB+SYgzLJKzBBfy42/kejTy+1rUzE3TYs1J4nJtWA=", - "usagesDigest": "abVIZcMsSBpDPBMfeEVv8jsSzdlF9LoTBTjP5QVwuBY=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "erlang_config": { - "bzlFile": "@@rules_erlang~//repositories:erlang_config.bzl", - "ruleClassName": "erlang_config", - "attributes": { - "rules_erlang_workspace": "@rules_erlang", - "types": {}, - "versions": {}, - "urls": {}, - "strip_prefixs": {}, - "sha256s": {}, - "erlang_homes": {}, - "pre_configure_cmdss": {}, - "extra_configure_optss": {}, - "post_configure_cmdss": {}, - "extra_make_optss": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_erlang~", - "bazel_skylib", - "bazel_skylib~" - ], - [ - "rules_erlang~", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, - "@@rules_go~//go:extensions.bzl%go_sdk": { - "general": { - "bzlTransitiveDigest": "EJ2jI5PPSo7sHmzcmLtJ0MyhdsySDOSbGoU59oYFq6g=", - "usagesDigest": "zKi6eOBEOZOxjpiMDmtTYD8ZESGY9dbIW0TNFNpFnYw=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "go_default_sdk": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.20.2" - } - }, - "go_host_compatible_sdk_label": { - "bzlFile": "@@rules_go~//go/private:extensions.bzl", - "ruleClassName": "host_compatible_toolchain", - "attributes": { - "toolchain": "@go_default_sdk//:ROOT" - } - }, - "go_toolchains": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_multiple_toolchains", - "attributes": { - "prefixes": [ - "_0000_go_default_sdk_" - ], - "geese": [ - "" - ], - "goarchs": [ - "" - ], - "sdk_repos": [ - "go_default_sdk" - ], - "sdk_types": [ - "remote" - ], - "sdk_versions": [ - "1.20.2" - ] - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_go~", - "bazel_tools", - "bazel_tools" - ] - ] - } - } - } -} diff --git a/examples/internal-elixir/.bazelrc b/examples/internal-elixir/.bazelrc index 84c8f9d..d74774a 100644 --- a/examples/internal-elixir/.bazelrc +++ b/examples/internal-elixir/.bazelrc @@ -1,15 +1,19 @@ build --registry=https://bcr.bazel.build/ -build --registry=https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/ # build --incompatible_strict_action_env -build --bes_results_url=https://app.buildbuddy.io/invocation/ -build --bes_backend=grpcs://remote.buildbuddy.io - +# Select the Erlang and Elixir this example builds from source rather than +# whatever the host carries. "ie" picks the internal toolchain on its own; the +# suffixed configs additionally pin a platform, which is what makes the major +# and major_minor toolchains distinguishable from each other. build:ie --host_platform=//:erlang_internal_platform -build:ie-26 --config=ie -build:ie-26 --platforms=//:erlang_linux_26_platform +build:ie-29 --config=ie +build:ie-29 --platforms=//:erlang_linux_29_platform +build:ie-29 --extra_execution_platforms=//:erlang_linux_29_platform + +build:ie-29_0 --config=ie +build:ie-29_0 --platforms=//:erlang_linux_29_0_platform +build:ie-29_0 --extra_execution_platforms=//:erlang_linux_29_0_platform -build:ie-26_2 --config=ie -build:ie-26_2 --platforms=//:erlang_linux_26_2_platform +try-import %workspace%/user.bazelrc diff --git a/examples/internal-elixir/BUILD.bazel b/examples/internal-elixir/BUILD.bazel index 2c151dc..344ac88 100644 --- a/examples/internal-elixir/BUILD.bazel +++ b/examples/internal-elixir/BUILD.bazel @@ -44,23 +44,23 @@ platform( "@erlang_config//:erlang_internal", "@elixir_config//:elixir_internal", ], - parents = ["@local_config_platform//:host"], + parents = ["@platforms//host:host"], ) platform( - name = "erlang_linux_26_platform", + name = "erlang_linux_29_platform", constraint_values = [ - "@erlang_config//:erlang_26", - "@elixir_config//:elixir_1_16", + "@erlang_config//:erlang_29", + "@elixir_config//:elixir_1_20", ], - parents = ["@local_config_platform//:host"], + parents = ["@platforms//host:host"], ) platform( - name = "erlang_linux_26_2_platform", + name = "erlang_linux_29_0_platform", constraint_values = [ - "@erlang_config//:erlang_26_2", - "@elixir_config//:elixir_1_16", + "@erlang_config//:erlang_29_0", + "@elixir_config//:elixir_1_20", ], - parents = ["@local_config_platform//:host"], + parents = ["@platforms//host:host"], ) diff --git a/examples/internal-elixir/MODULE.bazel b/examples/internal-elixir/MODULE.bazel index 9da0a8b..dd41d93 100644 --- a/examples/internal-elixir/MODULE.bazel +++ b/examples/internal-elixir/MODULE.bazel @@ -5,26 +5,43 @@ module( bazel_dep( name = "rules_erlang", - version = "3.16.0", + version = "3.18.0", ) bazel_dep( name = "rules_elixir", - version = "0.1.0", + version = "1.2.0", ) local_path_override( module_name = "rules_elixir", path = "../..", ) +# See the note in the root MODULE.bazel. This example is its own module, so it +# needs its own override; the one in the ruleset it depends on does not carry +# over. +git_override( + module_name = "rules_erlang", + remote = "https://github.com/bazelverse/rules_erlang.git", + commit = "5531a30ab87ed7e2a63eb1a901c4eeac1bb2bcc6", # 3.18.0 +) + +# The platforms below inherit from the host platform. That used to be +# @local_config_platform//:host, an autoconfigured repository Bazel 8 removed; +# the replacement is @platforms//host:host, which comes from this module. +bazel_dep( + name = "platforms", + version = "1.1.0", +) + erlang_config = use_extension( "@rules_erlang//bzlmod:extensions.bzl", "erlang_config", ) erlang_config.internal_erlang_from_github_release( - name = "26_2", + name = "29", extra_make_opts = ["-j 4"], - sha256 = "de155c4ad9baab2b9e6c96dbd03bf955575a04dd6feee9c08758beb28484c9f6", - version = "26.2.5", + sha256 = "86f6f40d4638852b0383235b02a70d8450184e441e83a06a108bf8e5bf1b2e04", + version = "29.0.5", ) use_repo( erlang_config, @@ -36,9 +53,9 @@ elixir_config = use_extension( "elixir_config", ) elixir_config.internal_elixir_from_github_release( - name = "1_16", - sha256 = "b9e845458e03d62a24325b8424069e401cc7468e21143ecbca5514724d7cbaa0", - version = "1.16.1", + name = "1_20", + sha256 = "ff22a894b130631443db1a193b4e8cb4762f697128566e43da848fd16c3777bd", + version = "1.20.3", ) use_repo( elixir_config, @@ -46,7 +63,7 @@ use_repo( ) register_toolchains( - "@erlang_config//26_2:toolchain_major", - "@erlang_config//26_2:toolchain_major_minor", - "@elixir_config//1_16:toolchain", + "@erlang_config//29:toolchain_major", + "@erlang_config//29:toolchain_major_minor", + "@elixir_config//1_20:toolchain", ) diff --git a/examples/internal-elixir/MODULE.bazel.lock b/examples/internal-elixir/MODULE.bazel.lock deleted file mode 100644 index b5d8625..0000000 --- a/examples/internal-elixir/MODULE.bazel.lock +++ /dev/null @@ -1,330 +0,0 @@ -{ - "lockFileVersion": 11, - "registryFileHashes": { - "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", - "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", - "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", - "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/source.json": "7e3a9adf473e9af076ae485ed649d5641ad50ec5c11718103f34de03170d94ad", - "https://bcr.bazel.build/modules/apple_support/1.5.0/MODULE.bazel": "50341a62efbc483e8a2a6aec30994a58749bd7b885e18dd96aa8c33031e558ef", - "https://bcr.bazel.build/modules/apple_support/1.5.0/source.json": "eb98a7627c0bc486b57f598ad8da50f6625d974c8f723e9ea71bd39f709c9862", - "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", - "https://bcr.bazel.build/modules/bazel_features/1.11.0/source.json": "c9320aa53cd1c441d24bd6b716da087ad7e4ff0d9742a9884587596edfe53015", - "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", - "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", - "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", - "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", - "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", - "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", - "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953", - "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", - "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", - "https://bcr.bazel.build/modules/gazelle/0.32.0/MODULE.bazel": "b499f58a5d0d3537f3cf5b76d8ada18242f64ec474d8391247438bf04f58c7b8", - "https://bcr.bazel.build/modules/gazelle/0.33.0/MODULE.bazel": "a13a0f279b462b784fb8dd52a4074526c4a2afe70e114c7d09066097a46b3350", - "https://bcr.bazel.build/modules/gazelle/0.33.0/source.json": "ddd6c264f75051b9dded4a256b96351f8464c73abc657c364bc0a0b7f5e32d9e", - "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", - "https://bcr.bazel.build/modules/googletest/1.11.0/source.json": "c73d9ef4268c91bd0c1cd88f1f9dfa08e814b1dbe89b5f594a9f08ba0244d206", - "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", - "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", - "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", - "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", - "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", - "https://bcr.bazel.build/modules/platforms/0.0.9/source.json": "cd74d854bf16a9e002fb2ca7b1a421f4403cda29f824a765acd3a8c56f8d43e6", - "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", - "https://bcr.bazel.build/modules/protobuf/21.7/source.json": "bbe500720421e582ff2d18b0802464205138c06056f443184de39fbb8187b09b", - "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", - "https://bcr.bazel.build/modules/protobuf/3.19.2/MODULE.bazel": "532ffe5f2186b69fdde039efe6df13ba726ff338c6bc82275ad433013fa10573", - "https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858", - "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", - "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", - "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", - "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", - "https://bcr.bazel.build/modules/rules_cc/0.0.9/source.json": "1f1ba6fea244b616de4a554a0f4983c91a9301640c8fe0dd1d410254115c8430", - "https://bcr.bazel.build/modules/rules_go/0.41.0/MODULE.bazel": "55861d8e8bb0e62cbd2896f60ff303f62ffcb0eddb74ecb0e5c0cbe36fc292c8", - "https://bcr.bazel.build/modules/rules_go/0.41.0/source.json": "a46e5f523176e3bd60b1c9cfdcb6c878b9cd14c21fe1a563c4ba0e6d0e7c4dd8", - "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", - "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", - "https://bcr.bazel.build/modules/rules_java/7.6.1/source.json": "8f3f3076554e1558e8e468b2232991c510ecbcbed9e6f8c06ac31c93bcf38362", - "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", - "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/source.json": "a075731e1b46bc8425098512d038d416e966ab19684a10a34f4741295642fc35", - "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", - "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", - "https://bcr.bazel.build/modules/rules_license/0.0.7/source.json": "355cc5737a0f294e560d52b1b7a6492d4fff2caf0bef1a315df5a298fca2d34a", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/source.json": "c2557066e0c0342223ba592510ad3d812d4963b9024831f7f66fd0584dd8c66c", - "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/source.json": "d57902c052424dfda0e71646cb12668d39c4620ee0544294d9d941e7d12bc3a9", - "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", - "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7", - "https://bcr.bazel.build/modules/rules_python/0.22.1/source.json": "57226905e783bae7c37c2dd662be078728e48fa28ee4324a7eabcafb5a43d014", - "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", - "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", - "https://bcr.bazel.build/modules/stardoc/0.5.1/source.json": "a96f95e02123320aa015b956f29c00cb818fa891ef823d55148e1a362caacf29", - "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", - "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/source.json": "f1ef7d3f9e0e26d4b23d1c39b5f5de71f584dd7d1b4ef83d9bbba6ec7a6a6459", - "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", - "https://bcr.bazel.build/modules/zlib/1.2.12/MODULE.bazel": "3b1a8834ada2a883674be8cbd36ede1b6ec481477ada359cd2d3ddc562340b27", - "https://bcr.bazel.build/modules/zlib/1.3/MODULE.bazel": "6a9c02f19a24dcedb05572b2381446e27c272cd383aed11d41d99da9e3167a72", - "https://bcr.bazel.build/modules/zlib/1.3/source.json": "b6b43d0737af846022636e6e255fd4a96fee0d34f08f3830e6e0bac51465c37c" - }, - "selectedYankedVersions": {}, - "moduleExtensions": { - "@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": { - "general": { - "bzlTransitiveDigest": "PjIds3feoYE8SGbbIq2SFTZy3zmxeO2tQevJZNDo7iY=", - "usagesDigest": "aLmqbvowmHkkBPve05yyDNGN7oh7QE9kBADr3QIZTZs=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "local_config_apple_cc": { - "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf", - "attributes": {} - }, - "local_config_apple_cc_toolchains": { - "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf_toolchains", - "attributes": {} - } - }, - "recordedRepoMappingEntries": [ - [ - "apple_support~", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, - "@@gazelle~//internal/bzlmod:non_module_deps.bzl%non_module_deps": { - "general": { - "bzlTransitiveDigest": "idtJXxcHUd75fcvggtK/s6naCFjcaysxF0U5OKBm2LE=", - "usagesDigest": "2GrCenk3V2jcu4jPJC70X5rsF4uSsnyO6PT3nq2PFls=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_gazelle_is_bazel_module": { - "bzlFile": "@@gazelle~//internal:is_bazel_module.bzl", - "ruleClassName": "is_bazel_module", - "attributes": { - "is_bazel_module": true - } - }, - "bazel_gazelle_go_repository_tools": { - "bzlFile": "@@gazelle~//internal:go_repository_tools.bzl", - "ruleClassName": "go_repository_tools", - "attributes": { - "go_cache": "@@gazelle~~non_module_deps~bazel_gazelle_go_repository_cache//:go.env" - } - }, - "bazel_gazelle_go_repository_cache": { - "bzlFile": "@@gazelle~//internal:go_repository_cache.bzl", - "ruleClassName": "go_repository_cache", - "attributes": { - "go_sdk_name": "@rules_go~~go_sdk~go_default_sdk", - "go_env": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "gazelle~", - "bazel_gazelle_go_repository_cache", - "gazelle~~non_module_deps~bazel_gazelle_go_repository_cache" - ], - [ - "gazelle~", - "go_host_compatible_sdk_label", - "rules_go~~go_sdk~go_host_compatible_sdk_label" - ], - [ - "rules_go~~go_sdk~go_host_compatible_sdk_label", - "go_default_sdk", - "rules_go~~go_sdk~go_default_sdk" - ] - ] - } - }, - "@@platforms//host:extension.bzl%host_platform": { - "general": { - "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", - "usagesDigest": "meSzxn3DUCcYEhq4HQwExWkWtU4EjriRBQLsZN+Q0SU=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "host_platform": { - "bzlFile": "@@platforms//host:extension.bzl", - "ruleClassName": "host_platform_repo", - "attributes": {} - } - }, - "recordedRepoMappingEntries": [] - } - }, - "@@rules_elixir~//bzlmod:extensions.bzl%elixir_config": { - "general": { - "bzlTransitiveDigest": "ohoT9jmBnvAHOfB4OsOb7JBw77WEicWKthjpKqEIdR4=", - "usagesDigest": "le660DoZ4a3PQVMFM57w/KjSRHz8B/txgzlbYaWDYaA=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "elixir_config": { - "bzlFile": "@@rules_elixir~//repositories:elixir_config.bzl", - "ruleClassName": "elixir_config", - "attributes": { - "types": { - "1_16": "internal" - }, - "versions": { - "1_16": "1.16.1" - }, - "urls": { - "1_16": "https://github.com/elixir-lang/elixir/archive/refs/tags/v1.16.1.tar.gz" - }, - "strip_prefixs": { - "1_16": "elixir-1.16.1" - }, - "sha256s": { - "1_16": "b9e845458e03d62a24325b8424069e401cc7468e21143ecbca5514724d7cbaa0" - }, - "elixir_homes": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_elixir~", - "rules_erlang", - "rules_erlang~" - ] - ] - } - }, - "@@rules_erlang~//bzlmod:extensions.bzl%erlang_config": { - "general": { - "bzlTransitiveDigest": "7tHl9Cz2V4l3W3ob5Pph0erZioQ6ibHzs0AhqNwcbbU=", - "usagesDigest": "XoALG0O9iYTkJ9NCHKX/+yXEGikZryNfKdh3rcvE0Yc=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "erlang_config": { - "bzlFile": "@@rules_erlang~//repositories:erlang_config.bzl", - "ruleClassName": "erlang_config", - "attributes": { - "rules_erlang_workspace": "@rules_erlang", - "types": { - "26_2": "internal" - }, - "versions": { - "26_2": "26.2.5" - }, - "urls": { - "26_2": "https://github.com/erlang/otp/releases/download/OTP-26.2.5/otp_src_26.2.5.tar.gz" - }, - "strip_prefixs": { - "26_2": "otp_src_26.2.5" - }, - "sha256s": { - "26_2": "de155c4ad9baab2b9e6c96dbd03bf955575a04dd6feee9c08758beb28484c9f6" - }, - "erlang_homes": {}, - "pre_configure_cmdss": { - "26_2": [] - }, - "extra_configure_optss": { - "26_2": [] - }, - "post_configure_cmdss": { - "26_2": [] - }, - "extra_make_optss": { - "26_2": [ - "-j 4" - ] - } - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_erlang~", - "bazel_skylib", - "bazel_skylib~" - ], - [ - "rules_erlang~", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, - "@@rules_go~//go:extensions.bzl%go_sdk": { - "general": { - "bzlTransitiveDigest": "EJ2jI5PPSo7sHmzcmLtJ0MyhdsySDOSbGoU59oYFq6g=", - "usagesDigest": "zKi6eOBEOZOxjpiMDmtTYD8ZESGY9dbIW0TNFNpFnYw=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "go_default_sdk": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.20.2" - } - }, - "go_host_compatible_sdk_label": { - "bzlFile": "@@rules_go~//go/private:extensions.bzl", - "ruleClassName": "host_compatible_toolchain", - "attributes": { - "toolchain": "@go_default_sdk//:ROOT" - } - }, - "go_toolchains": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_multiple_toolchains", - "attributes": { - "prefixes": [ - "_0000_go_default_sdk_" - ], - "geese": [ - "" - ], - "goarchs": [ - "" - ], - "sdk_repos": [ - "go_default_sdk" - ], - "sdk_types": [ - "remote" - ], - "sdk_versions": [ - "1.20.2" - ] - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_go~", - "bazel_tools", - "bazel_tools" - ] - ] - } - } - } -} diff --git a/mix_archive_build.bzl b/mix_archive_build.bzl new file mode 100644 index 0000000..b1ebf9f --- /dev/null +++ b/mix_archive_build.bzl @@ -0,0 +1,7 @@ +load( + "//private:mix_archive_build.bzl", + _mix_archive_build = "mix_archive_build", +) + +def mix_archive_build(**kwargs): + return _mix_archive_build(**kwargs) diff --git a/private/elixir_build.bzl b/private/elixir_build.bzl index 4efc1b4..40e8482 100644 --- a/private/elixir_build.bzl +++ b/private/elixir_build.bzl @@ -53,9 +53,11 @@ curl -L "{archive_url}" -o {archive_path} transitive = [runfiles.files], ) - strip_prefix = ctx.attr.strip_prefix - if strip_prefix != "": - strip_prefix += "\\/" + # See //third_party/rules_erlang/VENDORING.md, "portable tar extract" -- same bug, same fix. + # GNU tar's --transform does not exist in the bsdtar macOS ships. The Elixir source archive + # wraps everything in one top-level directory, so --strip-components=1 is equivalent and is + # supported by both tar implementations. + strip_components = "--strip-components=1" if ctx.attr.strip_prefix != "" else "" ctx.actions.run_shell( inputs = inputs, @@ -77,7 +79,7 @@ ABS_BUILD_DIR="$(mktemp -d)" ABS_RELEASE_DIR=$PWD/{release_path} tar --extract \\ - --transform 's/{strip_prefix}//' \\ + {strip_components} \\ --file {archive_path} \\ --directory $ABS_BUILD_DIR @@ -97,7 +99,7 @@ cp -r lib $ABS_RELEASE_DIR/ maybe_install_erlang = maybe_install_erlang(ctx), erlang_home = erlang_home, archive_path = downloaded_archive.path, - strip_prefix = strip_prefix, + strip_components = strip_components, release_path = release_dir.path, ), use_default_shell_env = True, diff --git a/private/elixir_bytecode.bzl b/private/elixir_bytecode.bzl index 39de08f..2359411 100644 --- a/private/elixir_bytecode.bzl +++ b/private/elixir_bytecode.bzl @@ -76,7 +76,12 @@ ${{ABS_ELIXIR_HOME}}/bin/elixirc \\ ) inputs = depset( - direct = ctx.files.srcs + erl_libs_files, + # ctx.files.data: Elixir modules routinely read files at COMPILE time -- + # @moduledoc File.read!("README.md") and @external_resource are both common in + # Hex packages (crux and sourceror in the Ash closure alone). Without a way to + # declare those, the file exists in the repository but never reaches the sandbox + # and compilation fails on a missing file. + direct = ctx.files.srcs + ctx.files.data + erl_libs_files, transitive = [ erlang_runfiles.files, elixir_runfiles.files, @@ -102,6 +107,7 @@ elixir_bytecode = rule( "srcs": attr.label_list( allow_files = [".ex"], ), + "data": attr.label_list(allow_files = True), "elixirc_opts": attr.string_list(), "env": attr.string_dict(), "deps": attr.label_list( diff --git a/private/ex_unit_test.bzl b/private/ex_unit_test.bzl index de90212..45f0597 100644 --- a/private/ex_unit_test.bzl +++ b/private/ex_unit_test.bzl @@ -25,10 +25,31 @@ def _package_relative_path(ctx, p): return p.removeprefix(ctx.label.package + "/") def _impl(ctx): + # TEST_TMPDIR, not TEST_UNDECLARED_OUTPUTS_DIR. + # + # This is scratch space: every srcs and data file is copied here so the test runs against + # a writable tree with the repo's directory layout. None of it is an OUTPUT. + # + # Upstream staged into TEST_UNDECLARED_OUTPUTS_DIR, which Bazel defines as "artifacts this + # test produced" and therefore walks when the test finishes -- stat + `file --mime-type` + # per entry to build TEST_UNDECLARED_OUTPUTS_MANIFEST, then uploads the lot. For + # //elixir/serviceradar_core that tree is config/**, priv/repo/** and the whole :srcs glob, + # so every Elixir test target was mime-typing and uploading a few thousand of its own + # INPUTS on every run. + # + # On the RBE executor, which carries no file(1), that also produced ~2,150 lines of + # test-setup.sh: line 331: file: command not found + # in each test log -- 2,197-line logs that were ~98% that one message. Non-fatal (Bazel's + # test-setup.sh has a `|| echo` fallback) but it buried the real output. + # + # Nothing was collected from there deliberately: the only file the script itself writes is + # test.log, and it `rm`s it after the pass/fail grep below. Switching to TEST_TMPDIR keeps + # the same layout and writability, and leaves undeclared outputs meaning what Bazel says it + # means -- whatever a test chooses to write there. copy_srcs_and_data_commands = [ 'mkdir -p $(dirname "{dst}") && cp "{src}" "{dst}"'.format( src = s.path, - dst = path_join("${TEST_UNDECLARED_OUTPUTS_DIR}", _package_relative_path(ctx, s.path)), + dst = path_join("${TEST_TMPDIR}", s.path), ) for s in ctx.files.srcs + ctx.files.data ] @@ -38,7 +59,7 @@ def _impl(ctx): erl_libs_files = erl_libs_contents( ctx, # target_info = None, - # headers = True, + headers = True, deps = flat_deps(ctx.attr.deps), ez_deps = ctx.files.ez_deps, dir = erl_libs_dir, @@ -74,7 +95,7 @@ export PATH="$ABS_ELIXIR_HOME"/bin:"{erlang_home}"/bin:${{PATH}} export ERL_LIBS="$TEST_SRCDIR/$TEST_WORKSPACE/{erl_libs_path}" -cd "${{TEST_UNDECLARED_OUTPUTS_DIR}}" +cd "${{TEST_TMPDIR}}/{package}" export HOME=${{PWD}} @@ -87,8 +108,28 @@ ${{ABS_ELIXIR_HOME}}/bin/elixir \\ {srcs_args} \\ | tee test.log set +x -tail -n 4 test.log | grep -E --silent "0 failure" -tail -n 4 test.log | grep -E --silent "[0-9] test" +# A failing suite makes elixir exit non-zero, and the `set -eo pipefail` above +# carries that through the tee, so the failure path needs no assertion of its +# own. The one thing an exit code cannot express is a suite that executed no +# tests at all: ExUnit reports that as success, which lets a target whose +# sources silently stopped matching any test pass forever. Assert against it. +# +# Running nothing is only a defect when nothing was *meant* to run. A target +# that filters by tag and excludes everything it has is doing what it was asked +# to, and is a normal way to shard a suite, so an exclusion count means the +# summary is honest and the target passes. +# +# Elixir 1.20 "Result: 0 tests" vs "Result: 0 tests, 2 excluded" +# earlier "0 tests, 0 failures" vs "0 tests, 0 failures (11 excluded)" +# +# Reading the summary text is only acceptable for this one condition; everything +# else defers to the exit code, which does not change between releases. +summary="$(tail -n 4 test.log)" +if printf '%s\n' "$summary" | grep -Eq "Result: 0 tests|(^|[^0-9])0 tests," && + ! printf '%s\n' "$summary" | grep -q "excluded"; then + echo "ex_unit_test: the suite executed no tests, and excluded none" >&2 + exit 1 +fi rm test.log """.format( maybe_install_erlang = maybe_install_erlang(ctx, short_path = True), @@ -96,6 +137,7 @@ rm test.log elixir_home = elixir_home, copy_srcs_and_data_commands = "\n".join(copy_srcs_and_data_commands), erl_libs_path = erl_libs_path, + package = package, env = env, setup = ctx.attr.setup, elixir_opts = " ".join([shell.quote(opt) for opt in ctx.attr.elixir_opts]), diff --git a/private/mix_archive_build.bzl b/private/mix_archive_build.bzl new file mode 100644 index 0000000..2c2ae31 --- /dev/null +++ b/private/mix_archive_build.bzl @@ -0,0 +1,201 @@ +"""Build a Mix archive (.ez) inside a single hermetic Bazel action. + +`mix archive.build` is how Mix packages a project for `mix archive.install`, +which is the only way to supply Mix with something it needs *before* it can +resolve a project -- Hex itself being the case that matters. Without Hex +installed as an archive, Mix aborts with "Could not find an SCM for dependency" +on any `{:dep, "~> x.y"}` entry, even one it would never compile. + +Why this exists +--------------- +`elixir_app` invokes `elixirc` directly from the execroot. That is fine for a +plain library, but a Hex package is a *Mix project*, and Mix guarantees two +things `elixirc` does not: + + * the working directory is the package root, so compile-time + `File.read!("README.md")` / `File.read!("lib/.../debugger.html.eex")` and + `@external_resource` resolve; + * `mix.exs` runs, so `elixirc_paths`, `:compilers`, and per-package compiler + options take effect. + +Packages that read files relative to the cwd at compile time (`sourceror`, +`plug`, and transitively `ash` / `spark` / `reactor`) cannot build without it. + +Dependencies are *not* fetched here. They arrive as Bazel-built `ErlangAppInfo` +deps, are staged into an ERL_LIBS tree, and are symlinked into +`_build/$MIX_ENV/lib` so `--no-deps-check` is satisfied without network access. + +Adapted from rabbitmq-server's `bazel/elixir/mix_archive_build.bzl` (MPL-2.0), +which solved this same problem for `rabbitmq_cli`'s Hex dependencies before the +project dropped Bazel in March 2025. +""" + +load("@bazel_skylib//lib:shell.bzl", "shell") +load( + "@rules_erlang//:erlang_app_info.bzl", + "ErlangAppInfo", + "flat_deps", +) +load("@rules_erlang//:util.bzl", "path_join") +load( + "@rules_erlang//private:util.bzl", + "additional_file_dest_relative_path", + "erl_libs_contents", +) +load( + ":elixir_toolchain.bzl", + "elixir_dirs", + "erlang_dirs", + "maybe_install_erlang", +) + +def _impl(ctx): + (erlang_home, _, erlang_runfiles) = erlang_dirs(ctx) + (elixir_home, elixir_runfiles) = elixir_dirs(ctx) + + out = ctx.actions.declare_file(ctx.attr.out.name) + + # Mix insists on writing into the project tree (_build, .mix). Give it a + # declared directory of its own rather than letting it scribble anywhere. + mix_invocation_dir = ctx.actions.declare_directory("{}_mix".format(ctx.label.name)) + + erl_libs_dir = ctx.label.name + "_deps" + + erl_libs_files = erl_libs_contents( + ctx, + target_info = None, + headers = True, + dir = erl_libs_dir, + deps = flat_deps(ctx.attr.deps), + ez_deps = ctx.files.ez_deps, + expand_ezs = True, + ) + + erl_libs_path = "" + if len(erl_libs_files) > 0: + erl_libs_path = path_join( + ctx.bin_dir.path, + ctx.label.workspace_root, + ctx.label.package, + erl_libs_dir, + ) + + copy_srcs_commands = [] + for src in ctx.attr.srcs: + for src_file in src[DefaultInfo].files.to_list(): + dest = additional_file_dest_relative_path(src.label, src_file) + copy_srcs_commands.extend([ + 'mkdir -p "$(dirname ${{MIX_INVOCATION_DIR}}/{dest})"'.format(dest = dest), + 'cp {flags}"{src}" "${{MIX_INVOCATION_DIR}}/{dest}"'.format( + flags = "-r " if src_file.is_directory else "", + src = src_file.path, + dest = dest, + ), + ]) + + script = """set -euo pipefail + +{maybe_install_erlang} + +if [ -n "{erl_libs_path}" ]; then + export ERL_LIBS=$PWD/{erl_libs_path} +fi + +if [[ "{elixir_home}" == /* ]]; then + ABS_ELIXIR_HOME="{elixir_home}" +else + ABS_ELIXIR_HOME=$PWD/{elixir_home} +fi + +ABS_OUT_PATH="$PWD/{out}" + +export PATH="$ABS_ELIXIR_HOME"/bin:"{erlang_home}"/bin:${{PATH}} + +export LANG="en_US.UTF-8" +export LC_ALL="en_US.UTF-8" + +MIX_INVOCATION_DIR="{mix_invocation_dir}" + +{copy_srcs_commands} + +ORIGINAL_DIR=$PWD +cd "${{MIX_INVOCATION_DIR}}" + +# HOME must live inside the sandbox: Mix writes ~/.mix and ~/.hex, and a stray +# write to the real home directory is exactly the non-hermeticity we are here +# to avoid. +export HOME="${{PWD}}" +export MIX_ENV={mix_env} +export ERL_COMPILER_OPTIONS=deterministic + +# Every dependency is already a Bazel input. If a package ever reaches for the +# network, fail here rather than succeed on a developer's machine and then fail +# on a network-isolated RBE executor. +export HEX_OFFLINE=1 + +for archive in {archives}; do + "${{ABS_ELIXIR_HOME}}"/bin/mix archive.install --force $ORIGINAL_DIR/$archive +done + +if [[ -n "{erl_libs_path}" ]]; then + mkdir -p _build/${{MIX_ENV}}/lib + for dep in "$ERL_LIBS"/*; do + ln -s $dep _build/${{MIX_ENV}}/lib + done +fi + +{setup} + +"${{ABS_ELIXIR_HOME}}"/bin/mix archive.build \\ + --no-deps-check \\ + -o "${{ABS_OUT_PATH}}" + +# The _build symlinks we just created point outside this directory, and Bazel +# rejects dangling symlinks in a declared output tree. +find . -type l -delete +""".format( + maybe_install_erlang = maybe_install_erlang(ctx), + erl_libs_path = erl_libs_path, + erlang_home = erlang_home, + elixir_home = elixir_home, + mix_invocation_dir = mix_invocation_dir.path, + copy_srcs_commands = "\n".join(copy_srcs_commands), + archives = " ".join([shell.quote(a.path) for a in ctx.files.archives]), + mix_env = ctx.attr.mix_env, + setup = ctx.attr.setup, + out = out.path, + ) + + inputs = depset( + direct = ctx.files.srcs, + transitive = [ + erlang_runfiles.files, + elixir_runfiles.files, + depset(ctx.files.archives), + depset(erl_libs_files), + ], + ) + + ctx.actions.run_shell( + inputs = inputs, + outputs = [out, mix_invocation_dir], + command = script, + mnemonic = "MIX", + progress_message = "Compiling Mix package %s" % ctx.label.name, + ) + + return [DefaultInfo(files = depset([out]))] + +mix_archive_build = rule( + implementation = _impl, + attrs = { + "srcs": attr.label_list(mandatory = True, allow_files = True), + "archives": attr.label_list(allow_files = [".ez"]), + "setup": attr.string(), + "mix_env": attr.string(default = "prod"), + "ez_deps": attr.label_list(allow_files = [".ez"]), + "deps": attr.label_list(providers = [ErlangAppInfo]), + "out": attr.output(), + }, + toolchains = ["//:toolchain_type"], +) diff --git a/repositories/elixir_config.bzl b/repositories/elixir_config.bzl index 29436eb..ab90341 100644 --- a/repositories/elixir_config.bzl +++ b/repositories/elixir_config.bzl @@ -38,6 +38,11 @@ def _impl(repository_ctx): elixir_home = repository_ctx.attr.elixir_homes.get(name, None), ) + # If we intentionally skipped probing a host-installed Elixir, still provide + # a default "external" entry so default toolchain registration succeeds. + if _DEFAULT_EXTERNAL_ELIXIR_PACKAGE_NAME not in elixir_installations and elixir_installations: + elixir_installations[_DEFAULT_EXTERNAL_ELIXIR_PACKAGE_NAME] = elixir_installations[list(elixir_installations.keys())[0]] + for (name, props) in elixir_installations.items(): if props.type == INSTALLATION_TYPE_EXTERNAL: repository_ctx.template( @@ -101,6 +106,7 @@ elixir_config = repository_rule( environ = [ ELIXIR_HOME_ENV_VAR, "PATH", + "RULES_ELIXIR_SKIP_SYSTEM", ], local = True, ) @@ -123,6 +129,10 @@ def _is_windows(repository_ctx): return repository_ctx.os.name.lower().find("windows") != -1 def _default_elixir_dict(repository_ctx): + # Allow consumers to opt out of discovering a host-installed Elixir + # when they want fully hermetic builds (e.g., remote execution or CI). + if repository_ctx.os.environ.get("RULES_ELIXIR_SKIP_SYSTEM") == "1": + return {} if _is_windows(repository_ctx): if ELIXIR_HOME_ENV_VAR in repository_ctx.os.environ: elixir_home = repository_ctx.os.environ[ELIXIR_HOME_ENV_VAR] @@ -194,7 +204,9 @@ constraint_value( """ - default_installation = elixir_installations[_DEFAULT_EXTERNAL_ELIXIR_PACKAGE_NAME] + # Prefer the first configured installation as the default instead of assuming + # a host system Elixir exists everywhere (e.g., on remote executors). + default_installation = elixir_installations.values()[0] build_file_content += """\ constraint_setting( diff --git a/test/.bazelrc b/test/.bazelrc index 1a46aeb..a836d06 100644 --- a/test/.bazelrc +++ b/test/.bazelrc @@ -1,4 +1,5 @@ build --registry=https://bcr.bazel.build/ -build --registry=https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/ build --incompatible_strict_action_env + +try-import %workspace%/user.bazelrc diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 3b2e408..caac24f 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -6,6 +6,7 @@ load( "ELIXIR_VARS_ENV_MAP_INTERNAL", ) load("@rules_erlang//:escript.bzl", "escript_archive") +load("@rules_shell//shell:sh_test.bzl", "sh_test") elixir_app( app_name = "basic", @@ -86,6 +87,11 @@ ex_unit_test( tags = ["manual"], ) +# Asserts that a failure in the elixir invocation itself, rather than in a test +# case, still fails the target. This used to pass "-e ExUnit.configure(seed: 0)" +# and rely on that raising because ExUnit had not been started yet; Elixir 1.20 +# accepts it, so the target stopped being broken and the assertion below stopped +# asserting anything. Raising outright breaks on every version. ex_unit_test( name = "broken_test", srcs = [ @@ -93,7 +99,7 @@ ex_unit_test( ], elixir_opts = [ "-e", - "ExUnit.configure(seed: 0)", + 'raise "intentionally broken"', ], env = { "ERL_COMPILER_OPTIONS": "deterministic", diff --git a/test/MODULE.bazel b/test/MODULE.bazel index 69313e9..ce85484 100644 --- a/test/MODULE.bazel +++ b/test/MODULE.bazel @@ -5,17 +5,32 @@ module( bazel_dep( name = "rules_erlang", - version = "3.16.0", + version = "3.18.0", ) bazel_dep( name = "rules_elixir", - version = "0.1.0", + version = "1.2.0", ) local_path_override( module_name = "rules_elixir", path = "..", ) +# sh_test stopped being a native rule in Bazel 8, so BUILD.bazel loads it from +# @rules_shell and this module has to depend on it directly. +bazel_dep( + name = "rules_shell", + version = "0.8.0", +) + +# See the note in the root MODULE.bazel. This is a separate module, so it needs +# its own override; the one in the ruleset it depends on does not carry over. +git_override( + module_name = "rules_erlang", + remote = "https://github.com/bazelverse/rules_erlang.git", + commit = "5531a30ab87ed7e2a63eb1a901c4eeac1bb2bcc6", # 3.18.0 +) + erlang_config = use_extension( "@rules_erlang//bzlmod:extensions.bzl", "erlang_config", diff --git a/test/MODULE.bazel.lock b/test/MODULE.bazel.lock deleted file mode 100644 index a1d07d9..0000000 --- a/test/MODULE.bazel.lock +++ /dev/null @@ -1,307 +0,0 @@ -{ - "lockFileVersion": 11, - "registryFileHashes": { - "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", - "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", - "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", - "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/source.json": "7e3a9adf473e9af076ae485ed649d5641ad50ec5c11718103f34de03170d94ad", - "https://bcr.bazel.build/modules/apple_support/1.5.0/MODULE.bazel": "50341a62efbc483e8a2a6aec30994a58749bd7b885e18dd96aa8c33031e558ef", - "https://bcr.bazel.build/modules/apple_support/1.5.0/source.json": "eb98a7627c0bc486b57f598ad8da50f6625d974c8f723e9ea71bd39f709c9862", - "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", - "https://bcr.bazel.build/modules/bazel_features/1.11.0/source.json": "c9320aa53cd1c441d24bd6b716da087ad7e4ff0d9742a9884587596edfe53015", - "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", - "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", - "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", - "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", - "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", - "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", - "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", - "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953", - "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", - "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", - "https://bcr.bazel.build/modules/gazelle/0.32.0/MODULE.bazel": "b499f58a5d0d3537f3cf5b76d8ada18242f64ec474d8391247438bf04f58c7b8", - "https://bcr.bazel.build/modules/gazelle/0.33.0/MODULE.bazel": "a13a0f279b462b784fb8dd52a4074526c4a2afe70e114c7d09066097a46b3350", - "https://bcr.bazel.build/modules/gazelle/0.33.0/source.json": "ddd6c264f75051b9dded4a256b96351f8464c73abc657c364bc0a0b7f5e32d9e", - "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", - "https://bcr.bazel.build/modules/googletest/1.11.0/source.json": "c73d9ef4268c91bd0c1cd88f1f9dfa08e814b1dbe89b5f594a9f08ba0244d206", - "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", - "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", - "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", - "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", - "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", - "https://bcr.bazel.build/modules/platforms/0.0.9/source.json": "cd74d854bf16a9e002fb2ca7b1a421f4403cda29f824a765acd3a8c56f8d43e6", - "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", - "https://bcr.bazel.build/modules/protobuf/21.7/source.json": "bbe500720421e582ff2d18b0802464205138c06056f443184de39fbb8187b09b", - "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", - "https://bcr.bazel.build/modules/protobuf/3.19.2/MODULE.bazel": "532ffe5f2186b69fdde039efe6df13ba726ff338c6bc82275ad433013fa10573", - "https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858", - "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", - "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", - "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", - "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", - "https://bcr.bazel.build/modules/rules_cc/0.0.9/source.json": "1f1ba6fea244b616de4a554a0f4983c91a9301640c8fe0dd1d410254115c8430", - "https://bcr.bazel.build/modules/rules_erlang/3.15.2/MODULE.bazel": "not found", - "https://bcr.bazel.build/modules/rules_erlang/3.15.3/MODULE.bazel": "not found", - "https://bcr.bazel.build/modules/rules_go/0.41.0/MODULE.bazel": "55861d8e8bb0e62cbd2896f60ff303f62ffcb0eddb74ecb0e5c0cbe36fc292c8", - "https://bcr.bazel.build/modules/rules_go/0.41.0/source.json": "a46e5f523176e3bd60b1c9cfdcb6c878b9cd14c21fe1a563c4ba0e6d0e7c4dd8", - "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", - "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", - "https://bcr.bazel.build/modules/rules_java/7.6.1/source.json": "8f3f3076554e1558e8e468b2232991c510ecbcbed9e6f8c06ac31c93bcf38362", - "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", - "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/source.json": "a075731e1b46bc8425098512d038d416e966ab19684a10a34f4741295642fc35", - "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", - "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", - "https://bcr.bazel.build/modules/rules_license/0.0.7/source.json": "355cc5737a0f294e560d52b1b7a6492d4fff2caf0bef1a315df5a298fca2d34a", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", - "https://bcr.bazel.build/modules/rules_pkg/0.7.0/source.json": "c2557066e0c0342223ba592510ad3d812d4963b9024831f7f66fd0584dd8c66c", - "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", - "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/source.json": "d57902c052424dfda0e71646cb12668d39c4620ee0544294d9d941e7d12bc3a9", - "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", - "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7", - "https://bcr.bazel.build/modules/rules_python/0.22.1/source.json": "57226905e783bae7c37c2dd662be078728e48fa28ee4324a7eabcafb5a43d014", - "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", - "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", - "https://bcr.bazel.build/modules/stardoc/0.5.1/source.json": "a96f95e02123320aa015b956f29c00cb818fa891ef823d55148e1a362caacf29", - "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", - "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/source.json": "f1ef7d3f9e0e26d4b23d1c39b5f5de71f584dd7d1b4ef83d9bbba6ec7a6a6459", - "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", - "https://bcr.bazel.build/modules/zlib/1.2.12/MODULE.bazel": "3b1a8834ada2a883674be8cbd36ede1b6ec481477ada359cd2d3ddc562340b27", - "https://bcr.bazel.build/modules/zlib/1.3/MODULE.bazel": "6a9c02f19a24dcedb05572b2381446e27c272cd383aed11d41d99da9e3167a72", - "https://bcr.bazel.build/modules/zlib/1.3/source.json": "b6b43d0737af846022636e6e255fd4a96fee0d34f08f3830e6e0bac51465c37c", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/modules/rules_erlang/3.15.2/MODULE.bazel": "75e0cadd4428a0f33b09632791491cdf35ff8cdd5b8e1af87bb9b3e18a459544", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/modules/rules_erlang/3.15.3/MODULE.bazel": "0d3c1351779355e23f87bbe3213125538930c3dd2aaad292b293867ea8ce60c0", - "https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/modules/rules_erlang/3.15.3/source.json": "8284c4ade6b9d517d611cd45affecce41bf75ee682d929f7048ec77d8765cacd" - }, - "selectedYankedVersions": {}, - "moduleExtensions": { - "@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": { - "general": { - "bzlTransitiveDigest": "PjIds3feoYE8SGbbIq2SFTZy3zmxeO2tQevJZNDo7iY=", - "usagesDigest": "aLmqbvowmHkkBPve05yyDNGN7oh7QE9kBADr3QIZTZs=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "local_config_apple_cc": { - "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf", - "attributes": {} - }, - "local_config_apple_cc_toolchains": { - "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf_toolchains", - "attributes": {} - } - }, - "recordedRepoMappingEntries": [ - [ - "apple_support~", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, - "@@gazelle~//internal/bzlmod:non_module_deps.bzl%non_module_deps": { - "general": { - "bzlTransitiveDigest": "idtJXxcHUd75fcvggtK/s6naCFjcaysxF0U5OKBm2LE=", - "usagesDigest": "2GrCenk3V2jcu4jPJC70X5rsF4uSsnyO6PT3nq2PFls=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "bazel_gazelle_is_bazel_module": { - "bzlFile": "@@gazelle~//internal:is_bazel_module.bzl", - "ruleClassName": "is_bazel_module", - "attributes": { - "is_bazel_module": true - } - }, - "bazel_gazelle_go_repository_tools": { - "bzlFile": "@@gazelle~//internal:go_repository_tools.bzl", - "ruleClassName": "go_repository_tools", - "attributes": { - "go_cache": "@@gazelle~~non_module_deps~bazel_gazelle_go_repository_cache//:go.env" - } - }, - "bazel_gazelle_go_repository_cache": { - "bzlFile": "@@gazelle~//internal:go_repository_cache.bzl", - "ruleClassName": "go_repository_cache", - "attributes": { - "go_sdk_name": "@rules_go~~go_sdk~go_default_sdk", - "go_env": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "gazelle~", - "bazel_gazelle_go_repository_cache", - "gazelle~~non_module_deps~bazel_gazelle_go_repository_cache" - ], - [ - "gazelle~", - "go_host_compatible_sdk_label", - "rules_go~~go_sdk~go_host_compatible_sdk_label" - ], - [ - "rules_go~~go_sdk~go_host_compatible_sdk_label", - "go_default_sdk", - "rules_go~~go_sdk~go_default_sdk" - ] - ] - } - }, - "@@platforms//host:extension.bzl%host_platform": { - "general": { - "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", - "usagesDigest": "meSzxn3DUCcYEhq4HQwExWkWtU4EjriRBQLsZN+Q0SU=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "host_platform": { - "bzlFile": "@@platforms//host:extension.bzl", - "ruleClassName": "host_platform_repo", - "attributes": {} - } - }, - "recordedRepoMappingEntries": [] - } - }, - "@@rules_elixir~//bzlmod:extensions.bzl%elixir_config": { - "general": { - "bzlTransitiveDigest": "ohoT9jmBnvAHOfB4OsOb7JBw77WEicWKthjpKqEIdR4=", - "usagesDigest": "n9hACALQcGm8q2Vf2sOncqVPCK7MbnFBUwOlGbEuffo=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "elixir_config": { - "bzlFile": "@@rules_elixir~//repositories:elixir_config.bzl", - "ruleClassName": "elixir_config", - "attributes": { - "types": {}, - "versions": {}, - "urls": {}, - "strip_prefixs": {}, - "sha256s": {}, - "elixir_homes": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_elixir~", - "rules_erlang", - "rules_erlang~" - ] - ] - } - }, - "@@rules_erlang~//bzlmod:extensions.bzl%erlang_config": { - "general": { - "bzlTransitiveDigest": "cKDB+SYgzLJKzBBfy42/kejTy+1rUzE3TYs1J4nJtWA=", - "usagesDigest": "yttnw5O1MlRtwM/DwgYffrCZtwSmSw0fr51ZryLuH3c=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "erlang_config": { - "bzlFile": "@@rules_erlang~//repositories:erlang_config.bzl", - "ruleClassName": "erlang_config", - "attributes": { - "rules_erlang_workspace": "@rules_erlang", - "types": {}, - "versions": {}, - "urls": {}, - "strip_prefixs": {}, - "sha256s": {}, - "erlang_homes": {}, - "pre_configure_cmdss": {}, - "extra_configure_optss": {}, - "post_configure_cmdss": {}, - "extra_make_optss": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_erlang~", - "bazel_skylib", - "bazel_skylib~" - ], - [ - "rules_erlang~", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, - "@@rules_go~//go:extensions.bzl%go_sdk": { - "general": { - "bzlTransitiveDigest": "EJ2jI5PPSo7sHmzcmLtJ0MyhdsySDOSbGoU59oYFq6g=", - "usagesDigest": "zKi6eOBEOZOxjpiMDmtTYD8ZESGY9dbIW0TNFNpFnYw=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "go_default_sdk": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_download_sdk_rule", - "attributes": { - "goos": "", - "goarch": "", - "sdks": {}, - "urls": [ - "https://dl.google.com/go/{}" - ], - "version": "1.20.2" - } - }, - "go_host_compatible_sdk_label": { - "bzlFile": "@@rules_go~//go/private:extensions.bzl", - "ruleClassName": "host_compatible_toolchain", - "attributes": { - "toolchain": "@go_default_sdk//:ROOT" - } - }, - "go_toolchains": { - "bzlFile": "@@rules_go~//go/private:sdk.bzl", - "ruleClassName": "go_multiple_toolchains", - "attributes": { - "prefixes": [ - "_0000_go_default_sdk_" - ], - "geese": [ - "" - ], - "goarchs": [ - "" - ], - "sdk_repos": [ - "go_default_sdk" - ], - "sdk_types": [ - "remote" - ], - "sdk_versions": [ - "1.20.2" - ] - } - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_go~", - "bazel_tools", - "bazel_tools" - ] - ] - } - } - } -}