use of com.google.devtools.common.options.OptionsParser in project bazel by bazelbuild.
the class BuildViewTestCase method parsePackageCacheOptions.
private PackageCacheOptions parsePackageCacheOptions(String... options) throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(PackageCacheOptions.class);
parser.parse("--default_visibility=public");
parser.parse(options);
return parser.getOptions(PackageCacheOptions.class);
}
use of com.google.devtools.common.options.OptionsParser in project bazel by bazelbuild.
the class DefaultsPackageUtil method getDefaultsPackageForOptions.
public static String getDefaultsPackageForOptions(Class<? extends FragmentOptions> optionsClass, String... options) throws OptionsParsingException {
OptionsParser parser = OptionsParser.newOptionsParser(ImmutableList.<Class<? extends OptionsBase>>of(BuildConfiguration.Options.class, optionsClass));
parser.parse(options);
InvocationPolicyEnforcer enforcer = AnalysisMock.get().getInvocationPolicyEnforcer();
enforcer.enforce(parser);
return DefaultsPackage.getDefaultsPackageContent(BuildOptions.of(ImmutableList.<Class<? extends FragmentOptions>>of(BuildConfiguration.Options.class, optionsClass), parser));
}
use of com.google.devtools.common.options.OptionsParser in project bazel by bazelbuild.
the class BlazeExecutorTest method testDebugPrintActionContexts.
@Test
public void testDebugPrintActionContexts() throws Exception {
TestExecutorBuilder builder = new TestExecutorBuilder(directories, binTools);
OptionsParser parser = OptionsParser.newOptionsParser(TestExecutorBuilder.DEFAULT_OPTIONS);
parser.parse("--debug_print_action_contexts");
Reporter reporter = new Reporter(new EventBus());
StoredEventHandler storedEventHandler = new StoredEventHandler();
reporter.addHandler(storedEventHandler);
SpawnActionContext mockStrategy = Mockito.mock(SpawnActionContext.class);
builder.setReporter(reporter).setOptionsParser(parser).setExecution("mock", mockStrategy);
builder.build();
Event event = Iterables.find(storedEventHandler.getEvents(), new Predicate<Event>() {
@Override
public boolean apply(@Nullable Event event) {
return event.getMessage().contains("SpawnActionContextMap: \"mock\" = ");
}
});
assertThat(event).isNotNull();
assertThat(event.getMessage()).contains("\"mock\" = " + mockStrategy.getClass().getSimpleName());
}
use of com.google.devtools.common.options.OptionsParser in project bazel by bazelbuild.
the class PackageLoadingTestCase method parsePackageCacheOptions.
private PackageCacheOptions parsePackageCacheOptions(String... options) throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(PackageCacheOptions.class);
parser.parse(new String[] { "--default_visibility=public" });
parser.parse(options);
return parser.getOptions(PackageCacheOptions.class);
}
use of com.google.devtools.common.options.OptionsParser in project bazel by bazelbuild.
the class CrosstoolConfigurationLoaderTest method createBuildOptionsForTest.
private BuildOptions createBuildOptionsForTest(String... args) {
ImmutableList<Class<? extends FragmentOptions>> testFragments = TestRuleClassProvider.getRuleClassProvider().getConfigurationOptions();
OptionsParser optionsParser = OptionsParser.newOptionsParser(testFragments);
try {
optionsParser.parse(args);
InvocationPolicyEnforcer optionsPolicyEnforcer = analysisMock.getInvocationPolicyEnforcer();
optionsPolicyEnforcer.enforce(optionsParser);
} catch (OptionsParsingException e) {
throw new IllegalStateException(e);
}
return BuildOptions.applyStaticConfigOverride(BuildOptions.of(testFragments, optionsParser));
}
Aggregations