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

Don't leak additive build file content across crates #1278

Merged
merged 1 commit into from
Apr 20, 2022

Conversation

uhthomas
Copy link
Contributor

Fixes #1277

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

One nit but otherwise looks good! Thanks!

content = "\n".join([
data.pop("additive_build_file_content", None) or "",
repository_ctx.read(Label(f)) if f else "",
]).strip()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this content is generally rendered at the bottom of a file, could we avoid the strip so we don't strip the final newline?

Copy link
Contributor Author

@uhthomas uhthomas Apr 20, 2022

Choose a reason for hiding this comment

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

Hmm, good point. The strip is there to prevent the content from being just \n, as well as keeping the source a bit cleaner. Would it make sense to explicitly add a newline in addition to stripping? Since there is no guarantee of a newline from repository_ctx.read anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I lean toward the more hands off approach where we just render what users told us. That way folks who care about newlines have the power to fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, that makes sense. Would you mind taking another look?

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Looks good to me, Thank you!

@UebelAndre UebelAndre merged commit 4fb6e40 into bazelbuild:main Apr 20, 2022
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.

crate_universe: additive_build_file annotations merged into wrong files (stacked)
2 participants