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;
}
Aggregations