Skip to content

Commit

Permalink
Fix java_common.target_kind when aspects are involved
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 412242583
  • Loading branch information
hvadehra authored and copybara-github committed Nov 25, 2021
1 parent 0a93c1f commit 748b996
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public Dict<String, Object> getProvidersDict() {
}

@VisibleForTesting
public ConfiguredTarget getBaseConfiguredTargetForTesting() {
public ConfiguredTarget getBaseConfiguredTarget() {
return base;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.configuredtargets.AbstractConfiguredTarget;
import com.google.devtools.build.lib.analysis.configuredtargets.MergedConfiguredTarget;
import com.google.devtools.build.lib.analysis.platform.ConstraintValueInfo;
import com.google.devtools.build.lib.analysis.starlark.StarlarkActionFactory;
import com.google.devtools.build.lib.analysis.starlark.StarlarkRuleContext;
Expand Down Expand Up @@ -297,6 +298,9 @@ public ProviderApi getBootClassPathInfo() {
@Override
public String getTargetKind(Object target, StarlarkThread thread) throws EvalException {
checkPrivateAccess(thread);
if (target instanceof MergedConfiguredTarget) {
target = ((MergedConfiguredTarget) target).getBaseConfiguredTarget();
}
if (target instanceof AbstractConfiguredTarget) {
return ((AbstractConfiguredTarget) target).getRuleClassString();
}
Expand Down

0 comments on commit 748b996

Please sign in to comment.