Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support gutter icons in java_test_suite #5579

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions java/src/com/google/idea/blaze/java/JavaBlazeRules.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion java/src/com/google/idea/blaze/java/TargetKindUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ public ImmutableSet<String> getFileExtensions() {
public ImmutableSet<Kind> 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<Kind> 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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading