use of com.google.devtools.build.lib.cmdline.TargetPattern in project bazel by bazelbuild.
the class PrepareDepsOfPatternValue method excludedDirectoriesBeneath.
private static ImmutableSet<PathFragment> excludedDirectoriesBeneath(TargetPatternKey targetPatternKey, int position, List<TargetPatternSkyKeyOrException> keysMaybe) {
ImmutableSet.Builder<PathFragment> excludedDirectoriesBuilder = ImmutableSet.builder();
for (int j = position + 1; j < keysMaybe.size(); j++) {
TargetPatternSkyKeyOrException laterPatternMaybe = keysMaybe.get(j);
SkyKey laterSkyKey;
try {
laterSkyKey = laterPatternMaybe.getSkyKey();
} catch (TargetParsingException ignored) {
laterSkyKey = null;
}
if (laterSkyKey != null) {
TargetPatternKey laterTargetPatternKey = (TargetPatternKey) laterSkyKey.argument();
TargetPattern laterParsedPattern = laterTargetPatternKey.getParsedPattern();
if (laterTargetPatternKey.isNegative() && laterParsedPattern.getType() == Type.TARGETS_BELOW_DIRECTORY && targetPatternKey.getParsedPattern().containsDirectoryOfTBDForTBD(laterParsedPattern)) {
excludedDirectoriesBuilder.add(laterParsedPattern.getDirectoryForTargetsUnderDirectory().getPackageFragment());
}
}
}
return excludedDirectoriesBuilder.build();
}
Aggregations