Skip to content

Commit 02a73bc

Browse files
committed
Updated entire repository to account for creation of rules_rust_ext.
1 parent 3fe6900 commit 02a73bc

File tree

362 files changed

+2784
-2640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

362 files changed

+2784
-2640
lines changed

.bazelci/presubmit.yml

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ default_macos_targets: &default_macos_targets
3434
default_windows_targets: &default_windows_targets
3535
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
3636
- "//..."
37-
- "-//test/proto/..."
3837
- "-//test/unit/pipelined_compilation/..."
3938
default_windows_no_runfiles_targets: &default_windows_no_runfiles_targets
4039
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
@@ -43,7 +42,6 @@ default_windows_no_runfiles_targets: &default_windows_no_runfiles_targets
4342
- "-//crate_universe/..."
4443
- "-//test/chained_direct_deps:mod3_doc_test"
4544
- "-//test/out_dir_in_tests:demo_lib_doc_test"
46-
- "-//test/proto/..."
4745
- "-//test/rustc_env_files:output_test"
4846
- "-//test/test_env_launcher:test"
4947
- "-//test/test_env:test_manifest_dir"
@@ -235,12 +233,9 @@ tasks:
235233
build_flags:
236234
- "--enable_bzlmod"
237235
build_targets:
238-
- "//bindgen/3rdparty:bindgen"
239236
- "//crate_universe:cargo_bazel_bin"
240-
- "//proto/prost/private:prost_runtime"
241237
- "//tools/runfiles"
242238
- "//util/import"
243-
- "//wasm_bindgen/3rdparty:wasm_bindgen"
244239
ubuntu2004_clang:
245240
name: With Clang
246241
platform: ubuntu2004
@@ -467,11 +462,6 @@ tasks:
467462
windows_targets: &windows_targets
468463
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
469464
- "//..."
470-
# The proto rules do not work on windows
471-
- "-//proto/..."
472-
# The bindgen rules are currently broken on windows
473-
# https://github.com/bazelbuild/rules_rust/issues/2009
474-
- "-//bindgen/..."
475465
build_targets: *windows_targets
476466
test_targets: *windows_targets
477467
crate_universe_examples_ubuntu2004:
@@ -834,6 +824,57 @@ tasks:
834824
- "--compile_one_dependency"
835825
build_targets:
836826
- "tools/rust_analyzer/main.rs"
827+
extensions_linux:
828+
name: Extensions
829+
platform: ubuntu2004
830+
working_directory: extensions
831+
build_flags: *aspects_flags
832+
test_flags: *aspects_flags
833+
build_targets:
834+
- "//..."
835+
test_targets:
836+
- "//..."
837+
extensions_linux_rbe:
838+
name: Extensions
839+
platform: rbe_ubuntu2004
840+
working_directory: extensions
841+
shell_commands:
842+
- sed -i 's/^# load("@bazel_ci_rules/load("@bazel_ci_rules/' WORKSPACE.bazel
843+
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
844+
build_flags: *aspects_flags
845+
test_flags: *aspects_flags
846+
build_targets:
847+
- "//..."
848+
test_targets:
849+
- "//..."
850+
extensions_macos:
851+
name: Extensions
852+
platform: macos_arm64
853+
working_directory: extensions
854+
build_flags: *aspects_flags
855+
test_flags: *aspects_flags
856+
build_targets:
857+
- "//..."
858+
test_targets:
859+
- "//..."
860+
extensions_windows:
861+
name: Extensions
862+
platform: windows
863+
working_directory: extensions
864+
build_flags: *aspects_flags
865+
test_flags: *aspects_flags
866+
build_targets:
867+
- "--"
868+
- "//..."
869+
# The bindgen rules are currently broken on windows
870+
# https://github.com/bazelbuild/rules_rust/issues/2009
871+
- "-//bindgen/..."
872+
test_targets:
873+
- "--"
874+
- "//..."
875+
# The bindgen rules are currently broken on windows
876+
# https://github.com/bazelbuild/rules_rust/issues/2009
877+
- "-//bindgen/..."
837878

838879
buildifier:
839880
version: latest

.bazelignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
.direnv
12
bzlmod
3+
crate_universe/private/bootstrap
24
docs
35
examples
4-
crate_universe/private/bootstrap
6+
extensions
57
test/aliased_toolchains
68
test/bzlmod_repo_mapping
79
test/cc_common_link
810
test/no_std
9-
.direnv

