Skip to content

Commit 2bad96d

Browse files
authored
Moved rust extension rules into a separate rules_rust_ext workspace. (#3007)
This change moves the `bindgen`, `proto`, and `wasm_bindgen` sub-packages into individual workspaces within the `extensions` directory. The intent is improve ease of maintenance of both core and extension Rust rules by ensuring changes to extensions have no impact on the core rules. Core rules should *never* depend on extensions. Load statements should be updated according to the following table: | before | after | | --- | --- | | `@rules_rust//bindgen` | `@rules_rust_bindgen//` | | `@rules_rust//proto/prost` | `@rules_rust_prost//` | | `@rules_rust//proto/protobuf` | `@rules_rust_protobuf//` | | `@rules_rust//wasm_bindgen` | `@rules_rust_wasm_bindgen//` | closes #2882
1 parent 0f0b354 commit 2bad96d

File tree

724 files changed

+8445
-7144
lines changed

Some content is hidden

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

724 files changed

+8445
-7144
lines changed

.bazelci/presubmit.yml

Lines changed: 136 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,142 @@ tasks:
834824
- "--compile_one_dependency"
835825
build_targets:
836826
- "tools/rust_analyzer/main.rs"
827+
extensions_bindgen_linux:
828+
platform: ubuntu2004
829+
name: Extensions Bindgen
830+
working_directory: extensions/bindgen
831+
build_flags: *aspects_flags
832+
test_flags: *aspects_flags
833+
build_targets:
834+
- "//..."
835+
test_targets:
836+
- "//..."
837+
extensions_bindgen_linux_rbe:
838+
platform: rbe_ubuntu2004
839+
name: Extensions Bindgen
840+
working_directory: extensions/bindgen
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_bindgen_macos:
851+
platform: macos_arm64
852+
name: Extensions Bindgen
853+
working_directory: extensions/bindgen
854+
build_flags: *aspects_flags
855+
test_flags: *aspects_flags
856+
build_targets:
857+
- "//..."
858+
test_targets:
859+
- "//..."
860+
# # TODO: https://github.com/bazelbuild/rules_rust/issues/2009
861+
# # The bindgen rules are currently broken on windows
862+
# extensions_bindgen_windows:
863+
# platform: windows
864+
# name: Extensions Bindgen
865+
# working_directory: extensions/bindgen
866+
# build_flags: *aspects_flags
867+
# test_flags: *aspects_flags
868+
# build_targets:
869+
# - "--"
870+
# - "//..."
871+
# test_targets:
872+
# - "--"
873+
# - "//..."
874+
extensions_protobuf_linux:
875+
platform: ubuntu2004
876+
name: Extensions Protobuf
877+
working_directory: extensions/protobuf
878+
build_flags: *aspects_flags
879+
test_flags: *aspects_flags
880+
build_targets:
881+
- "//..."
882+
test_targets:
883+
- "//..."
884+
extensions_protobuf_linux_rbe:
885+
platform: rbe_ubuntu2004
886+
name: Extensions Protobuf
887+
working_directory: extensions/protobuf
888+
shell_commands:
889+
- sed -i 's/^# load("@bazel_ci_rules/load("@bazel_ci_rules/' WORKSPACE.bazel
890+
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
891+
build_flags: *aspects_flags
892+
test_flags: *aspects_flags
893+
build_targets:
894+
- "//..."
895+
test_targets:
896+
- "//..."
897+
extensions_protobuf_macos:
898+
platform: macos_arm64
899+
name: Extensions Protobuf
900+
working_directory: extensions/protobuf
901+
build_flags: *aspects_flags
902+
test_flags: *aspects_flags
903+
build_targets:
904+
- "//..."
905+
test_targets:
906+
- "//..."
907+
extensions_protobuf_windows:
908+
platform: windows
909+
name: Extensions Protobuf
910+
working_directory: extensions/protobuf
911+
build_flags: *aspects_flags
912+
test_flags: *aspects_flags
913+
build_targets:
914+
- "//..."
915+
test_targets:
916+
- "//..."
917+
extensions_wasm_bindgen_linux:
918+
platform: ubuntu2004
919+
name: Extensions wasm-bindgen
920+
working_directory: extensions/wasm_bindgen
921+
build_flags: *aspects_flags
922+
test_flags: *aspects_flags
923+
build_targets:
924+
- "//..."
925+
test_targets:
926+
- "//..."
927+
extensions_wasm_bindgen_linux_rbe:
928+
platform: rbe_ubuntu2004
929+
name: Extensions wasm-bindgen
930+
working_directory: extensions/wasm_bindgen
931+
shell_commands:
932+
- sed -i 's/^# load("@bazel_ci_rules/load("@bazel_ci_rules/' WORKSPACE.bazel
933+
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
934+
build_flags: *aspects_flags
935+
test_flags: *aspects_flags
936+
build_targets:
937+
- "//..."
938+
test_targets:
939+
- "//..."
940+
extensions_wasm_bindgen_macos:
941+
platform: macos_arm64
942+
name: Extensions wasm-bindgen
943+
working_directory: extensions
944+
build_flags: *aspects_flags
945+
test_flags: *aspects_flags
946+
build_targets:
947+
- "//..."
948+
test_targets:
949+
- "//..."
950+
# # TODO: https://github.com/bazelbuild/rules_rust/issues/3021
951+
# # The length of the workspace name results in paths that are too long
952+
# # on windows for linking.
953+
# extensions_wasm_bindgen_windows:
954+
# platform: windows
955+
# name: Extensions wasm-bindgen
956+
# working_directory: extensions/wasm_bindgen
957+
# build_flags: *aspects_flags
958+
# test_flags: *aspects_flags
959+
# build_targets:
960+
# - "//..."
961+
# test_targets:
962+
# - "//..."
837963

838964
buildifier:
839965
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/bindgen",
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/bindgen/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/bindgen"
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}_bindgen-{VERSION}.tar.gz"
5+
}
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/prost",
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/prost/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/prost"
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}_prost-{VERSION}.tar.gz"
5+
}
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/protobuf",
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+
}
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/protobuf"
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}_protobuf-{VERSION}.tar.gz"
5+
}
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/wasm_bindgen",
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+
}
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/wasm_bindgen"
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}_wasm_bindgen-{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
}

0 commit comments

Comments
 (0)