Skip to content

Commit

Permalink
Rename method and a note for clarity
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 578091628
Change-Id: I903990daf594a511e9a38593a1ad5a0ae9a66db2
  • Loading branch information
hvadehra authored and copybara-github committed Oct 31, 2023
1 parent 6191a70 commit 062d969
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ private static Artifact getStubDex(
return null;
}

if (!JavaInfo.isJavaTarget(dep)) {
if (!JavaInfo.isJavaLibraryesqueTarget(dep)) {
ruleContext.attributeError(attribute, "'" + dep.getLabel() + "' should be a Java target");
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ public final class JavaInfo extends NativeInfo

public static final JavaInfoProvider PROVIDER = new JavaInfoProvider();

public static boolean isJavaTarget(TransitiveInfoCollection target) throws RuleErrorException {
// Ideally we would check if the target has a JavaInfo, but this check predates the Starlark
// sandwich and consumers depend on this returning `false` for java_binary/java_test targets. When
// these are in Starlark, this check will need to exclude the latter targets by checking for
// `JavaInfo._is_binary`
public static boolean isJavaLibraryesqueTarget(TransitiveInfoCollection target)
throws RuleErrorException {
return JavaInfo.getCompilationArgsProvider(target).isPresent();
}

Expand Down

0 comments on commit 062d969

Please sign in to comment.