diff --git a/java/src/com/google/idea/blaze/java/JavaBlazeRules.java b/java/src/com/google/idea/blaze/java/JavaBlazeRules.java index 1641ce835fe..7c31cb1ff77 100644 --- a/java/src/com/google/idea/blaze/java/JavaBlazeRules.java +++ b/java/src/com/google/idea/blaze/java/JavaBlazeRules.java @@ -33,6 +33,7 @@ public final class JavaBlazeRules implements Kind.Provider { public enum RuleTypes { JAVA_LIBRARY("java_library", LanguageClass.JAVA, RuleType.LIBRARY), JAVA_TEST("java_test", LanguageClass.JAVA, RuleType.TEST), + JAVA_TEST_SUITE("java_test_suite", LanguageClass.JAVA, RuleType.TEST), JAVA_BINARY("java_binary", LanguageClass.JAVA, RuleType.BINARY), JAVA_IMPORT("java_import", LanguageClass.JAVA, RuleType.UNKNOWN), JAVA_TOOLCHAIN("java_toolchain", LanguageClass.JAVA, RuleType.UNKNOWN), diff --git a/java/src/com/google/idea/blaze/java/TargetKindUtil.java b/java/src/com/google/idea/blaze/java/TargetKindUtil.java index e05720280f1..895281e93f4 100644 --- a/java/src/com/google/idea/blaze/java/TargetKindUtil.java +++ b/java/src/com/google/idea/blaze/java/TargetKindUtil.java @@ -32,7 +32,8 @@ public static boolean isAndroidLocalTest(Kind targetKind) { } public static boolean isJavaTest(Kind targetKind) { - return targetKind != null && targetKind.equals(JavaBlazeRules.RuleTypes.JAVA_TEST.getKind()); + return targetKind != null && (targetKind.equals(JavaBlazeRules.RuleTypes.JAVA_TEST.getKind()) || + targetKind.equals(JavaBlazeRules.RuleTypes.JAVA_TEST_SUITE.getKind())); } private TargetKindUtil() {} diff --git a/java/src/com/google/idea/blaze/java/sync/source/JavaLikeLanguage.java b/java/src/com/google/idea/blaze/java/sync/source/JavaLikeLanguage.java index 2042c14bdf9..5e10719c848 100644 --- a/java/src/com/google/idea/blaze/java/sync/source/JavaLikeLanguage.java +++ b/java/src/com/google/idea/blaze/java/sync/source/JavaLikeLanguage.java @@ -97,13 +97,15 @@ public ImmutableSet getFileExtensions() { public ImmutableSet getDebuggableKinds() { return ImmutableSet.of( JavaBlazeRules.RuleTypes.JAVA_BINARY.getKind(), - JavaBlazeRules.RuleTypes.JAVA_TEST.getKind()); + JavaBlazeRules.RuleTypes.JAVA_TEST.getKind(), + JavaBlazeRules.RuleTypes.JAVA_TEST_SUITE.getKind()); } @Override public ImmutableSet getHandledTestKinds() { return ImmutableSet.of( JavaBlazeRules.RuleTypes.JAVA_TEST.getKind(), + JavaBlazeRules.RuleTypes.JAVA_TEST_SUITE.getKind(), JavaBlazeRules.RuleTypes.GWT_TEST.getKind(), JavaBlazeRules.RuleTypes.JAVA_WEB_TEST.getKind()); } diff --git a/java/tests/unittests/com/google/idea/blaze/java/run/BlazeJavaRunProfileStateTest.java b/java/tests/unittests/com/google/idea/blaze/java/run/BlazeJavaRunProfileStateTest.java index 1494a72fe1d..3f8a0d534a2 100644 --- a/java/tests/unittests/com/google/idea/blaze/java/run/BlazeJavaRunProfileStateTest.java +++ b/java/tests/unittests/com/google/idea/blaze/java/run/BlazeJavaRunProfileStateTest.java @@ -190,6 +190,32 @@ public void debugFlagShouldBeIncludedForJavaTest() { "//label:rule")); } + @Test + public void debugFlagShouldBeIncludedForJavaTestSuite() { + configuration.setTargetInfo( + TargetInfo.builder(Label.create("//label:java_test_suite_rule"), "java_test_suite").build()); + BlazeCommandRunConfigurationCommonState handlerState = + (BlazeCommandRunConfigurationCommonState) configuration.getHandler().getState(); + handlerState.getCommandState().setCommand(BlazeCommandName.fromString("test")); + assertThat( + BlazeJavaRunProfileState.getBlazeCommandBuilder( + project, + configuration, + ImmutableList.of(), + ExecutorType.DEBUG, + /*kotlinxCoroutinesJavaAgent=*/ null) + .build() + .toList()) + .isEqualTo( + ImmutableList.of( + "/usr/bin/blaze", + "test", + BlazeFlags.getToolTagFlag(), + "--java_debug", + "--test_arg=--wrapper_script_flag=--debug=5005", + "--", + "//label:java_test_suite_rule")); + } @Test public void debugFlagShouldBeIncludedForJavaBinary() { configuration.setTargetInfo(