-
Notifications
You must be signed in to change notification settings - Fork 440
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
Added bzlmod support to core rules_rust #3034
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UebelAndre
force-pushed
the
bzlmod
branch
20 times, most recently
from
December 3, 2024 12:46
1bab266
to
f10686a
Compare
UebelAndre
commented
Dec 3, 2024
@@ -7,15 +7,15 @@ SETLOCAL ENABLEDELAYEDEXPANSION | |||
|
|||
@REM When cargo is detecting the host configuration, the host target needs to be | |||
@REM injected into the command. | |||
echo %*| FINDSTR /C:"rustc.exe - --crate-name ___ " | FINDSTR /V /C:"--target" >NUL | |||
echo %*| FINDSTR /R /C:".*rustc[\.exe\"\"]* - --crate-name ___ " | FINDSTR /V /C:"--target" >NUL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bzlmod introduced the need for quotes in the command line which broke the rustc wrapper on windows.
UebelAndre
force-pushed
the
bzlmod
branch
2 times, most recently
from
December 3, 2024 15:31
f027ebf
to
394d752
Compare
illicitonion
approved these changes
Dec 4, 2024
hauserx
added a commit
to hauserx/rules_rust
that referenced
this pull request
Dec 15, 2024
The cargo_tree_resolver discovers dependencies by executing `cargo tree` for different host and target triples. This procedure breaks when cargo successfully but incorrectly caches rustc info. Incorrect cache hit may happen because cache key does not take into account HOST_TRIPLE env variable used by `rules_rust` to force rustc to report it's built for different host. The caching may happen if one has target/ directory in repo, or it was created through running some commands outside of bazel. Details: After recent fixes to support properly bzlmod (bazelbuild#3034) noticed issues under windows when building bazel-lsp: cameron-martin/bazel-lsp#92 Cargo may cache rustc info in target/.rustc_info.json : https://github.com/rust-lang/cargo/blob/769f622e12db0001431d8ae36d1093fb8727c5d9/src/cargo/util/rustc.rs#L163 The rules_rust hacks rustc by setting HOST_TRIPLE: https://github.com/bazelbuild/rules_rust/blob/3aecdbedba0c001d0660ff631aeccb35d94ff3a7/crate_universe/src/metadata/cargo_tree_resolver.rs#L152 The HOST_TRIPLE env variable is not taken into account by cargo when checking whether cached rustc info is valid: https://github.com/rust-lang/cargo/blob/769f622e12db0001431d8ae36d1093fb8727c5d9/src/cargo/util/rustc.rs#L320
hauserx
added a commit
to hauserx/rules_rust
that referenced
this pull request
Dec 15, 2024
The cargo_tree_resolver discovers dependencies by executing `cargo tree` for different host and target triples. This procedure breaks when cargo successfully but incorrectly caches rustc info. Incorrect cache hit may happen because cache key does not take into account HOST_TRIPLE env variable used by `rules_rust` to force rustc to report it's built for different host. The caching may happen if one has target/ directory in repo, or it was created through running some commands outside of bazel. Details: After recent fixes to support properly bzlmod (bazelbuild#3034) noticed issues under windows when building bazel-lsp: cameron-martin/bazel-lsp#92 Cargo may cache rustc info in target/.rustc_info.json : https://github.com/rust-lang/cargo/blob/769f622e12db0001431d8ae36d1093fb8727c5d9/src/cargo/util/rustc.rs#L163 The rules_rust hacks rustc by setting HOST_TRIPLE: https://github.com/bazelbuild/rules_rust/blob/3aecdbedba0c001d0660ff631aeccb35d94ff3a7/crate_universe/src/metadata/cargo_tree_resolver.rs#L152 The HOST_TRIPLE env variable is not taken into account by cargo when checking whether cached rustc info is valid: https://github.com/rust-lang/cargo/blob/769f622e12db0001431d8ae36d1093fb8727c5d9/src/cargo/util/rustc.rs#L320
hauserx
added a commit
to hauserx/rules_rust
that referenced
this pull request
Dec 16, 2024
The cargo_tree_resolver discovers dependencies by executing `cargo tree` for different host and target triples. This procedure breaks when cargo successfully but incorrectly caches rustc info. Incorrect cache hit may happen because cache key does not take into account HOST_TRIPLE env variable used by `rules_rust` to force rustc to report it's built for different host. The caching may happen if one has target/ directory in repo, or it was created through running some commands outside of bazel. Details: After recent fixes to support properly bzlmod (bazelbuild#3034) noticed issues under windows when building bazel-lsp: cameron-martin/bazel-lsp#92 Cargo may cache rustc info in target/.rustc_info.json : https://github.com/rust-lang/cargo/blob/769f622e12db0001431d8ae36d1093fb8727c5d9/src/cargo/util/rustc.rs#L163 The rules_rust hacks rustc by setting HOST_TRIPLE: https://github.com/bazelbuild/rules_rust/blob/3aecdbedba0c001d0660ff631aeccb35d94ff3a7/crate_universe/src/metadata/cargo_tree_resolver.rs#L152 The HOST_TRIPLE env variable is not taken into account by cargo when checking whether cached rustc info is valid: https://github.com/rust-lang/cargo/blob/769f622e12db0001431d8ae36d1093fb8727c5d9/src/cargo/util/rustc.rs#L320
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 16, 2024
The cargo_tree_resolver discovers dependencies by executing `cargo tree` for different host and target triples. This procedure breaks when cargo successfully but incorrectly caches rustc info. Incorrect cache hit may happen because cache key does not take into account HOST_TRIPLE env variable used by `rules_rust` to force rustc to report it's built for different host. The caching may happen if one has target/ directory in repo, or it was created through running some commands outside of bazel. # Details - After recent fixes to support properly bzlmod (#3034) noticed issues under windows when building bazel-lsp: cameron-martin/bazel-lsp#92 - Cargo may cache rustc info in target/.rustc_info.json : https://github.com/rust-lang/cargo/blob/769f622e12db0001431d8ae36d1093fb8727c5d9/src/cargo/util/rustc.rs#L163 - The rules_rust hacks rustc by setting HOST_TRIPLE: https://github.com/bazelbuild/rules_rust/blob/3aecdbedba0c001d0660ff631aeccb35d94ff3a7/crate_universe/src/metadata/cargo_tree_resolver.rs#L152 - The HOST_TRIPLE env variable is not taken into account by cargo when checking whether cached rustc info is valid: https://github.com/rust-lang/cargo/blob/769f622e12db0001431d8ae36d1093fb8727c5d9/src/cargo/util/rustc.rs#L320
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relates to: