Skip to content

Commit ef700fc

Browse files
authored
Merge branch 'main' into wasi-p2-support-pr
2 parents 01c9f3f + bb32364 commit ef700fc

File tree

7 files changed

+28
-15
lines changed

7 files changed

+28
-15
lines changed

.bazelci/presubmit.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -809,18 +809,17 @@ tasks:
809809
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
810810
test_targets:
811811
- "//..."
812-
# TODO: https://github.com/bazelbuild/rules_rust/issues/2878
813-
# windows_bzlmod_bcr:
814-
# name: bzlmod BCR presubmit
815-
# platform: windows
816-
# working_directory: examples/hello_world
817-
# test_flags: *bzlmod_flags
818-
# run_targets:
819-
# - "//third-party-in-workspace:vendor"
820-
# build_targets:
821-
# - "@rules_rust//tools/rust_analyzer:gen_rust_project"
822-
# test_targets:
823-
# - "//..."
812+
windows_bzlmod_bcr:
813+
name: bzlmod BCR presubmit
814+
platform: windows
815+
working_directory: examples/hello_world
816+
test_flags: *bzlmod_flags
817+
run_targets:
818+
- "//third-party-in-workspace:vendor"
819+
build_targets:
820+
- "@rules_rust//tools/rust_analyzer:gen_rust_project"
821+
test_targets:
822+
- "//..."
824823
example_sys_linux:
825824
platform: ubuntu2204
826825
working_directory: examples/sys

crate_universe/extensions.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This doc describes using crate_universe with bzlmod.
66
77
If you're using a WORKSPACE file, please see [the WORKSPACE equivalent of this doc](crate_universe_workspace.html).
88
9-
There are some examples of using crate_universe with bzlmod in the [example folder](https://github.com/bazelbuild/rules_rust/examples/bzlmod).
9+
There are some examples of using crate_universe with bzlmod in the [example folder](https://github.com/bazelbuild/rules_rust/tree/main/examples).
1010
1111
# Table of Contents
1212
@@ -638,6 +638,7 @@ def _generate_hub_and_spokes(
638638
config_path = config_file,
639639
output_dir = tag_path.get_child("splicing-output"),
640640
debug_workspace_dir = tag_path.get_child("splicing-workspace"),
641+
repository_name = cfg.name,
641642
)
642643

643644
# If a cargo lockfile was not provided, use the splicing lockfile.
@@ -1360,7 +1361,7 @@ Environment Variables:
13601361
| `CARGO_BAZEL_GENERATOR_SHA256` | The sha256 checksum of the file located at `CARGO_BAZEL_GENERATOR_URL` |
13611362
| `CARGO_BAZEL_GENERATOR_URL` | The URL of a cargo-bazel binary. This variable takes precedence over attributes and can use `file://` for local paths |
13621363
| `CARGO_BAZEL_ISOLATED` | An authoritative flag as to whether or not the `CARGO_HOME` environment variable should be isolated from the host configuration |
1363-
| `CARGO_BAZEL_REPIN` | An indicator that the dependencies represented by the rule should be regenerated. `REPIN` may also be used. See [Repinning / Updating Dependencies](#repinning--updating-dependencies) for more details. |
1364+
| `CARGO_BAZEL_REPIN` | An indicator that the dependencies represented by the rule should be regenerated. `REPIN` may also be used. See [Repinning / Updating Dependencies](crate_universe_workspace.html#repinning--updating-dependencies) for more details. |
13641365
| `CARGO_BAZEL_REPIN_ONLY` | A comma-delimited allowlist for rules to execute repinning. Can be useful if multiple instances of the repository rule are used in a Bazel workspace, but repinning should be limited to one of them. |
13651366
13661367
""",

crate_universe/private/crates_repository.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def _crates_repository_impl(repository_ctx):
8989
splicing_manifest = splicing_manifest,
9090
config_path = config_path,
9191
output_dir = repository_ctx.path("splicing-output"),
92+
repository_name = repository_ctx.name,
9293
)
9394

9495
kwargs.update({

crate_universe/private/crates_vendor.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ if [[ -n "${{CARGO_BAZEL_DEBUG:-}}" ]]; then
3939
_ENVIRON+=(CARGO_BAZEL_DEBUG="${{CARGO_BAZEL_DEBUG}}")
4040
fi
4141
42+
# Pass on CARGO_REGISTRIES_* and CARGO_REGISTRY*
43+
while IFS= read -r line; do _ENVIRON+=("${{line}}"); done < <(env | grep ^CARGO_REGISTR)
44+
4245
# The path needs to be preserved to prevent bazel from starting with different
4346
# startup options (requiring a restart of bazel).
4447
# If you provide an empty path, bazel starts itself with

crate_universe/private/splicing_utils.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def splice_workspace_manifest(
122122
splicing_manifest,
123123
config_path,
124124
output_dir,
125+
repository_name,
125126
debug_workspace_dir = None):
126127
"""Splice together a Cargo workspace from various other manifests and package definitions
127128
@@ -132,6 +133,7 @@ def splice_workspace_manifest(
132133
splicing_manifest (path): The path to a splicing manifest.
133134
config_path (path): The path to the config file (containing `cargo_bazel::config::Config`.)
134135
output_dir (path): THe location in which to write splicing outputs.
136+
repository_name (str): Name of the repository being generated.
135137
debug_workspace_dir (path): The location in which to save splicing outputs for future review.
136138
137139
Returns:
@@ -147,6 +149,8 @@ def splice_workspace_manifest(
147149
splicing_manifest,
148150
"--config",
149151
config_path,
152+
"--repository-name",
153+
repository_name,
150154
]
151155

152156
if cargo_lockfile:

crate_universe/src/cli/splice.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ pub struct SpliceOptions {
5757
/// The path to a rustc binary for use with Cargo
5858
#[clap(long, env = "RUSTC")]
5959
pub rustc: PathBuf,
60+
61+
/// The name of the repository being generated.
62+
#[clap(long)]
63+
pub repository_name: String,
6064
}
6165

6266
/// Combine a set of disjoint manifests into a single workspace.
@@ -84,7 +88,7 @@ pub fn splice(opt: SpliceOptions) -> Result<()> {
8488
// Splice together the manifest
8589
let manifest_path = splicer
8690
.splice_workspace()
87-
.context("Failed to splice workspace")?;
91+
.with_context(|| format!("Failed to splice workspace {}", opt.repository_name))?;
8892

8993
// Generate a lockfile
9094
let cargo_lockfile = generate_lockfile(

crate_universe/tests/cargo_integration_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ fn run(repository_name: &str, manifests: HashMap<String, String>, lockfile: &str
116116
config,
117117
cargo,
118118
rustc,
119+
repository_name: String::from("crates_index"),
119120
})
120121
.unwrap();
121122

0 commit comments

Comments
 (0)