From 7f15b6880a8468f6786fa02a2debacc155402138 Mon Sep 17 00:00:00 2001 From: janakr Date: Wed, 11 Apr 2018 14:55:28 -0700 Subject: 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 --- .../build/lib/analysis/SkyframePackageRootResolver.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/analysis/SkyframePackageRootResolver.java') 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 findPackageRootsForFiles(Iterable execPaths) + public Map findPackageRootsForFiles(Iterable execPaths) throws InterruptedException { return executor.getArtifactRootsForFiles(eventHandler, execPaths); } - - @Override - @Nullable - public Map findPackageRoots(Iterable execPaths) - throws InterruptedException { - return executor.getArtifactRoots(eventHandler, execPaths); - } } -- cgit v1.2.3