Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for --incompatible_use_plus_in_repo_names #2801

Closed
criemen opened this issue Aug 20, 2024 · 6 comments
Closed

Support for --incompatible_use_plus_in_repo_names #2801

criemen opened this issue Aug 20, 2024 · 6 comments

Comments

@criemen
Copy link
Contributor

criemen commented Aug 20, 2024

Bazel 7.3.0 introduced --incompatible_use_plus_in_repo_names which changes the bzlmod separator from ~ to + (for performance reasons on Windows). This flag will be flipped with 8.0.0.
Flipping that flag currently is incompatible with rules_rust, as (at least) the crate_universe code assumes that the separator is ~.
Im getting

ERROR: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/external/rules_rust+/crate_universe/extension.bzl", line 369, column 37, in _crate_impl
                _generate_hub_and_spokes(module_ctx, cargo_bazel, cfg, annotations, cargo_lockfile = cargo_lockfile, manifests = manifests)
        File "/private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/external/rules_rust+/crate_universe/extension.bzl", line 132, column 16, in _generate_hub_and_spokes
                cargo_bazel(splice_args)
        File "/private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/external/rules_rust+/crate_universe/private/module_extensions/cargo_bazel_bootstrap.bzl", line 66, column 17, in run
                fail("%s returned with exit code %d:\n%s" % (pretty_args, result.return_code, result.stderr))
Error in fail: /private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/modextwd/rules_rust++_crate+ql++r/cargo-bazel splice --output-dir /private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/modextwd/rules_rust++_crate+ql++r/rd/splicing-output --config /private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/modextwd/rules_rust++_crate+ql++r/rd/config.json --splicing-manifest /private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/modextwd/rules_rust++_crate+ql++r/rd/splicing_manifest.json --cargo-lockfile /private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/external/ql+/ruby/extractor/Cargo.lock --cargo /private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/external/rules_rust++rust_host_tools+rust_host_tools/bin/cargo --rustc /private/var/tmp/_bazel_criemen/267ec2c545f0139b2caed9502387afe1/external/rules_rust++rust_host_tools+rust_host_tools/bin/rustc returned with exit code 1:
Error: Failed to parse splicing manifest

Caused by:
    0: Failed to load SplicingManifest
    1: Invalid Label: @@ql+//ruby/extractor:Cargo.toml at line 5 column 149
ERROR: Analysis of target '//language-packs:intree-codeql' failed; build aborted: error evaluating module extension crate in @@rules_rust+//crate_universe:extension.bzl

with rules_rust 0.49.1, and I've not seen anything in the changelog or source code that'd indicate that upgrading to the latest release would help.

@marvin-hansen
Copy link
Contributor

According to to this engflow blog post, there is a real chance the canonical name will change again in the future...

https://blog.engflow.com/2024/09/06/migrating-to-bazel-modules-aka-bzlmod---repo-names-macros-and-variables/

@konkers
Copy link
Contributor

konkers commented Sep 6, 2024

#2844 Is sufficient for getting all of //examples/bzlmod building and passing tests with bazel version d62e0a0f32188e1875bb8e62ef4377ea4dc1aab2

konkers added a commit to konkers/rules_rust that referenced this issue Sep 6, 2024
konkers added a commit to konkers/rules_rust that referenced this issue Sep 11, 2024
konkers added a commit to konkers/rules_rust that referenced this issue Sep 11, 2024
konkers added a commit to konkers/rules_rust that referenced this issue Sep 11, 2024
konkers added a commit to konkers/rules_rust that referenced this issue Sep 11, 2024
konkers added a commit to konkers/rules_rust that referenced this issue Sep 11, 2024
konkers added a commit to konkers/rules_rust that referenced this issue Sep 11, 2024
@marvin-hansen
Copy link
Contributor

marvin-hansen commented Sep 15, 2024

I have multiple examples over at the bazel/examples repo that are currently failing with Bazel v8. All examples use the latest rules release 0.50.1

Repro:
https://github.com/marvin-hansen/bazel_8_rust

I don't know if it is the same issue as this one, but I want to bring this up and share the repro.

@marvin-hansen
Copy link
Contributor

The error I am seeing with Bazel 8.0.0-pre.20240826.1 (2024-09-07):

bazel build //...
ERROR: /private/var/tmp/_bazel_marvin/2ca8fbba9913b18ada099dc013e74ad8/external/rules_rust+/crate_universe/private/module_extensions/cargo_bazel_bootstrap.bzl:66:17: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_marvin/2ca8fbba9913b18ada099dc013e74ad8/external/rules_rust+/crate_universe/extension.bzl", line 369, column 37, in _crate_impl
                _generate_hub_and_spokes(module_ctx, cargo_bazel, cfg, annotations, cargo_lockfile = cargo_lockfile, manifests = manifests)
        File "/private/var/tmp/_bazel_marvin/2ca8fbba9913b18ada099dc013e74ad8/external/rules_rust+/crate_universe/extension.bzl", line 139, column 16, in _generate_hub_and_spokes
                cargo_bazel([
        File "/private/var/tmp/_bazel_marvin/2ca8fbba9913b18ada099dc013e74ad8/external/rules_rust+/crate_universe/private/module_extensions/cargo_bazel_bootstrap.bzl", line 66, column 17, in run
                fail("%s returned with exit code %d:\n%s" % (pretty_args, result.return_code, result.stderr
                
                /2ca8fbba9913b18ada099dc013e74ad8/external/rules_rust++rust_host_tools+rust_host_tools/bin/rustc returned with exit code 101:
thread 'main' panicked at src/utils.rs:49:22:
Could not rename paths: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ERROR: error evaluating module extension crate in @@rules_rust+//crate_universe:extension.bzl
INFO: Elapsed time: 1.890s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
FAILED: 
    Fetching ... @@rules_rust+//crate_universe:extension.bzl; starting

@tpasternak
Copy link

we're getting the same problem with https://github.com/bazelbuild/intellij - we can't call bazel mod deps "" there because of this bug

@criemen
Copy link
Contributor Author

criemen commented Oct 4, 2024

Fixed by #2908.

@criemen criemen closed this as completed Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants