use of com.google.devtools.common.options.OptionsParser in project bazel by bazelbuild.
the class OptionsUtilsTest method asStringOfExplicitOptionsCorrectSortingByPriority.
@Test
public void asStringOfExplicitOptionsCorrectSortingByPriority() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(IntrospectionExample.class);
parser.parse(OptionPriority.COMMAND_LINE, null, Arrays.asList("--alpha=no"));
parser.parse(OptionPriority.COMPUTED_DEFAULT, null, Arrays.asList("--beta=no"));
assertEquals("--beta=no --alpha=no", OptionsUtils.asShellEscapedString(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));
}
use of com.google.devtools.common.options.OptionsParser in project bazel by bazelbuild.
the class BlazeServerStartupOptionsTest method testOutputBaseIsNullByDefault.
// A regression test to make sure that the output_base option is correctly parsed if no explicit
// value is provided.
@Test
public void testOutputBaseIsNullByDefault() throws Exception {
OptionsParser parser = OptionsParser.newOptionsParser(BlazeServerStartupOptions.class);
parser.parse();
BlazeServerStartupOptions result = parser.getOptions(BlazeServerStartupOptions.class);
assertNull(result.outputBase);
}
Aggregations