Search in sources :

Example 1 with ErrorSensingEventHandler

use of com.google.devtools.build.lib.events.ErrorSensingEventHandler in project bazel by bazelbuild.

the class ConfigurationCollectionFunction method createConfiguration.

@Nullable
private BuildConfiguration createConfiguration(Cache<String, BuildConfiguration> cache, ExtendedEventHandler originalEventListener, PackageProviderForConfigurations loadedPackageProvider, BuildOptions buildOptions, String cpuOverride) throws InvalidConfigurationException, InterruptedException {
    ErrorSensingEventHandler eventHandler = new ErrorSensingEventHandler(originalEventListener);
    if (cpuOverride != null) {
        // TODO(bazel-team): Options classes should be immutable. This is a bit of a hack.
        buildOptions = buildOptions.clone();
        buildOptions.get(BuildConfiguration.Options.class).cpu = cpuOverride;
        buildOptions.get(BuildConfiguration.Options.class).experimentalMultiCpuDistinguisher = cpuOverride;
    }
    BuildConfiguration targetConfig = configurationFactory.get().createConfigurations(cache, loadedPackageProvider, buildOptions, eventHandler);
    if (targetConfig == null) {
        return null;
    }
    // --keep_going. If so, we throw an error here.
    if (eventHandler.hasErrors()) {
        throw new InvalidConfigurationException("Build options are invalid");
    }
    return targetConfig;
}
Also used : BuildConfiguration(com.google.devtools.build.lib.analysis.config.BuildConfiguration) ErrorSensingEventHandler(com.google.devtools.build.lib.events.ErrorSensingEventHandler) InvalidConfigurationException(com.google.devtools.build.lib.analysis.config.InvalidConfigurationException) Nullable(javax.annotation.Nullable)

Aggregations

BuildConfiguration (com.google.devtools.build.lib.analysis.config.BuildConfiguration)1 InvalidConfigurationException (com.google.devtools.build.lib.analysis.config.InvalidConfigurationException)1 ErrorSensingEventHandler (com.google.devtools.build.lib.events.ErrorSensingEventHandler)1 Nullable (javax.annotation.Nullable)1