aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2016-09-20 15:40:42 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2016-09-21 07:06:32 +0000
commit8539a1215bb58211c7c643005d2389ecafa6f580 (patch)
tree87783de1c37833261051d4c540e52ec81fcbdbfe /src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
parent63010255876a81cf2b0bc4fc5d95a0e1a99df58d (diff)
*** Reason for rollback *** Breaks TensorFlow and other Bazel jobs on ci.bazel.io *** Original change description *** Change execution root for external repositories to be ../repo Some of the important aspect of this change: * Remote repos in the execution root are under output_base/execroot/repo_name, so the prefix is ../repo_name (to escape the local workspace name). * Package roots for external repos were previously "output_base/", they are now output_base/external/repo_name (which means source artifacts always have a relative path from their repository). * Outputs are under bazel-bin/external/repo_name/ (or similarly under genfiles). Note that this is a bit of a change from how this was implemented in the previous cl. Fixes #1262. 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. Roll forward of bdfd58a. -- MOS_MIGRATED_REVID=133709658
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
index e77d02a71d..512281ad93 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
@@ -20,7 +20,6 @@ import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.actions.ActionExecutionException;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactResolver;
-import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
@@ -94,7 +93,7 @@ public class HeaderDiscovery {
return inputs.build();
}
List<Path> systemIncludePrefixes = permittedSystemIncludePrefixes;
- RepositoryName repositoryName = RepositoryName.MAIN;
+
// Check inclusions.
IncludeProblems problems = new IncludeProblems();
for (Path execPath : depSet.getDependencies()) {
@@ -112,24 +111,16 @@ public class HeaderDiscovery {
// non-system include paths here should never be absolute. If they
// are, it's probably due to a non-hermetic #include, & we should stop
// the build with an error.
- // funky but tolerable path
if (execPath.startsWith(execRoot)) {
- execPathFragment = execPath.relativeTo(execRoot);
- } else if (execPath.startsWith(execRoot.getParentDirectory())) {
- // External repository.
- execPathFragment = execPath.relativeTo(execRoot.getParentDirectory());
- String workspace = execPathFragment.getSegment(0);
- execPathFragment = execPathFragment.relativeTo(workspace);
- try {
- repositoryName = RepositoryName.create("@" + workspace);
- } catch (LabelSyntaxException e) {
- throw new IllegalStateException(workspace + " is not a valid repository name");
- }
+ execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path
+ } else {
+ problems.add(execPathFragment.getPathString());
+ continue;
}
}
Artifact artifact = allowedDerivedInputsMap.get(execPathFragment);
if (artifact == null) {
- artifact = artifactResolver.resolveSourceArtifact(execPathFragment, repositoryName);
+ artifact = artifactResolver.resolveSourceArtifact(execPathFragment, RepositoryName.MAIN);
}
if (artifact != null) {
inputs.add(artifact);