Exemple #1
0
 private final BuildConfigurationCollection getConfigurations(
     BuildOptions buildOptions, Set<String> multiCpu, boolean keepGoing)
     throws InvalidConfigurationException, InterruptedException {
   SkyframeExecutor executor = runtime.getSkyframeExecutor();
   // TODO(bazel-team): consider a possibility of moving ConfigurationFactory construction into
   // skyframe.
   return executor.createConfigurations(
       runtime.getConfigurationFactory(),
       buildOptions,
       runtime.getDirectories(),
       multiCpu,
       keepGoing);
 }
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    workspace = rootDirectory;

    ConfiguredRuleClassProvider ruleClassProvider = TestRuleClassProvider.getRuleClassProvider();
    PathPackageLocator pkgLocator = new PathPackageLocator(rootDirectory);
    final PackageFactory pkgFactory;
    BlazeDirectories directories = new BlazeDirectories(outputBase, outputBase, rootDirectory);
    pkgFactory = new PackageFactory(ruleClassProvider);
    AnalysisTestUtil.DummyWorkspaceStatusActionFactory workspaceStatusActionFactory =
        new AnalysisTestUtil.DummyWorkspaceStatusActionFactory(directories);
    skyframeExecutor =
        SequencedSkyframeExecutor.create(
            reporter,
            pkgFactory,
            new TimestampGranularityMonitor(BlazeClock.instance()),
            directories,
            workspaceStatusActionFactory,
            ruleClassProvider.getBuildInfoFactories(),
            ImmutableSet.<Path>of(),
            ImmutableList.<DiffAwareness.Factory>of(),
            Predicates.<PathFragment>alwaysFalse(),
            Preprocessor.Factory.Supplier.NullSupplier.INSTANCE,
            ImmutableMap.<SkyFunctionName, SkyFunction>of(),
            ImmutableList.<PrecomputedValue.Injected>of(),
            ImmutableList.<SkyValueDirtinessChecker>of());

    skyframeExecutor.preparePackageLoading(
        pkgLocator,
        Options.getDefaults(PackageCacheOptions.class).defaultVisibility,
        true,
        7,
        ruleClassProvider.getDefaultsPackageContent(),
        UUID.randomUUID());

    AnalysisMock analysisMock = getAnalysisMock();
    analysisMock.setupMockClient(new MockToolsConfig(rootDirectory));
    analysisMock.setupMockWorkspaceFiles(directories.getEmbeddedBinariesRoot());
    configurationFactory = analysisMock.createConfigurationFactory();
    buildOptionClasses = analysisMock.getBuildOptions();
  }
  protected BuildConfigurationCollection createCollection(String... args) throws Exception {
    OptionsParser parser =
        OptionsParser.newOptionsParser(
            ImmutableList.<Class<? extends OptionsBase>>builder()
                .addAll(buildOptionClasses)
                .add(TestOptions.class)
                .build());
    parser.parse(args);
    ImmutableSortedSet<String> multiCpu =
        ImmutableSortedSet.copyOf(parser.getOptions(TestOptions.class).multiCpus);

    configurationFactory.forbidSanityCheck();
    BuildOptions buildOptions = BuildOptions.of(buildOptionClasses, parser);
    BuildConfigurationCollection collection =
        skyframeExecutor.createConfigurations(
            configurationFactory,
            buildOptions,
            new BlazeDirectories(outputBase, outputBase, workspace),
            multiCpu,
            false);
    return collection;
  }