Skip to content

Commit

Permalink
Don't leak additive build file content across crates (#1278)
Browse files Browse the repository at this point in the history
uhthomas authored Apr 20, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 965044a commit 4fb6e40
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions crate_universe/private/generate_utils.bzl
Original file line number Diff line number Diff line change
@@ -205,16 +205,14 @@ def generate_config(repository_ctx):
annotations = collect_crate_annotations(repository_ctx.attr.annotations, repository_ctx.name)

# Load additive build files if any have been provided.
content = list()
for data in annotations.values():
additive_build_file_content = data.pop("additive_build_file_content", None)
if additive_build_file_content:
content.append(additive_build_file_content)
additive_build_file = data.pop("additive_build_file", None)
if additive_build_file:
file_path = repository_ctx.path(Label(additive_build_file))
content.append(repository_ctx.read(file_path))
data.update({"additive_build_file_content": "\n".join(content) if content else None})
f = data.pop("additive_build_file", None)
content = [x for x in [
data.pop("additive_build_file_content", None),
repository_ctx.read(Label(f)) if f else None,
] if x]
if content:
data.update({"additive_build_file_content": "\n".join(content)})

config = struct(
generate_build_scripts = repository_ctx.attr.generate_build_scripts,

0 comments on commit 4fb6e40

Please sign in to comment.