Skip to content

Commit

Permalink
Add check for $experimental_testsupport in isExperimentalJavaTest.
Browse files Browse the repository at this point in the history
This should be a no-op because because before testsupport is set (https://github.com/bazelbuild/bazel/blob/3d362fb9a122ceee6d781be127dfedbbff8051f8/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java#L509), it's checking that main_class is pointing to the experimental testrunner.

This is needed because android_local_test doesn't have a main_class attribute and then bazel breaks when it tries to get the main_class attribute.

RELNOTES: None
PiperOrigin-RevId: 178964286
  • Loading branch information
dkelmer authored and Copybara-Service committed Dec 13, 2017
1 parent 817b535 commit c6557ea
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ private String getMainClassFromRule(RuleContext ruleContext) {
}

private boolean isExperimentalJavaTest(RuleContext ruleContext) {
return TargetUtils.isTestRule(ruleContext.getRule())
return ruleContext.attributes().has("$experimental_testsupport")
&& TargetUtils.isTestRule(ruleContext.getRule())
&& getMainClassFromRule(ruleContext).equals(EXPERIMENTAL_TEST_RUNNER_MAIN_CLASS);
}

Expand Down

0 comments on commit c6557ea

Please sign in to comment.