diff --git a/.bcr/extensions/bindgen/presubmit.yml b/.bcr/extensions/bindgen/presubmit.yml index f75d2a8d5b..3c7cd615dd 100644 --- a/.bcr/extensions/bindgen/presubmit.yml +++ b/.bcr/extensions/bindgen/presubmit.yml @@ -1,5 +1,5 @@ bcr_test_module: - module_path: "" + module_path: "extensions/bindgen" matrix: platform: ["macos_arm64", "ubuntu2004", "windows"] bazel: ["7.x"] @@ -8,8 +8,5 @@ bcr_test_module: name: "Run test module" platform: ${{ platform }} bazel: ${{ bazel }} - # Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile. - shell_commands: - - "rm MODULE.bazel.lock || true" test_targets: - "//..." diff --git a/.bcr/extensions/bindgen/source.template.json b/.bcr/extensions/bindgen/source.template.json index fb8122f56c..93cec922d3 100644 --- a/.bcr/extensions/bindgen/source.template.json +++ b/.bcr/extensions/bindgen/source.template.json @@ -1,5 +1,5 @@ { "integrity": "**leave this alone**", - "strip_prefix": "", - "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_bindgen-{VERSION}.tar.gz" + "strip_prefix": "extensions/bindgen", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz" } diff --git a/.bcr/extensions/prost/presubmit.yml b/.bcr/extensions/prost/presubmit.yml index f75d2a8d5b..d77338a95c 100644 --- a/.bcr/extensions/prost/presubmit.yml +++ b/.bcr/extensions/prost/presubmit.yml @@ -1,5 +1,5 @@ bcr_test_module: - module_path: "" + module_path: "extensions/prost" matrix: platform: ["macos_arm64", "ubuntu2004", "windows"] bazel: ["7.x"] @@ -8,8 +8,5 @@ bcr_test_module: name: "Run test module" platform: ${{ platform }} bazel: ${{ bazel }} - # Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile. - shell_commands: - - "rm MODULE.bazel.lock || true" test_targets: - "//..." diff --git a/.bcr/extensions/prost/source.template.json b/.bcr/extensions/prost/source.template.json index b3e646bd51..93a2efed88 100644 --- a/.bcr/extensions/prost/source.template.json +++ b/.bcr/extensions/prost/source.template.json @@ -1,5 +1,5 @@ { "integrity": "**leave this alone**", - "strip_prefix": "", - "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_prost-{VERSION}.tar.gz" + "strip_prefix": "extensions/prost", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz" } diff --git a/.bcr/extensions/protobuf/presubmit.yml b/.bcr/extensions/protobuf/presubmit.yml index f75d2a8d5b..77025299a2 100644 --- a/.bcr/extensions/protobuf/presubmit.yml +++ b/.bcr/extensions/protobuf/presubmit.yml @@ -1,5 +1,5 @@ bcr_test_module: - module_path: "" + module_path: "extensions/protobuf" matrix: platform: ["macos_arm64", "ubuntu2004", "windows"] bazel: ["7.x"] @@ -8,8 +8,5 @@ bcr_test_module: name: "Run test module" platform: ${{ platform }} bazel: ${{ bazel }} - # Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile. - shell_commands: - - "rm MODULE.bazel.lock || true" test_targets: - "//..." diff --git a/.bcr/extensions/protobuf/source.template.json b/.bcr/extensions/protobuf/source.template.json index bd27f36fb2..fdf72fe26e 100644 --- a/.bcr/extensions/protobuf/source.template.json +++ b/.bcr/extensions/protobuf/source.template.json @@ -1,5 +1,5 @@ { "integrity": "**leave this alone**", - "strip_prefix": "", - "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_protobuf-{VERSION}.tar.gz" + "strip_prefix": "extensions/protobuf", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz" } diff --git a/.bcr/extensions/wasm_bindgen/presubmit.yml b/.bcr/extensions/wasm_bindgen/presubmit.yml index f75d2a8d5b..57eeffc99f 100644 --- a/.bcr/extensions/wasm_bindgen/presubmit.yml +++ b/.bcr/extensions/wasm_bindgen/presubmit.yml @@ -1,5 +1,5 @@ bcr_test_module: - module_path: "" + module_path: "extensions/wasm_bindgen" matrix: platform: ["macos_arm64", "ubuntu2004", "windows"] bazel: ["7.x"] @@ -8,8 +8,5 @@ bcr_test_module: name: "Run test module" platform: ${{ platform }} bazel: ${{ bazel }} - # Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile. - shell_commands: - - "rm MODULE.bazel.lock || true" test_targets: - "//..." diff --git a/.bcr/extensions/wasm_bindgen/source.template.json b/.bcr/extensions/wasm_bindgen/source.template.json index 2db11d4d24..8799aac405 100644 --- a/.bcr/extensions/wasm_bindgen/source.template.json +++ b/.bcr/extensions/wasm_bindgen/source.template.json @@ -1,5 +1,5 @@ { "integrity": "**leave this alone**", - "strip_prefix": "", - "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_wasm_bindgen-{VERSION}.tar.gz" + "strip_prefix": "extensions/wasm_bindgen", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz" } diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index 607dc818c4..dc99e58d19 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -9,8 +9,8 @@ bcr_test_module: name: "Run test module" platform: ${{ platform }} bazel: ${{ bazel }} - # Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile. shell_commands: + # Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile. - "rm MODULE.bazel.lock || true" run_targets: - "//third-party-in-workspace:vendor" @@ -28,8 +28,8 @@ bcr_test_module_windows: name: "Run test module" platform: windows bazel: ${{ bazel }} - # Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile. shell_commands: + # Remove the lockfile because we generate on Bazel 7, but test on Bazel 6 which may not be able to parse a future-generated lockfile. - "rm MODULE.bazel.lock || true" run_targets: - "//third-party-in-workspace:vendor" diff --git a/.github/release_notes.template b/.github/release_notes.template index 364d850030..f212f809e3 100644 --- a/.github/release_notes.template +++ b/.github/release_notes.template @@ -37,8 +37,9 @@ bazel_dep(name = "rules_rust_bindgen", version = "{version}") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_rust_bindgen", - integrity = "sha256-{ext_bindgen_sha256_base64}", - urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_bindgen-{version}.tar.gz"], + integrity = "sha256-{sha256_base64}", + strip_prefix = "extensions/bindgen", + urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"], ) ``` @@ -60,8 +61,9 @@ bazel_dep(name = "rules_rust_prost", version = "{version}") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_rust_prost", - integrity = "sha256-{ext_prost_sha256_base64}", - urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_prost-{version}.tar.gz"], + integrity = "sha256-{sha256_base64}", + strip_prefix = "extensions/prost", + urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"], ) ``` @@ -83,8 +85,9 @@ bazel_dep(name = "rules_rust_protobuf", version = "{version}") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_rust_protobuf", - integrity = "sha256-{ext_protobuf_sha256_base64}", - urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_protobuf-{version}.tar.gz"], + integrity = "sha256-{sha256_base64}", + strip_prefix = "extensions/protobuf", + urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"], ) ``` @@ -106,8 +109,9 @@ bazel_dep(name = "rules_rust_wasm_bindgen", version = "{version}") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_rust_wasm_bindgen", - integrity = "sha256-{ext_wasm_bindgen_sha256_base64}", - urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_wasm_bindgen-{version}.tar.gz"], + integrity = "sha256-{sha256_base64}", + strip_prefix = "extensions/wasm_bindgen", + urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"], ) ``` diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 133745c0a7..8b713e73d6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -140,97 +140,21 @@ jobs: --exclude=".git" \ --exclude=".github" \ --exclude="crate_universe/target" \ - --exclude="extensions" \ examples/bzlmod \ --exclude="examples" \ . - # Save the sha256 checksum of the distro archive to the environment - sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)" - echo "ARCHIVE_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV - env: - CARGO_BAZEL_GENERATOR_URL: file://${{ github.workspace }}/crate_universe/target/artifacts/x86_64-unknown-linux-gnu/cargo-bazel - ARTIFACTS_DIR: ${{ github.workspace }}/crate_universe/target/artifacts - URL_PREFIX: https://github.com/${{ github.repository_owner }}/rules_rust/releases/download/${{ env.RELEASE_VERSION }} - - name: Create the rules extensions archive for Bindgen - run: | - # Build an archive of the repo contents. - tar -czf ${{ github.workspace }}/.github/rules_rust_bindgen.tar.gz \ - -C ${{ github.workspace }}/extensions/bindgen \ - --exclude="examples" \ - . - - # Save the sha256 checksum of the distro archive to the environment - sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_bindgen.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)" - echo "ARCHIVE_EXT_BINDGEN_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV - - name: Create the rules extensions archive for Prost - run: | - # Build an archive of the repo contents. - tar -czf ${{ github.workspace }}/.github/rules_rust_prost.tar.gz \ - -C ${{ github.workspace }}/extensions/prost \ - --exclude="examples" \ - . - - # Save the sha256 checksum of the distro archive to the environment - sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_prost.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)" - echo "ARCHIVE_EXT_PROST_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV - - name: Create the rules extensions archive for Protobuf - run: | - # Build an archive of the repo contents. - tar -czf ${{ github.workspace }}/.github/rules_rust_protobuf.tar.gz \ - -C ${{ github.workspace }}/extensions/protobuf \ - --exclude="examples" \ - . - - # Save the sha256 checksum of the distro archive to the environment - sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_protobuf.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)" - echo "ARCHIVE_EXT_PROTOBUF_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV - - name: Create the rules extensions archive for wasm-bindgen - run: | - # Build an archive of the repo contents. - tar -czf ${{ github.workspace }}/.github/rules_rust_wasm_bindgen.tar.gz \ - -C ${{ github.workspace }}/extensions/wasm_bindgen \ - --exclude="examples" \ - . - - # Save the sha256 checksum of the distro archive to the environment - sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_wasm_bindgen.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)" - echo "ARCHIVE_EXT_WASM_BINDGEN_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV # Upload the artifact in case creating a release fails so all artifacts can then be manually recovered. - uses: actions/upload-artifact@v3 with: name: "rules_rust.tar.gz" path: ${{ github.workspace }}/.github/rules_rust.tar.gz if-no-files-found: error - - uses: actions/upload-artifact@v3 - with: - name: "rules_rust_bindgen.tar.gz" - path: ${{ github.workspace }}/.github/rules_rust_bindgen.tar.gz - if-no-files-found: error - - uses: actions/upload-artifact@v3 - with: - name: "rules_rust_prost.tar.gz" - path: ${{ github.workspace }}/.github/rules_rust_prost.tar.gz - if-no-files-found: error - - uses: actions/upload-artifact@v3 - with: - name: "rules_rust_protobuf.tar.gz" - path: ${{ github.workspace }}/.github/rules_rust_protobuf.tar.gz - if-no-files-found: error - - uses: actions/upload-artifact@v3 - with: - name: "rules_rust_wasm_bindgen.tar.gz" - path: ${{ github.workspace }}/.github/rules_rust_wasm_bindgen.tar.gz - if-no-files-found: error - name: Generate release notes run: | # Generate the release notes sed 's#{version}#${{ env.RELEASE_VERSION }}#g' ${{ github.workspace }}/.github/release_notes.template \ | sed 's#{sha256_base64}#${{ env.ARCHIVE_SHA256_BASE64 }}#g' \ - | sed 's#{ext_bindgen_sha256_base64}#${{ env.ARCHIVE_EXT_BINDGEN_SHA256_BASE64 }}#g' \ - | sed 's#{ext_prost_sha256_base64}#${{ env.ARCHIVE_EXT_PROST_SHA256_BASE64 }}#g' \ - | sed 's#{ext_protobuf_sha256_base64}#${{ env.ARCHIVE_EXT_PROTOBUF_SHA256_BASE64 }}#g' \ - | sed 's#{ext_wasm_bindgen_sha256_base64}#${{ env.ARCHIVE_EXT_WASM_BINDGEN_SHA256_BASE64 }}#g' \ > ${{ github.workspace }}/.github/release_notes.txt - name: Create release uses: softprops/action-gh-release@v1 @@ -253,43 +177,6 @@ jobs: asset_path: ${{ github.workspace }}/.github/rules_rust.tar.gz asset_content_type: application/gzip - - name: "Upload the bindgen extension archive" - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.rules_rust_release.outputs.upload_url }} - asset_name: rules_rust_bindgen-${{ env.RELEASE_VERSION }}.tar.gz - asset_path: ${{ github.workspace }}/.github/rules_rust_bindgen.tar.gz - asset_content_type: application/gzip - - name: "Upload the prost extension archive" - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.rules_rust_release.outputs.upload_url }} - asset_name: rules_rust_prost-${{ env.RELEASE_VERSION }}.tar.gz - asset_path: ${{ github.workspace }}/.github/rules_rust_prost.tar.gz - asset_content_type: application/gzip - - name: "Upload the protobuf extension archive" - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.rules_rust_release.outputs.upload_url }} - asset_name: rules_rust_protobuf-${{ env.RELEASE_VERSION }}.tar.gz - asset_path: ${{ github.workspace }}/.github/rules_rust_protobuf.tar.gz - asset_content_type: application/gzip - - name: "Upload the wasm_bindgen extension archive" - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.rules_rust_release.outputs.upload_url }} - asset_name: rules_rust_wasm_bindgen-${{ env.RELEASE_VERSION }}.tar.gz - asset_path: ${{ github.workspace }}/.github/rules_rust_wasm_bindgen.tar.gz - asset_content_type: application/gzip - # There must be a upload action for each platform triple we create - name: "Upload aarch64-apple-darwin" uses: actions/upload-release-asset@v1 diff --git a/extensions/bindgen/.bazelrc b/extensions/bindgen/.bazelrc index f3e5a5d06f..2a2b4f43fc 100644 --- a/extensions/bindgen/.bazelrc +++ b/extensions/bindgen/.bazelrc @@ -66,6 +66,10 @@ common:no-bzlmod --noenable_bzlmod --enable_workspace # Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock common --lockfile_mode=off +# Allow bazel configuration flags to locate the core rules to avoid adding local +# override paths to the `MODULE.bazel` file and breaking downstream consumers. +common --override_module=rules_rust=../../ + ############################################################################### ## Custom user flags ## diff --git a/extensions/bindgen/MODULE.bazel b/extensions/bindgen/MODULE.bazel index e36386fddd..5663328ffb 100644 --- a/extensions/bindgen/MODULE.bazel +++ b/extensions/bindgen/MODULE.bazel @@ -9,11 +9,6 @@ bazel_dep( name = "rules_rust", version = "0.55.4", ) -local_path_override( - module_name = "rules_rust", - path = "../..", -) - bazel_dep( name = "bazel_skylib", version = "1.7.1", diff --git a/extensions/prost/.bazelrc b/extensions/prost/.bazelrc index f3e5a5d06f..2a2b4f43fc 100644 --- a/extensions/prost/.bazelrc +++ b/extensions/prost/.bazelrc @@ -66,6 +66,10 @@ common:no-bzlmod --noenable_bzlmod --enable_workspace # Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock common --lockfile_mode=off +# Allow bazel configuration flags to locate the core rules to avoid adding local +# override paths to the `MODULE.bazel` file and breaking downstream consumers. +common --override_module=rules_rust=../../ + ############################################################################### ## Custom user flags ## diff --git a/extensions/prost/MODULE.bazel b/extensions/prost/MODULE.bazel index 2781da6ecf..9599a4fc86 100644 --- a/extensions/prost/MODULE.bazel +++ b/extensions/prost/MODULE.bazel @@ -9,11 +9,6 @@ bazel_dep( name = "rules_rust", version = "0.55.4", ) -local_path_override( - module_name = "rules_rust", - path = "../..", -) - bazel_dep( name = "platforms", version = "0.0.10", diff --git a/extensions/protobuf/.bazelrc b/extensions/protobuf/.bazelrc index b29663d9c4..79ec2cc529 100644 --- a/extensions/protobuf/.bazelrc +++ b/extensions/protobuf/.bazelrc @@ -70,6 +70,10 @@ common:no-bzlmod --noenable_bzlmod --enable_workspace # Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock common --lockfile_mode=off +# Allow bazel configuration flags to locate the core rules to avoid adding local +# override paths to the `MODULE.bazel` file and breaking downstream consumers. +common --override_module=rules_rust=../../ + ############################################################################### ## Custom user flags ## diff --git a/extensions/protobuf/MODULE.bazel b/extensions/protobuf/MODULE.bazel index 0bc58eabcc..c0cb1efcae 100644 --- a/extensions/protobuf/MODULE.bazel +++ b/extensions/protobuf/MODULE.bazel @@ -9,11 +9,6 @@ bazel_dep( name = "rules_rust", version = "0.55.4", ) -local_path_override( - module_name = "rules_rust", - path = "../..", -) - bazel_dep( name = "bazel_skylib", version = "1.7.1", diff --git a/extensions/wasm_bindgen/.bazelrc b/extensions/wasm_bindgen/.bazelrc index f3e5a5d06f..2a2b4f43fc 100644 --- a/extensions/wasm_bindgen/.bazelrc +++ b/extensions/wasm_bindgen/.bazelrc @@ -66,6 +66,10 @@ common:no-bzlmod --noenable_bzlmod --enable_workspace # Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock common --lockfile_mode=off +# Allow bazel configuration flags to locate the core rules to avoid adding local +# override paths to the `MODULE.bazel` file and breaking downstream consumers. +common --override_module=rules_rust=../../ + ############################################################################### ## Custom user flags ## diff --git a/extensions/wasm_bindgen/MODULE.bazel b/extensions/wasm_bindgen/MODULE.bazel index cae6eaeaab..9727c916bd 100644 --- a/extensions/wasm_bindgen/MODULE.bazel +++ b/extensions/wasm_bindgen/MODULE.bazel @@ -9,11 +9,6 @@ bazel_dep( name = "rules_rust", version = "0.55.4", ) -local_path_override( - module_name = "rules_rust", - path = "../..", -) - bazel_dep( name = "bazel_skylib", version = "1.7.1",