use of com.google.idea.blaze.base.run.state.BlazeCommandRunConfigurationCommonState in project intellij by bazelbuild.
the class BlazeFilterExistingRunConfigurationProducer method doIsConfigFromContext.
@Override
protected boolean doIsConfigFromContext(BlazeCommandRunConfiguration configuration, ConfigurationContext context) {
Optional<String> testFilter = getTestFilter(context);
if (!testFilter.isPresent()) {
return false;
}
BlazeCommandRunConfigurationCommonState handlerState = configuration.getHandlerStateIfType(BlazeCommandRunConfigurationCommonState.class);
return handlerState != null && Objects.equals(handlerState.getCommandState().getCommand(), BlazeCommandName.TEST) && Objects.equals(testFilter.get(), handlerState.getTestFilterFlag());
}
use of com.google.idea.blaze.base.run.state.BlazeCommandRunConfigurationCommonState in project intellij by bazelbuild.
the class RunConfigurationSerializerTest method setBlazeBinaryPath.
private static void setBlazeBinaryPath(BlazeCommandRunConfiguration configuration, String path) {
BlazeCommandRunConfigurationCommonState state = configuration.getHandlerStateIfType(BlazeCommandRunConfigurationCommonState.class);
state.getBlazeBinaryState().setBlazeBinary(path);
}
use of com.google.idea.blaze.base.run.state.BlazeCommandRunConfigurationCommonState in project intellij by bazelbuild.
the class BlazeBuildFileRunConfigurationProducerTest method testConfigWithTestFilterIgnored.
@Test
public void testConfigWithTestFilterIgnored() {
PsiFile buildFile = workspace.createPsiFile(new WorkspacePath("java/com/google/test/BUILD"), "java_test(name='unit_tests'");
StringLiteral nameString = PsiUtils.findFirstChildOfClassRecursive(buildFile, StringLiteral.class);
ConfigurationContext context = createContextFromPsi(nameString);
BlazeCommandRunConfiguration config = (BlazeCommandRunConfiguration) context.getConfiguration().getConfiguration();
BlazeCommandRunConfigurationCommonState handlerState = config.getHandlerStateIfType(BlazeCommandRunConfigurationCommonState.class);
handlerState.getBlazeFlagsState().setRawFlags(ImmutableList.of(BlazeFlags.TEST_FILTER + "=com.google.test.SingleTestClass#"));
assertThat(new BlazeBuildFileRunConfigurationProducer().isConfigurationFromContext(config, context)).isFalse();
}
use of com.google.idea.blaze.base.run.state.BlazeCommandRunConfigurationCommonState in project intellij by bazelbuild.
the class BlazeJavaRunProfileStateTest method debugFlagShouldBeIncludedForJavaTest.
@Test
public void debugFlagShouldBeIncludedForJavaTest() {
configuration.setTargetInfo(TargetInfo.builder(Label.create("//label:rule"), "java_test").build());
BlazeCommandRunConfigurationCommonState handlerState = (BlazeCommandRunConfigurationCommonState) configuration.getHandler().getState();
handlerState.getCommandState().setCommand(BlazeCommandName.fromString("command"));
assertThat(BlazeJavaRunProfileState.getBlazeCommandBuilder(project, configuration, ImmutableList.of(), ExecutorType.DEBUG).build().toList()).isEqualTo(ImmutableList.of("/usr/bin/blaze", "command", BlazeFlags.getToolTagFlag(), "--java_debug", "--test_arg=--wrapper_script_flag=--debug=5005", "--", "//label:rule"));
}
use of com.google.idea.blaze.base.run.state.BlazeCommandRunConfigurationCommonState in project intellij by bazelbuild.
the class BlazeJavaRunProfileStateTest method debugFlagShouldBeIncludedForJavaBinary.
@Test
public void debugFlagShouldBeIncludedForJavaBinary() {
configuration.setTargetInfo(TargetInfo.builder(Label.create("//label:java_binary_rule"), "java_binary").build());
BlazeCommandRunConfigurationCommonState handlerState = (BlazeCommandRunConfigurationCommonState) configuration.getHandler().getState();
handlerState.getCommandState().setCommand(BlazeCommandName.fromString("command"));
assertThat(BlazeJavaRunProfileState.getBlazeCommandBuilder(project, configuration, ImmutableList.of(), ExecutorType.DEBUG).build().toList()).isEqualTo(ImmutableList.of("/usr/bin/blaze", "command", BlazeFlags.getToolTagFlag(), "--", "//label:java_binary_rule", "--wrapper_script_flag=--debug=5005"));
}
Aggregations