Rollback of commit 4b73e972d909bcd533f2f9940f95a00b9b73bdde.
*** Reason for rollback ***
Broke tests on CI: http://ci.bazel.io/job/bazel-tests/570/
*** Original change description ***
Roll forward execroot change
RELNOTES[INC]: Previously, an external repository would be symlinked into the
execution root at execroot/local_repo/external/remote_repo. This changes it to
be at execroot/remote_repo. This may break genrules/Skylark actions that
hardcode execution root paths. If this causes breakages for you, ensure that
genrules are using $(location :target) to access files and Skylark rules are
using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc.
functions. Cust...
--
PiperOrigin-RevId: 147833177
MOS_MIGRATED_REVID=147833177
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
index 4efcf03..656ca25 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -87,7 +87,6 @@
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.util.StringUtil;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
-import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.ArrayList;
import java.util.Collection;
@@ -593,19 +592,6 @@
* thus guaranteeing that it never clashes with artifacts created by rules in other packages.
*/
public Artifact getPackageRelativeArtifact(PathFragment relative, Root root) {
- // TODO: other root types, is this never a main repo?
- if (relative.startsWith(new PathFragment(Label.EXTERNAL_PATH_PREFIX))) {
- // This is an external path, use a different root.
- if (root.isSourceRoot()) {
- root = Root.asSourceRoot(root.getPath().getRelative(relative.subFragment(0, 2)));
- } else {
- boolean isMainRepo = false;
- Path newExecRoot = root.getExecRoot().getRelative(relative.subFragment(0, 2));
- root = Root.asDerivedRoot(
- newExecRoot, newExecRoot.getRelative(root.getExecPath()), isMainRepo);
- }
- relative = relative.subFragment(2, relative.segmentCount());
- }
return getDerivedArtifact(getPackageDirectory().getRelative(relative), root);
}
@@ -624,7 +610,7 @@
* {@link #getUniqueDirectoryArtifact(String, PathFragment, Root)}) ensures that this is the case.
*/
public PathFragment getPackageDirectory() {
- return getLabel().getPackageIdentifier().getPackageFragment();
+ return getLabel().getPackageIdentifier().getSourceRoot();
}
/**