Skip to content

Commit

Permalink
Restore Target Uniqueness Guard in dependency_tree_parser.bzl (#1122)
Browse files Browse the repository at this point in the history
I noticed the refactor of `dependency_tree_parser.bzl` in
#994 might have
unintentionally omitted a line that added target labels to the set of
`seen_imports`. This line is present in
[v5.3](https://github.com/bazelbuild/rules_jvm_external/blob/5.3/private/dependency_tree_parser.bzl#L155-L156),
but then removed in
[v6.1](https://github.com/bazelbuild/rules_jvm_external/blob/6.1/private/dependency_tree_parser.bzl#L457).

I believe this removal was accidental, as it is now possible for
`maven_install` to create a generated BUILD file which contains
multiple copies of a target with the same name, which is an invalid
state.

This PR restores the missing call to `seen_imports[target_label] = True`.
  • Loading branch information
jonshea authored May 3, 2024
1 parent 7b0abdc commit e8efc03
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions private/dependency_tree_parser.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def _generate_imports(repository_ctx, dependencies, explicit_artifacts, neverlin
))

elif artifact_path != None:
seen_imports[target_label] = True
all_imports.extend(_generate_target(
repository_ctx,
jar_versionless_target_labels,
Expand Down

0 comments on commit e8efc03

Please sign in to comment.