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

Added TemplateVariableInfo to rust_toolchain #1377

Merged
merged 1 commit into from
Jun 9, 2022

Conversation

UebelAndre
Copy link
Collaborator

Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

LGTM - thanks!

@UebelAndre UebelAndre merged commit e765719 into bazelbuild:main Jun 9, 2022
@UebelAndre UebelAndre deleted the toolchain-env branch June 9, 2022 12:58
@uhthomas
Copy link
Contributor

uhthomas commented Jun 14, 2022

I need to use TemplateVariableInfo provider for #1287, but this PR does not return the provider from the implementation function. This means the make variables are not substituted for rules which use the toolchain.

(10:58:10) ERROR: /private/var/tmp/_bazel_thomas/796dd52d4d981101108548a9446ddca6/external/crate_index/BUILD.bazel:11:21: in args attribute of cargo_bazel rule @crate_index//:repin: $(CARGO) not defined. Since this rule was created by the macro 'cargo_bazel_generate', the error might have been caused by the macro implementation

The provider needs to be returned to allow this to work properly. For example:

diff --git a/rust/toolchain.bzl b/rust/toolchain.bzl
index 90dea6e..caa3627 100644
--- a/rust/toolchain.bzl
+++ b/rust/toolchain.bzl
@@ -518,7 +518,7 @@ def _rust_toolchain_impl(ctx):
         _rename_first_party_crates = rename_first_party_crates,
         _third_party_dir = third_party_dir,
     )
-    return [toolchain]
+    return [toolchain, toolchain.make_variables]
 
 rust_toolchain = rule(
     implementation = _rust_toolchain_impl,

I'll open a PR :)

@uhthomas
Copy link
Contributor

See #1412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants