-
Notifications
You must be signed in to change notification settings - Fork 444
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
Conversation
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.
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() |
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.
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?
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.
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.
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.
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
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.
I agree, that makes sense. Would you mind taking another look?
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.
Looks good to me, Thank you!
Fixes #1277