Skip to content

Commit

Permalink
Moved rust extension rules into a separate rules_rust_ext workspace. (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
UebelAndre authored Nov 26, 2024
1 parent 0f0b354 commit 2bad96d
Show file tree
Hide file tree
Showing 724 changed files with 8,445 additions and 7,144 deletions.
146 changes: 136 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 @@ -235,12 +233,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 @@ -467,11 +462,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 @@ -834,6 +824,142 @@ tasks:
- "--compile_one_dependency"
build_targets:
- "tools/rust_analyzer/main.rs"
extensions_bindgen_linux:
platform: ubuntu2004
name: Extensions Bindgen
working_directory: extensions/bindgen
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
extensions_bindgen_linux_rbe:
platform: rbe_ubuntu2004
name: Extensions Bindgen
working_directory: extensions/bindgen
shell_commands:
- sed -i 's/^# load("@bazel_ci_rules/load("@bazel_ci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
extensions_bindgen_macos:
platform: macos_arm64
name: Extensions Bindgen
working_directory: extensions/bindgen
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
# # TODO: https://github.com/bazelbuild/rules_rust/issues/2009
# # The bindgen rules are currently broken on windows
# extensions_bindgen_windows:
# platform: windows
# name: Extensions Bindgen
# working_directory: extensions/bindgen
# build_flags: *aspects_flags
# test_flags: *aspects_flags
# build_targets:
# - "--"
# - "//..."
# test_targets:
# - "--"
# - "//..."
extensions_protobuf_linux:
platform: ubuntu2004
name: Extensions Protobuf
working_directory: extensions/protobuf
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
extensions_protobuf_linux_rbe:
platform: rbe_ubuntu2004
name: Extensions Protobuf
working_directory: extensions/protobuf
shell_commands:
- sed -i 's/^# load("@bazel_ci_rules/load("@bazel_ci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
extensions_protobuf_macos:
platform: macos_arm64
name: Extensions Protobuf
working_directory: extensions/protobuf
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
extensions_protobuf_windows:
platform: windows
name: Extensions Protobuf
working_directory: extensions/protobuf
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
extensions_wasm_bindgen_linux:
platform: ubuntu2004
name: Extensions wasm-bindgen
working_directory: extensions/wasm_bindgen
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
extensions_wasm_bindgen_linux_rbe:
platform: rbe_ubuntu2004
name: Extensions wasm-bindgen
working_directory: extensions/wasm_bindgen
shell_commands:
- sed -i 's/^# load("@bazel_ci_rules/load("@bazel_ci_rules/' WORKSPACE.bazel
- sed -i 's/^# rbe_preconfig/rbe_preconfig/' WORKSPACE.bazel
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
extensions_wasm_bindgen_macos:
platform: macos_arm64
name: Extensions wasm-bindgen
working_directory: extensions
build_flags: *aspects_flags
test_flags: *aspects_flags
build_targets:
- "//..."
test_targets:
- "//..."
# # TODO: https://github.com/bazelbuild/rules_rust/issues/3021
# # The length of the workspace name results in paths that are too long
# # on windows for linking.
# extensions_wasm_bindgen_windows:
# platform: windows
# name: Extensions wasm-bindgen
# working_directory: extensions/wasm_bindgen
# build_flags: *aspects_flags
# test_flags: *aspects_flags
# build_targets:
# - "//..."
# test_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
1 change: 1 addition & 0 deletions .bcr/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fixedReleaser:
login: scentini
email: [email protected]
moduleRoots: [".", "extensions"]
23 changes: 23 additions & 0 deletions .bcr/extensions/bindgen/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"homepage": "https://github.com/bazelbuild/rules_rust/extensions/bindgen",
"maintainers": [
{
"email": "[email protected]",
"github": "UebelAndre",
"name": "UebelAndre"
},
{
"email": "[email protected]",
"github": "illicitonion",
"name": "Daniel Wagner-Hall"
},
{
"email": "[email protected]",
"github": "scentini",
"name": "Rosica Dejanovska"
}
],
"repository": ["github:bazelbuild/rules_rust"],
"versions": [],
"yanked_versions": {}
}
15 changes: 15 additions & 0 deletions .bcr/extensions/bindgen/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bcr_test_module:
module_path: "extensions/bindgen"
matrix:
platform: ["macos_arm64", "ubuntu2004", "windows"]
bazel: ["7.x"]
tasks:
run_tests:
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"
test_targets:
- "//..."
5 changes: 5 additions & 0 deletions .bcr/extensions/bindgen/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_bindgen-{VERSION}.tar.gz"
}
23 changes: 23 additions & 0 deletions .bcr/extensions/prost/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"homepage": "https://github.com/bazelbuild/rules_rust/extensions/prost",
"maintainers": [
{
"email": "[email protected]",
"github": "UebelAndre",
"name": "UebelAndre"
},
{
"email": "[email protected]",
"github": "illicitonion",
"name": "Daniel Wagner-Hall"
},
{
"email": "[email protected]",
"github": "scentini",
"name": "Rosica Dejanovska"
}
],
"repository": ["github:bazelbuild/rules_rust"],
"versions": [],
"yanked_versions": {}
}
15 changes: 15 additions & 0 deletions .bcr/extensions/prost/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bcr_test_module:
module_path: "extensions/prost"
matrix:
platform: ["macos_arm64", "ubuntu2004", "windows"]
bazel: ["7.x"]
tasks:
run_tests:
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"
test_targets:
- "//..."
5 changes: 5 additions & 0 deletions .bcr/extensions/prost/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_prost-{VERSION}.tar.gz"
}
23 changes: 23 additions & 0 deletions .bcr/extensions/protobuf/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"homepage": "https://github.com/bazelbuild/rules_rust/extensions/protobuf",
"maintainers": [
{
"email": "[email protected]",
"github": "UebelAndre",
"name": "UebelAndre"
},
{
"email": "[email protected]",
"github": "illicitonion",
"name": "Daniel Wagner-Hall"
},
{
"email": "[email protected]",
"github": "scentini",
"name": "Rosica Dejanovska"
}
],
"repository": ["github:bazelbuild/rules_rust"],
"versions": [],
"yanked_versions": {}
}
15 changes: 15 additions & 0 deletions .bcr/extensions/protobuf/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bcr_test_module:
module_path: "extensions/protobuf"
matrix:
platform: ["macos_arm64", "ubuntu2004", "windows"]
bazel: ["7.x"]
tasks:
run_tests:
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"
test_targets:
- "//..."
5 changes: 5 additions & 0 deletions .bcr/extensions/protobuf/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_protobuf-{VERSION}.tar.gz"
}
23 changes: 23 additions & 0 deletions .bcr/extensions/wasm_bindgen/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"homepage": "https://github.com/bazelbuild/rules_rust/extensions/wasm_bindgen",
"maintainers": [
{
"email": "[email protected]",
"github": "UebelAndre",
"name": "UebelAndre"
},
{
"email": "[email protected]",
"github": "illicitonion",
"name": "Daniel Wagner-Hall"
},
{
"email": "[email protected]",
"github": "scentini",
"name": "Rosica Dejanovska"
}
],
"repository": ["github:bazelbuild/rules_rust"],
"versions": [],
"yanked_versions": {}
}
15 changes: 15 additions & 0 deletions .bcr/extensions/wasm_bindgen/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
bcr_test_module:
module_path: "extensions/wasm_bindgen"
matrix:
platform: ["macos_arm64", "ubuntu2004", "windows"]
bazel: ["7.x"]
tasks:
run_tests:
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"
test_targets:
- "//..."
5 changes: 5 additions & 0 deletions .bcr/extensions/wasm_bindgen/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}_wasm_bindgen-{VERSION}.tar.gz"
}
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"
}
Loading

0 comments on commit 2bad96d

Please sign in to comment.