Search in sources :

Example 1 with PrepareDepsOfTargetsUnderDirectoryKey

use of com.google.devtools.build.lib.skyframe.PrepareDepsOfTargetsUnderDirectoryValue.PrepareDepsOfTargetsUnderDirectoryKey in project bazel by bazelbuild.

the class PrepareDepsOfTargetsUnderDirectoryFunction method compute.

@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
    PrepareDepsOfTargetsUnderDirectoryKey argument = (PrepareDepsOfTargetsUnderDirectoryKey) skyKey.argument();
    final FilteringPolicy filteringPolicy = argument.getFilteringPolicy();
    RecursivePkgKey recursivePkgKey = argument.getRecursivePkgKey();
    ProcessPackageDirectory processPackageDirectory = new ProcessPackageDirectory(directories, new ProcessPackageDirectory.SkyKeyTransformer() {

        @Override
        public SkyKey makeSkyKey(RepositoryName repository, RootedPath subdirectory, ImmutableSet<PathFragment> excludedSubdirectoriesBeneathSubdirectory) {
            return PrepareDepsOfTargetsUnderDirectoryValue.key(repository, subdirectory, excludedSubdirectoriesBeneathSubdirectory, filteringPolicy);
        }
    });
    ProcessPackageDirectoryResult packageExistenceAndSubdirDeps = processPackageDirectory.getPackageExistenceAndSubdirDeps(recursivePkgKey.getRootedPath(), recursivePkgKey.getRepository(), env, recursivePkgKey.getExcludedPaths());
    if (env.valuesMissing()) {
        return null;
    }
    Iterable<SkyKey> keysToRequest = packageExistenceAndSubdirDeps.getChildDeps();
    if (packageExistenceAndSubdirDeps.packageExists()) {
        keysToRequest = Iterables.concat(ImmutableList.of(CollectTargetsInPackageValue.key(PackageIdentifier.create(recursivePkgKey.getRepository(), recursivePkgKey.getRootedPath().getRelativePath()), filteringPolicy)), keysToRequest);
    }
    env.getValuesOrThrow(keysToRequest, NoSuchPackageException.class);
    if (env.valuesMissing()) {
        return null;
    }
    return PrepareDepsOfTargetsUnderDirectoryValue.INSTANCE;
}
Also used : SkyKey(com.google.devtools.build.skyframe.SkyKey) RecursivePkgKey(com.google.devtools.build.lib.skyframe.RecursivePkgValue.RecursivePkgKey) PathFragment(com.google.devtools.build.lib.vfs.PathFragment) RepositoryName(com.google.devtools.build.lib.cmdline.RepositoryName) PrepareDepsOfTargetsUnderDirectoryKey(com.google.devtools.build.lib.skyframe.PrepareDepsOfTargetsUnderDirectoryValue.PrepareDepsOfTargetsUnderDirectoryKey) FilteringPolicy(com.google.devtools.build.lib.pkgcache.FilteringPolicy) RootedPath(com.google.devtools.build.lib.vfs.RootedPath)

Aggregations

RepositoryName (com.google.devtools.build.lib.cmdline.RepositoryName)1 FilteringPolicy (com.google.devtools.build.lib.pkgcache.FilteringPolicy)1 PrepareDepsOfTargetsUnderDirectoryKey (com.google.devtools.build.lib.skyframe.PrepareDepsOfTargetsUnderDirectoryValue.PrepareDepsOfTargetsUnderDirectoryKey)1 RecursivePkgKey (com.google.devtools.build.lib.skyframe.RecursivePkgValue.RecursivePkgKey)1 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)1 RootedPath (com.google.devtools.build.lib.vfs.RootedPath)1 SkyKey (com.google.devtools.build.skyframe.SkyKey)1