Search in sources :

Example 1 with LoadingPhaseRunner

use of com.google.devtools.build.lib.pkgcache.LoadingPhaseRunner in project bazel by bazelbuild.

the class BuildViewTestCase method update.

protected AnalysisResult update(List<String> targets, List<String> aspects, boolean keepGoing, int loadingPhaseThreads, boolean doAnalysis, EventBus eventBus) throws Exception {
    LoadingOptions loadingOptions = Options.getDefaults(LoadingOptions.class);
    BuildView.Options viewOptions = Options.getDefaults(BuildView.Options.class);
    viewOptions.keepGoing = keepGoing;
    viewOptions.loadingPhaseThreads = loadingPhaseThreads;
    LoadingPhaseRunner runner = new LegacyLoadingPhaseRunner(getPackageManager(), Collections.unmodifiableSet(ruleClassProvider.getRuleClassMap().keySet()));
    LoadingResult loadingResult = runner.execute(reporter, targets, PathFragment.EMPTY_FRAGMENT, loadingOptions, viewOptions.keepGoing, /*determineTests=*/
    false, /*callback=*/
    null);
    if (!doAnalysis) {
        // TODO(bazel-team): What's supposed to happen in this case?
        return null;
    }
    return view.update(loadingResult, masterConfig, aspects, viewOptions, AnalysisTestUtil.TOP_LEVEL_ARTIFACT_CONTEXT, reporter, eventBus);
}
Also used : BuildView(com.google.devtools.build.lib.analysis.BuildView) LoadingResult(com.google.devtools.build.lib.pkgcache.LoadingResult) LoadingPhaseRunner(com.google.devtools.build.lib.pkgcache.LoadingPhaseRunner) LegacyLoadingPhaseRunner(com.google.devtools.build.lib.skyframe.LegacyLoadingPhaseRunner) LegacyLoadingPhaseRunner(com.google.devtools.build.lib.skyframe.LegacyLoadingPhaseRunner) LoadingOptions(com.google.devtools.build.lib.pkgcache.LoadingOptions)

Example 2 with LoadingPhaseRunner

use of com.google.devtools.build.lib.pkgcache.LoadingPhaseRunner in project bazel by bazelbuild.

the class BuildTool method evaluateTargetPatterns.

private final LoadingResult evaluateTargetPatterns(final BuildRequest request, final TargetValidator validator) throws LoadingFailedException, TargetParsingException, InterruptedException {
    Profiler.instance().markPhase(ProfilePhase.LOAD);
    initializeOutputFilter(request);
    final boolean keepGoing = request.getViewOptions().keepGoing;
    LoadingCallback callback = new LoadingCallback() {

        @Override
        public void notifyTargets(Collection<Target> targets) throws LoadingFailedException {
            if (validator != null) {
                validator.validateTargets(targets, keepGoing);
            }
        }
    };
    LoadingPhaseRunner loadingPhaseRunner = env.getSkyframeExecutor().getLoadingPhaseRunner(runtime.getPackageFactory().getRuleClassNames(), request.getLoadingOptions().useSkyframeTargetPatternEvaluator);
    LoadingResult result = loadingPhaseRunner.execute(getReporter(), request.getTargets(), env.getRelativeWorkingDirectory(), request.getLoadingOptions(), keepGoing, request.shouldRunTests(), callback);
    return result;
}
Also used : LoadingCallback(com.google.devtools.build.lib.pkgcache.LoadingCallback) LoadingResult(com.google.devtools.build.lib.pkgcache.LoadingResult) LoadingPhaseRunner(com.google.devtools.build.lib.pkgcache.LoadingPhaseRunner) BuildConfigurationCollection(com.google.devtools.build.lib.analysis.config.BuildConfigurationCollection) Collection(java.util.Collection) EnvironmentCollection(com.google.devtools.build.lib.analysis.constraints.EnvironmentCollection)

Aggregations

LoadingPhaseRunner (com.google.devtools.build.lib.pkgcache.LoadingPhaseRunner)2 LoadingResult (com.google.devtools.build.lib.pkgcache.LoadingResult)2 BuildView (com.google.devtools.build.lib.analysis.BuildView)1 BuildConfigurationCollection (com.google.devtools.build.lib.analysis.config.BuildConfigurationCollection)1 EnvironmentCollection (com.google.devtools.build.lib.analysis.constraints.EnvironmentCollection)1 LoadingCallback (com.google.devtools.build.lib.pkgcache.LoadingCallback)1 LoadingOptions (com.google.devtools.build.lib.pkgcache.LoadingOptions)1 LegacyLoadingPhaseRunner (com.google.devtools.build.lib.skyframe.LegacyLoadingPhaseRunner)1 Collection (java.util.Collection)1