Search in sources :

Example 1 with LoadingOptions

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

the class AnalysisTestCase method update.

/**
   * Update the BuildView: syncs the package cache; loads and analyzes the given labels.
   */
protected AnalysisResult update(EventBus eventBus, FlagBuilder config, ImmutableList<String> aspects, String... labels) throws Exception {
    Set<Flag> flags = config.flags;
    LoadingOptions loadingOptions = Options.getDefaults(LoadingOptions.class);
    BuildView.Options viewOptions = optionsParser.getOptions(BuildView.Options.class);
    viewOptions.keepGoing = flags.contains(Flag.KEEP_GOING);
    viewOptions.loadingPhaseThreads = LOADING_PHASE_THREADS;
    BuildOptions buildOptions = ruleClassProvider.createBuildOptions(optionsParser);
    PackageCacheOptions packageCacheOptions = optionsParser.getOptions(PackageCacheOptions.class);
    PathPackageLocator pathPackageLocator = PathPackageLocator.create(outputBase, packageCacheOptions.packagePath, reporter, rootDirectory, rootDirectory);
    packageCacheOptions.showLoadingProgress = true;
    packageCacheOptions.globbingThreads = 7;
    skyframeExecutor.preparePackageLoading(pathPackageLocator, packageCacheOptions, ruleClassProvider.getDefaultsPackageContent(analysisMock.getInvocationPolicyEnforcer().getInvocationPolicy()), UUID.randomUUID(), ImmutableMap.<String, String>of(), ImmutableMap.<String, String>of(), new TimestampGranularityMonitor(BlazeClock.instance()));
    skyframeExecutor.invalidateFilesUnderPathForTesting(reporter, ModifiedFileSet.EVERYTHING_MODIFIED, rootDirectory);
    LoadingResult loadingResult = loadingPhaseRunner.execute(reporter, ImmutableList.copyOf(labels), PathFragment.EMPTY_FRAGMENT, loadingOptions, viewOptions.keepGoing, /*determineTests=*/
    false, /*callback=*/
    null);
    BuildRequestOptions requestOptions = optionsParser.getOptions(BuildRequestOptions.class);
    ImmutableSortedSet<String> multiCpu = ImmutableSortedSet.copyOf(requestOptions.multiCpus);
    masterConfig = skyframeExecutor.createConfigurations(reporter, configurationFactory, buildOptions, multiCpu, false);
    analysisResult = buildView.update(loadingResult, masterConfig, aspects, viewOptions, AnalysisTestUtil.TOP_LEVEL_ARTIFACT_CONTEXT, reporter, eventBus);
    return analysisResult;
}
Also used : BuildView(com.google.devtools.build.lib.analysis.BuildView) PackageCacheOptions(com.google.devtools.build.lib.pkgcache.PackageCacheOptions) LoadingOptions(com.google.devtools.build.lib.pkgcache.LoadingOptions) PathPackageLocator(com.google.devtools.build.lib.pkgcache.PathPackageLocator) LoadingResult(com.google.devtools.build.lib.pkgcache.LoadingResult) BuildRequestOptions(com.google.devtools.build.lib.buildtool.BuildRequest.BuildRequestOptions) BuildOptions(com.google.devtools.build.lib.analysis.config.BuildOptions) TimestampGranularityMonitor(com.google.devtools.build.lib.util.io.TimestampGranularityMonitor)

Example 2 with LoadingOptions

use of com.google.devtools.build.lib.pkgcache.LoadingOptions 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)

Aggregations

BuildView (com.google.devtools.build.lib.analysis.BuildView)2 LoadingOptions (com.google.devtools.build.lib.pkgcache.LoadingOptions)2 LoadingResult (com.google.devtools.build.lib.pkgcache.LoadingResult)2 BuildOptions (com.google.devtools.build.lib.analysis.config.BuildOptions)1 BuildRequestOptions (com.google.devtools.build.lib.buildtool.BuildRequest.BuildRequestOptions)1 LoadingPhaseRunner (com.google.devtools.build.lib.pkgcache.LoadingPhaseRunner)1 PackageCacheOptions (com.google.devtools.build.lib.pkgcache.PackageCacheOptions)1 PathPackageLocator (com.google.devtools.build.lib.pkgcache.PathPackageLocator)1 LegacyLoadingPhaseRunner (com.google.devtools.build.lib.skyframe.LegacyLoadingPhaseRunner)1 TimestampGranularityMonitor (com.google.devtools.build.lib.util.io.TimestampGranularityMonitor)1