aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/actions/Root.java
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2015-03-16 10:11:50 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-03-16 17:34:30 +0000
commit45c0f1144b7447afc3dfac8623e8e81e2671b18f (patch)
treed9382a9b637b03c4e865849253329eac0b694644 /src/main/java/com/google/devtools/build/lib/actions/Root.java
parent957934c40f73e96a4414c6a9efbc165367459b4b (diff)
Simplify BuildConfiguration to make it cheaper to create more instances.
We want to make it so configured targets can only see the configuration fragments they have declared, which requires creating a customized configuration for every configured target. Therefore, this change moves the directories to a separate object, so configurations that have the same output directories can share it. Also change getBinFragment and getGenfilesFragment to call the corresponding Root.getExecPath() on the fly. However, these are called _very_ often, so at the same time change Root to cache the exec path. Instead of keeping a map of all executables, only keep the shell executable, which is the only value that was actually used anywhere. Remove the cache key, but keep the short cache key. The cache key was only used to check for duplicate cache keys in the BuildConfigurationCollection, which is no longer necessary as we don't use the cache key for anything else anymore. We should instead check for output directory conflicts, but we can't do that quite yet (I'm working on it). Also update the documentation in a couple of places. -- MOS_MIGRATED_REVID=88712178
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/Root.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/Root.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/Root.java b/src/main/java/com/google/devtools/build/lib/actions/Root.java
index 55619eb368..447949dfb8 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/Root.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/Root.java
@@ -97,11 +97,13 @@ public final class Root implements Comparable<Root>, Serializable {
@Nullable private final Path execRoot;
private final Path path;
private final boolean isMiddlemanRoot;
+ private final PathFragment execPath;
private Root(@Nullable Path execRoot, Path path, boolean isMiddlemanRoot) {
this.execRoot = execRoot;
this.path = Preconditions.checkNotNull(path);
this.isMiddlemanRoot = isMiddlemanRoot;
+ this.execPath = isSourceRoot() ? PathFragment.EMPTY_FRAGMENT : path.relativeTo(execRoot);
}
private Root(@Nullable Path execRoot, Path path) {
@@ -117,7 +119,7 @@ public final class Root implements Comparable<Root>, Serializable {
* the empty fragment.
*/
public PathFragment getExecPath() {
- return isSourceRoot() ? PathFragment.EMPTY_FRAGMENT : path.relativeTo(execRoot);
+ return execPath;
}
@SkylarkCallable(name = "path", structField = true,