Replace Artifact#getOutputDirRelativePath call in JavaHelper#getJavaResourcePath with getRepositoryRelativePath.
@@ -25,7 +25,6 @@ import com.google.devtools.build.lib.shell.ShellUtils;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.ArrayList;
import java.util.List;
-import net.starlark.java.eval.StarlarkSemantics;
/** Utility methods for use by Java-related parts of Bazel. */
// TODO(bazel-team): Merge with JavaUtil.
@@ -108,17 +107,8 @@ public abstract class JavaHelper {
}
public static PathFragment getJavaResourcePath(
- JavaSemantics semantics, RuleContext ruleContext, Artifact resource)
- throws InterruptedException {
- PathFragment resourcePath = resource.getOutputDirRelativePath();
- StarlarkSemantics starlarkSemantics =
- ruleContext.getAnalysisEnvironment().getStarlarkSemantics();
-
- if (!ruleContext.getLabel().getWorkspaceRoot(starlarkSemantics).isEmpty()) {
- PathFragment workspace =
- PathFragment.create(ruleContext.getLabel().getWorkspaceRoot(starlarkSemantics));
- resourcePath = resourcePath.relativeTo(workspace);
- }
+ JavaSemantics semantics, RuleContext ruleContext, Artifact resource) {
+ PathFragment resourcePath = resource.getRepositoryRelativePath();
if (!ruleContext.attributes().has("resource_strip_prefix", Type.STRING)
|| !ruleContext.attributes().isAttributeValueExplicitlySpecified("resource_strip_prefix")) {
