Skip to content

Commit

Permalink
Ignore empty symlinks depsets in ctx.runfiles()
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 518828183
Change-Id: I9929392d22329e5e1eedc09466462b3b3989e218
  • Loading branch information
hvadehra authored and copybara-github committed Mar 23, 2023
1 parent cb55c5b commit 144ad7b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ public Runfiles runfiles(
}
builder.addTransitiveArtifacts(transitiveArtifacts);
}
if (isDepset(symlinks)) {
if (isNonEmptyDepset(symlinks)) {
// If Starlark code directly manipulates symlinks, activate more stringent validity checking.
checkConflicts = true;
builder.addSymlinks(((Depset) symlinks).getSet(SymlinkEntry.class));
Expand All @@ -1029,7 +1029,7 @@ public Runfiles runfiles(
builder.addSymlink(PathFragment.create(entry.getKey()), entry.getValue());
}
}
if (isDepset(rootSymlinks)) {
if (isNonEmptyDepset(rootSymlinks)) {
checkConflicts = true;
builder.addRootSymlinks(((Depset) rootSymlinks).getSet(SymlinkEntry.class));
} else if (isNonEmptyDict(rootSymlinks)) {
Expand All @@ -1050,8 +1050,8 @@ private static boolean isNonEmptyDict(Object o) {
return o instanceof Dict && !((Dict<?, ?>) o).isEmpty();
}

private static boolean isDepset(Object o) {
return o instanceof Depset;
private static boolean isNonEmptyDepset(Object o) {
return o instanceof Depset && !((Depset) o).isEmpty();
}

@Override
Expand Down

0 comments on commit 144ad7b

Please sign in to comment.