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

Add incompatible_make_rust_providers_target_independent flag #967

Merged
merged 10 commits into from
Oct 12, 2021

Conversation

scentini
Copy link
Collaborator

This flag guards the incompatible changes needed in order to be able to compile files in aspects. For more information see #966.

@google-cla google-cla bot added the cla: yes label Oct 12, 2021
@hlopko hlopko self-requested a review October 12, 2021 11:57
Copy link
Member

@hlopko hlopko left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@@ -339,3 +340,11 @@ def is_exec_configuration(ctx):

# TODO(djmarcin): Is there any better way to determine cfg=exec?
return ctx.genfiles_dir.path.find("-exec-") == -1

def transform_deps(deps, make_rust_providers_target_independent):
Copy link
Member

Choose a reason for hiding this comment

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

Once we flip the flag this function may be removed, could you document that in the stardoc, potentially adding a todo referencing the issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@@ -229,6 +230,8 @@ def _rust_toolchain_impl(ctx):
if ctx.attr.target_triple and ctx.file.target_json:
fail("Do not specify both target_triple and target_json, either use a builtin triple or provide a custom specification file.")

make_rust_providers_target_independent = getattr(ctx.attr, "_incompatible_make_rust_providers_target_independent")[IncompatibleFlagInfo]
Copy link
Member

Choose a reason for hiding this comment

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

If you're certain that the current rule has the attribute, (therefore you don't need to provide the default value when attr is missing) you don't have to use the getattr

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@scentini scentini merged commit 4efefd6 into bazelbuild:main Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants