Search in sources :

Example 6 with TargetPattern

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();
}
Also used : SkyKey(com.google.devtools.build.skyframe.SkyKey) TargetPatternKey(com.google.devtools.build.lib.skyframe.TargetPatternValue.TargetPatternKey) ImmutableSet(com.google.common.collect.ImmutableSet) TargetParsingException(com.google.devtools.build.lib.cmdline.TargetParsingException) TargetPattern(com.google.devtools.build.lib.cmdline.TargetPattern) PathFragment(com.google.devtools.build.lib.vfs.PathFragment) TargetPatternSkyKeyOrException(com.google.devtools.build.lib.skyframe.TargetPatternValue.TargetPatternSkyKeyOrException)

Aggregations

TargetPattern (com.google.devtools.build.lib.cmdline.TargetPattern)6 TargetParsingException (com.google.devtools.build.lib.cmdline.TargetParsingException)5 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)5 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 ThreadSafe (com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe)2 MissingDepException (com.google.devtools.build.lib.skyframe.EnvironmentBackedRecursivePackageProvider.MissingDepException)2 TargetPatternKey (com.google.devtools.build.lib.skyframe.TargetPatternValue.TargetPatternKey)2 SkyKey (com.google.devtools.build.skyframe.SkyKey)2 AsyncFunction (com.google.common.util.concurrent.AsyncFunction)1 Label (com.google.devtools.build.lib.cmdline.Label)1 PackageIdentifier (com.google.devtools.build.lib.cmdline.PackageIdentifier)1 ResolvedTargets (com.google.devtools.build.lib.cmdline.ResolvedTargets)1 Target (com.google.devtools.build.lib.packages.Target)1 QueryException (com.google.devtools.build.lib.query2.engine.QueryException)1 RepositoryDirectoryValue (com.google.devtools.build.lib.rules.repository.RepositoryDirectoryValue)1 TargetPatternSkyKeyOrException (com.google.devtools.build.lib.skyframe.TargetPatternValue.TargetPatternSkyKeyOrException)1 BatchCallback (com.google.devtools.build.lib.util.BatchCallback)1 Path (com.google.devtools.build.lib.vfs.Path)1 RootedPath (com.google.devtools.build.lib.vfs.RootedPath)1