Search in sources :

Example 1 with RecursivePackageProviderBackedTargetPatternResolver

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

the class SkyQueryEnvironment method beforeEvaluateQuery.

private void beforeEvaluateQuery() throws InterruptedException {
    if (graph == null || !graphFactory.isUpToDate(universeKey)) {
        // If this environment is uninitialized or the graph factory needs to evaluate, do so. We
        // assume here that this environment cannot be initialized-but-stale if the factory is up
        // to date.
        EvaluationResult<SkyValue> result;
        try (AutoProfiler p = AutoProfiler.logged("evaluation and walkable graph", LOG)) {
            result = graphFactory.prepareAndGet(universeKey, loadingPhaseThreads, universeEvalEventHandler);
        }
        checkEvaluationResult(result);
        packageSemaphore = makeFreshPackageMultisetSemaphore();
        graph = result.getWalkableGraph();
        blacklistPatternsSupplier = InterruptibleSupplier.Memoize.of(new BlacklistSupplier(graph));
        graphBackedRecursivePackageProvider = new GraphBackedRecursivePackageProvider(graph, universeTargetPatternKeys, pkgPath);
    }
    if (executor == null) {
        executor = MoreExecutors.listeningDecorator(new ThreadPoolExecutor(/*corePoolSize=*/
        queryEvaluationParallelismLevel, /*maximumPoolSize=*/
        queryEvaluationParallelismLevel, /*keepAliveTime=*/
        1, /*units=*/
        TimeUnit.SECONDS, /*workQueue=*/
        new BlockingStack<Runnable>(), new ThreadFactoryBuilder().setNameFormat("QueryEnvironment %d").build()));
    }
    resolver = new RecursivePackageProviderBackedTargetPatternResolver(graphBackedRecursivePackageProvider, eventHandler, TargetPatternEvaluator.DEFAULT_FILTERING_POLICY, packageSemaphore);
}
Also used : SkyValue(com.google.devtools.build.skyframe.SkyValue) RecursivePackageProviderBackedTargetPatternResolver(com.google.devtools.build.lib.skyframe.RecursivePackageProviderBackedTargetPatternResolver) GraphBackedRecursivePackageProvider(com.google.devtools.build.lib.skyframe.GraphBackedRecursivePackageProvider) AutoProfiler(com.google.devtools.build.lib.profiler.AutoProfiler) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Aggregations

ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 AutoProfiler (com.google.devtools.build.lib.profiler.AutoProfiler)1 GraphBackedRecursivePackageProvider (com.google.devtools.build.lib.skyframe.GraphBackedRecursivePackageProvider)1 RecursivePackageProviderBackedTargetPatternResolver (com.google.devtools.build.lib.skyframe.RecursivePackageProviderBackedTargetPatternResolver)1 SkyValue (com.google.devtools.build.skyframe.SkyValue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1