diff options
author | janakr <janakr@google.com> | 2018-04-11 14:55:28 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-11 14:57:41 -0700 |
commit | 7f15b6880a8468f6786fa02a2debacc155402138 (patch) | |
tree | d1ef36a81100699f7e58a4be5c6d4dbd21c3149e /src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java | |
parent | bfd89d6393fd56c92c0b31b19d7ec78d8da9141f (diff) |
Remove all callers of ArtifactRoot.asSourcePath from production code besides the ones in SkyframeExecutor, called once for each Root in the package path list. This ensures there is a single canonical ArtifactRoot for each source root.
It is still the case that every Package loaded has its own Root (https://source.bazel.build/bazel/+/master:src/main/java/com/google/devtools/build/lib/packages/Package.java;l=287?q=Package.java), which is a waste of memory, but because of the map inside ArtifactFactory introduced in this change, all Artifacts with the same logical source root share a single ArtifactRoot instance.
PiperOrigin-RevId: 192513819
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java b/src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java index 082c122adb..ef786ea68e 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java @@ -14,13 +14,12 @@ package com.google.devtools.build.lib.analysis; -import com.google.devtools.build.lib.actions.ArtifactRoot; import com.google.devtools.build.lib.actions.PackageRootResolver; import com.google.devtools.build.lib.events.ExtendedEventHandler; import com.google.devtools.build.lib.skyframe.SkyframeExecutor; import com.google.devtools.build.lib.vfs.PathFragment; +import com.google.devtools.build.lib.vfs.Root; import java.util.Map; -import javax.annotation.Nullable; /** * Skyframe implementation of {@link PackageRootResolver}. @@ -37,15 +36,8 @@ public final class SkyframePackageRootResolver implements PackageRootResolver { } @Override - public Map<PathFragment, ArtifactRoot> findPackageRootsForFiles(Iterable<PathFragment> execPaths) + public Map<PathFragment, Root> findPackageRootsForFiles(Iterable<PathFragment> execPaths) throws InterruptedException { return executor.getArtifactRootsForFiles(eventHandler, execPaths); } - - @Override - @Nullable - public Map<PathFragment, ArtifactRoot> findPackageRoots(Iterable<PathFragment> execPaths) - throws InterruptedException { - return executor.getArtifactRoots(eventHandler, execPaths); - } } |