Skip to content

Commit

Permalink
Don't leak additive build file content across crates
Browse files Browse the repository at this point in the history
  • Loading branch information
uhthomas committed Apr 20, 2022
1 parent 965044a commit 63abadf
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
Expand Up @@ -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,
Expand Down

0 comments on commit 63abadf

Please sign in to comment.