Skip to content

Commit

Permalink
Updated entire repository to account for creation of rules_rust_ext.
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Nov 19, 2024
1 parent 06937bc commit dccec44
Show file tree
Hide file tree
Showing 331 changed files with 2,067 additions and 2,300 deletions.
90 changes: 80 additions & 10 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ default_macos_targets: &default_macos_targets
default_windows_targets: &default_windows_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
- "-//test/proto/..."
- "-//test/unit/pipelined_compilation/..."
default_windows_no_runfiles_targets: &default_windows_no_runfiles_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
Expand All @@ -43,7 +42,6 @@ default_windows_no_runfiles_targets: &default_windows_no_runfiles_targets
- "-//crate_universe/..."
- "-//test/chained_direct_deps:mod3_doc_test"
- "-//test/out_dir_in_tests:demo_lib_doc_test"
- "-//test/proto/..."
- "-//test/rustc_env_files:output_test"
- "-//test/test_env_launcher:test"
- "-//test/test_env:test_manifest_dir"
Expand Down Expand Up @@ -238,12 +236,9 @@ tasks:
build_flags:
- "--enable_bzlmod"
build_targets:
- "//bindgen/3rdparty:bindgen"
- "//crate_universe:cargo_bazel_bin"
- "//proto/prost/private:prost_runtime"
- "//tools/runfiles"
- "//util/import"
- "//wasm_bindgen/3rdparty:wasm_bindgen"
ubuntu2004_clang:
name: With Clang
platform: ubuntu2004
Expand Down Expand Up @@ -474,11 +469,6 @@ tasks:
windows_targets: &windows_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "//..."
# The proto rules do not work on windows
- "-//proto/..."
# The bindgen rules are currently broken on windows
# https://github.com/bazelbuild/rules_rust/issues/2009
- "-//bindgen/..."
build_targets: *windows_targets
test_targets: *windows_targets
crate_universe_examples_ubuntu2004:
Expand Down Expand Up @@ -884,6 +874,86 @@ tasks:
- "--compile_one_dependency"
build_targets:
- "tools/rust_analyzer/main.rs"
extensions_linux:
name: Extensions
platform: ubuntu2004
working_directory: extensions
build_targets:
- "//..."
test_targets:
- "//..."
coverage_targets:
- "//..."
extensions_macos:
name: Extensions
platform: macos_arm64
working_directory: extensions
build_targets:
- "//..."
test_targets:
- "//..."
coverage_targets:
- "//..."
extensions_windows:
name: Extensions
platform: windows
working_directory: extensions
build_targets:
- "//..."
test_targets:
- "//..."
coverage_targets:
- "//..."
extensions_linux_rbe:
name: Extensions
platform: rbe_ubuntu2004
working_directory: extensions
build_targets:
- "//..."
test_targets:
- "//..."
coverage_targets:
- "//..."
extensions_examples_linux:
name: Extensions
platform: ubuntu2004
working_directory: extensions/examples
build_targets:
- "//..."
test_targets:
- "//..."
coverage_targets:
- "//..."
extensions_examples_macos:
name: Extensions
platform: macos_arm64
working_directory: extensions/examples
build_targets:
- "//..."
test_targets:
- "//..."
coverage_targets:
- "//..."
extensions_examples_windows:
name: Extensions
platform: windows
working_directory: extensions/examples
build_targets:
- "//..."
test_targets:
- "//..."
coverage_targets:
- "//..."
extensions_examples_linux_rbe:
name: Extensions
platform: rbe_ubuntu2004
working_directory: extensions/examples
build_targets:
- "//..."
test_targets:
- "//..."
coverage_targets:
- "//..."

buildifier:
version: latest
Expand Down
5 changes: 3 additions & 2 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.direnv
bzlmod
crate_universe/private/bootstrap
docs
examples
crate_universe/private/bootstrap
extensions
test/aliased_toolchains
test/bzlmod_repo_mapping
test/cc_common_link
test/no_std
.direnv
2 changes: 1 addition & 1 deletion .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-v{VERSION}.tar.gz"
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz"
}
12 changes: 6 additions & 6 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
**/*Cargo.Bazel.lock linguist-generated
**/cargo-bazel-lock.json linguist-generated
bindgen/3rdparty/crates/** linguist-generated
crate_universe/3rdparty/crates/** linguist-generated
crate_universe/test_data/metadata/*/metadata.json linguist-generated
examples/bzlmod/hello_world/third-party/crates/** linguist-generated
examples/crate_universe_unnamed/vendor_remote_manifests/crates/** linguist-generated
examples/crate_universe_unnamed/vendor_remote_pkgs/crates/** linguist-generated
examples/crate_universe/vendor_external/crates/** linguist-generated
examples/crate_universe/vendor_local_manifests/crates/** linguist-generated
examples/crate_universe/vendor_local_pkgs/crates/** linguist-generated
examples/crate_universe/vendor_remote_manifests/crates/** linguist-generated
examples/crate_universe/vendor_remote_pkgs/crates/** linguist-generated
examples/crate_universe_unnamed/vendor_remote_manifests/crates/** linguist-generated
examples/crate_universe_unnamed/vendor_remote_pkgs/crates/** linguist-generated
examples/sys/basic/3rdparty/crates/** linguist-generated
examples/sys/complex/3rdparty/crates/** linguist-generated
proto/prost/private/3rdparty/crates/** linguist-generated
proto/protobuf/3rdparty/crates/** linguist-generated
extensions/bindgen/3rdparty/crates/** linguist-generated
extensions/prost/private/3rdparty/crates/** linguist-generated
extensions/proto/protobuf/3rdparty/crates/** linguist-generated
extensions/wasm_bindgen/3rdparty/crates/** linguist-generated
tools/rust_analyzer/3rdparty/crates/** linguist-generated
util/import/3rdparty/crates/** linguist-generated
wasm_bindgen/3rdparty/crates/** linguist-generated
23 changes: 21 additions & 2 deletions .github/release_notes.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# {version}

Additional documentation can be found at: https://bazelbuild.github.io/rules_rust/#setup

## Bzlmod

```python
Expand All @@ -13,8 +15,25 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_rust",
integrity = "sha256-{sha256_base64}",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-v{version}.tar.gz"],
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust-{version}.tar.gz"],
)
```

Additional documentation can be found at: https://bazelbuild.github.io/rules_rust/#setup
## extensions

### Bzlmod

```python
bazel_dep(name = "rules_rust_ext", version = "{version}")
```

### WORKSPACE

```python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_rust",
integrity = "sha256-{ext_sha256_base64}",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_ext-{version}.tar.gz"],
)
```
44 changes: 41 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,29 +128,57 @@ jobs:
- name: Create the rules archive
run: |
# Update urls and sha256 values
bazel ${BAZEL_STARTUP_FLAGS[@]} run //crate_universe/tools/urls_generator -- --artifacts-dir="${ARTIFACTS_DIR}" --url-prefix="${URL_PREFIX}"
bazel ${BAZEL_STARTUP_FLAGS[@]} run //crate_universe/tools/urls_generator \
-- --artifacts-dir="${ARTIFACTS_DIR}" --url-prefix="${URL_PREFIX}"
bazel clean
# Build an archive of the repo contents.
# `examples/bzlmod` is included for the BCR presubmit; it must appear before --exclude="examples"
tar -czf ${{ github.workspace }}/.github/rules_rust.tar.gz -C ${{ github.workspace }} --exclude=".git" --exclude=".github" --exclude="crate_universe/target" examples/bzlmod --exclude="examples" .
tar -czf ${{ github.workspace }}/.github/rules_rust.tar.gz \
-C ${{ github.workspace }} \
--exclude=".git" --exclude=".github" \
--exclude="crate_universe/target" \
examples/bzlmod \
--exclude="examples" \
--exclude="extensions" \
.
# 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
run: |
# Build an archive of the repo contents.
tar -czf ${{ github.workspace }}/.github/rules_rust_ext.tar.gz \
-C ${{ github.workspace }}/extensions \
--exclude="examples" \
.
# Save the sha256 checksum of the distro archive to the environment
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_ext.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
echo "ARCHIVE_EXT_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_ext.tar.gz"
path: ${{ github.workspace }}/.github/rules_rust_ext.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_sha256_base64}#${{ env.ARCHIVE_EXT_SHA256_BASE64 }}#g' \
> ${{ github.workspace }}/.github/release_notes.txt
- name: Create release
uses: softprops/action-gh-release@v1
Expand All @@ -169,10 +197,20 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.rules_rust_release.outputs.upload_url }}
asset_name: rules_rust-v${{ env.RELEASE_VERSION }}.tar.gz
asset_name: rules_rust-${{ env.RELEASE_VERSION }}.tar.gz
asset_path: ${{ github.workspace }}/.github/rules_rust.tar.gz
asset_content_type: application/gzip

- name: "Upload the rules extensions 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_ext-${{ env.RELEASE_VERSION }}.tar.gz
asset_path: ${{ github.workspace }}/.github/rules_rust_ext.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
Expand Down
Loading

0 comments on commit dccec44

Please sign in to comment.