Search in sources :

Example 1 with BuildRequestOptions

use of com.google.devtools.build.lib.buildtool.BuildRequest.BuildRequestOptions 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)

Aggregations

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