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

Fix toolchain repo aliases and add a test. #3181

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ tasks:
working_directory: test/aliased_toolchains
build_targets:
- "@rust_toolchains//:all"
- "//..."
android_examples_ubuntu2004:
name: Android Examples
platform: ubuntu2004
Expand Down
2 changes: 1 addition & 1 deletion rust/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def rust_register_toolchains(
sha256s = sha256s,
urls = urls,
versions = versions,
aliases = aliases,
aliases = dict(aliases),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is this fixing?

Copy link
Contributor Author

@sputt sputt Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I originally implemented this feature, I added a check that when you aliased a repository that repository existed. I did it by removing entries from this dict as they were consumed.

It worked for the check, but it emptied the dict for when we actually make the repos below. Unfortunately I thought bringing the repo into scope with use_repo in the test was sufficient, but actually we needed to use the repo in the build for it to be fetched.

)

for toolchain in _get_toolchain_repositories(
Expand Down
6 changes: 6 additions & 0 deletions test/aliased_toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("@rules_rust//rust:defs.bzl", "rust_library")

rust_library(
name = "hello",
srcs = ["hello.rs"],
)
1 change: 1 addition & 0 deletions test/aliased_toolchains/hello.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub fn hello() {}
2 changes: 1 addition & 1 deletion test/empty_suite/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load("@rules_shell//shell:sh_test.bzl", "sh_test")
load("//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite")

# This package has a rust_test_suite containing no tests.
# (This could happen if the srcs were seleceted via a glob).
# (This could happen if the srcs were selected via a glob).
#
# We test that the test suite exists and is empty, bypassing test_suite's
# special-case behavior for empty suites.
Expand Down
Loading