.bcr/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
fixedReleaser:
22
login: scentini
33
4+
moduleRoots: [".", "extensions"]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"homepage": "https://github.com/bazelbuild/rules_rust/extensions",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "UebelAndre",
7+
"name": "UebelAndre"
8+
},
9+
{
10+
"email": "[email protected]",
11+
"github": "illicitonion",
12+
"name": "Daniel Wagner-Hall"
13+
},
14+
{
15+
"email": "[email protected]",
16+
"github": "scentini",
17+
"name": "Rosica Dejanovska"
18+
}
19+
],
20+
"repository": ["github:bazelbuild/rules_rust"],
21+
"versions": [],
22+
"yanked_versions": {}
23+
}

.bcr/extensions/presubmit.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
bcr_test_module:
2+
module_path: "extensions"
3+
matrix:
4+
platform: ["macos_arm64", "ubuntu2004", "windows"]
5+
bazel: ["7.x"]
6+
tasks:
7+
run_tests:
8+
name: "Run test module"
9+
platform: ${{ platform }}
10+
bazel: ${{ bazel }}
11+
# 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.
12+
shell_commands:
13+
- "rm MODULE.bazel.lock"
14+
test_targets:
15+
- "//..."
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"integrity": "**leave this alone**",
3+
"strip_prefix": "",
4+
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_ext-{VERSION}.tar.gz"
5+
}

.bcr/source.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"integrity": "**leave this alone**",
33
"strip_prefix": "",
4-
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-v{VERSION}.tar.gz"
4+
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz"
55
}

.gitattributes

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
**/*Cargo.Bazel.lock linguist-generated
22
**/cargo-bazel-lock.json linguist-generated
3-
bindgen/3rdparty/crates/** linguist-generated
43
crate_universe/3rdparty/crates/** linguist-generated
54
crate_universe/test_data/metadata/*/metadata.json linguist-generated
65
examples/bzlmod/hello_world/third-party/crates/** linguist-generated
6+
examples/crate_universe_unnamed/vendor_remote_manifests/crates/** linguist-generated
7+
examples/crate_universe_unnamed/vendor_remote_pkgs/crates/** linguist-generated
78
examples/crate_universe/vendor_external/crates/** linguist-generated
89
examples/crate_universe/vendor_local_manifests/crates/** linguist-generated
910
examples/crate_universe/vendor_local_pkgs/crates/** linguist-generated
1011
examples/crate_universe/vendor_remote_manifests/crates/** linguist-generated
1112
examples/crate_universe/vendor_remote_pkgs/crates/** linguist-generated
12-
examples/crate_universe_unnamed/vendor_remote_manifests/crates/** linguist-generated
13-
examples/crate_universe_unnamed/vendor_remote_pkgs/crates/** linguist-generated
1413
examples/sys/basic/3rdparty/crates/** linguist-generated
1514
examples/sys/complex/3rdparty/crates/** linguist-generated
16-
proto/prost/private/3rdparty/crates/** linguist-generated
17-
proto/protobuf/3rdparty/crates/** linguist-generated
15+
extensions/bindgen/3rdparty/crates/** linguist-generated
16+
extensions/prost/private/3rdparty/crates/** linguist-generated
17+
extensions/protobuf/3rdparty/crates/** linguist-generated
18+
extensions/wasm_bindgen/3rdparty/crates/** linguist-generated
1819
tools/rust_analyzer/3rdparty/crates/** linguist-generated
1920
util/import/3rdparty/crates/** linguist-generated
20-
wasm_bindgen/3rdparty/crates/** linguist-generated

.github/release_notes.template

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# {version}
22

3+
Additional documentation can be found at: https://bazelbuild.github.io/rules_rust/#setup
4+
35
## Bzlmod
46

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

20-
Additional documentation can be found at: https://bazelbuild.github.io/rules_rust/#setup
22+
## Extensions
23+
24+
### Bzlmod
25+
26+
```python
27+
bazel_dep(name = "rules_rust_ext", version = "{version}")
28+
```
29+
30+
### WORKSPACE
31+
32+
```python
33+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
34+
http_archive(
35+
name = "rules_rust",
36+
integrity = "sha256-{ext_sha256_base64}",
37+
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/{version}/rules_rust_ext-{version}.tar.gz"],
38+
)
39+
```

.github/workflows/release.yaml

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,29 +128,57 @@ jobs:
128128
- name: Create the rules archive
129129
run: |
130130
# Update urls and sha256 values
131-
bazel ${BAZEL_STARTUP_FLAGS[@]} run //crate_universe/tools/urls_generator -- --artifacts-dir="${ARTIFACTS_DIR}" --url-prefix="${URL_PREFIX}"
131+
bazel ${BAZEL_STARTUP_FLAGS[@]} run //crate_universe/tools/urls_generator \
132+
-- --artifacts-dir="${ARTIFACTS_DIR}" --url-prefix="${URL_PREFIX}"
133+
132134
bazel clean
135+
133136
# Build an archive of the repo contents.
134137
# `examples/bzlmod` is included for the BCR presubmit; it must appear before --exclude="examples"
135-
tar -czf ${{ github.workspace }}/.github/rules_rust.tar.gz -C ${{ github.workspace }} --exclude=".git" --exclude=".github" --exclude="crate_universe/target" examples/bzlmod --exclude="examples" .
138+
tar -czf ${{ github.workspace }}/.github/rules_rust.tar.gz \
139+
-C ${{ github.workspace }} \
140+
--exclude=".git" --exclude=".github" \
141+
--exclude="crate_universe/target" \
142+
examples/bzlmod \
143+
--exclude="examples" \
144+
--exclude="extensions" \
145+
.
146+
136147
# Save the sha256 checksum of the distro archive to the environment
137148
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
138149
echo "ARCHIVE_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
139150
env:
140151
CARGO_BAZEL_GENERATOR_URL: file://${{ github.workspace }}/crate_universe/target/artifacts/x86_64-unknown-linux-gnu/cargo-bazel
141152
ARTIFACTS_DIR: ${{ github.workspace }}/crate_universe/target/artifacts
142153
URL_PREFIX: https://github.com/${{ github.repository_owner }}/rules_rust/releases/download/${{ env.RELEASE_VERSION }}
154+
- name: Create the rules extensions archive
155+
run: |
156+
# Build an archive of the repo contents.
157+
tar -czf ${{ github.workspace }}/.github/rules_rust_ext.tar.gz \
158+
-C ${{ github.workspace }}/extensions \
159+
--exclude="examples" \
160+
.
161+
162+
# Save the sha256 checksum of the distro archive to the environment
163+
sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust_ext.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
164+
echo "ARCHIVE_EXT_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV
143165
# Upload the artifact in case creating a release fails so all artifacts can then be manually recovered.
144166
- uses: actions/upload-artifact@v3
145167
with:
146168
name: "rules_rust.tar.gz"
147169
path: ${{ github.workspace }}/.github/rules_rust.tar.gz
148170
if-no-files-found: error
171+
- uses: actions/upload-artifact@v3
172+
with:
173+
name: "rules_rust_ext.tar.gz"
174+
path: ${{ github.workspace }}/.github/rules_rust_ext.tar.gz
175+
if-no-files-found: error
149176
- name: Generate release notes
150177
run: |
151178
# Generate the release notes
152179
sed 's#{version}#${{ env.RELEASE_VERSION }}#g' ${{ github.workspace }}/.github/release_notes.template \
153180
| sed 's#{sha256_base64}#${{ env.ARCHIVE_SHA256_BASE64 }}#g' \
181+
| sed 's#{ext_sha256_base64}#${{ env.ARCHIVE_EXT_SHA256_BASE64 }}#g' \
154182
> ${{ github.workspace }}/.github/release_notes.txt
155183
- name: Create release
156184
uses: softprops/action-gh-release@v1
@@ -169,10 +197,20 @@ jobs:
169197
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170198
with:
171199
upload_url: ${{ steps.rules_rust_release.outputs.upload_url }}
172-
asset_name: rules_rust-v${{ env.RELEASE_VERSION }}.tar.gz
200+
asset_name: rules_rust-${{ env.RELEASE_VERSION }}.tar.gz
173201
asset_path: ${{ github.workspace }}/.github/rules_rust.tar.gz
174202
asset_content_type: application/gzip
175203

204+
- name: "Upload the rules extensions archive"
205+
uses: actions/upload-release-asset@v1
206+
env:
207+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208+
with:
209+
upload_url: ${{ steps.rules_rust_release.outputs.upload_url }}
210+
asset_name: rules_rust_ext-${{ env.RELEASE_VERSION }}.tar.gz
211+
asset_path: ${{ github.workspace }}/.github/rules_rust_ext.tar.gz
212+
asset_content_type: application/gzip
213+
176214
# There must be a upload action for each platform triple we create
177215
- name: "Upload aarch64-apple-darwin"
178216
uses: actions/upload-release-asset@v1

0 commit comments

Comments
 (0)