aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/pkgcache
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2016-02-26 13:13:39 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-02-28 17:04:23 +0000
commitde62b4e9cd0f56473278811774ec191a4e0fafcd (patch)
treed5f18446ad3935c35340f84f0fcab7d3dceb47c3 /src/main/java/com/google/devtools/build/lib/pkgcache
parentb8101f57681f292a9ec312a9cbbc84ac4ec0668d (diff)
Pass the source path -> Artifact mapping into FdoSupport from a provider instead of special-casing it.
This removes the need to deserialize artifacts in FdoSupport, which in turn removes the need to support artifact deserialization at all, which makes our lives simpler and Thoreauvian programming is good. -- MOS_MIGRATED_REVID=115660698
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/pkgcache')
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/LegacyLoadingPhaseRunner.java17
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/LoadingResult.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/TransitivePackageLoader.java11
3 files changed, 5 insertions, 39 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/LegacyLoadingPhaseRunner.java b/src/main/java/com/google/devtools/build/lib/pkgcache/LegacyLoadingPhaseRunner.java
index 6d68c47778..09698e6176 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/LegacyLoadingPhaseRunner.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/LegacyLoadingPhaseRunner.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.lib.pkgcache;
import com.google.common.base.Stopwatch;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.ListMultimap;
@@ -30,13 +29,11 @@ import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.packages.NoSuchThingException;
import com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper;
-import com.google.devtools.build.lib.packages.Package;
import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.packages.TestTargetUtils;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.Preconditions;
-import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.Collection;
@@ -229,7 +226,7 @@ public final class LegacyLoadingPhaseRunner extends LoadingPhaseRunner {
postLoadingLogging(eventBus, targetsToLoad, expandedResult.getTargets(), timer);
return new LoadingResult(targets.hasError(), expandedResult.hasError(),
- expandedResult.getTargets(), testsToRun, ImmutableMap.<PackageIdentifier, Path>of());
+ expandedResult.getTargets(), testsToRun);
}
/**
@@ -259,7 +256,7 @@ public final class LegacyLoadingPhaseRunner extends LoadingPhaseRunner {
postLoadingLogging(eventBus, baseResult.getTargets(), expandedResult.getTargets(), timer);
LoadingResult loadingResult = new LoadingResult(targets.hasError(),
!baseResult.isSuccesful() || expandedResult.hasError(),
- expandedResult.getTargets(), testsToRun, baseResult.roots);
+ expandedResult.getTargets(), testsToRun);
return loadingResult;
}
@@ -293,7 +290,6 @@ public final class LegacyLoadingPhaseRunner extends LoadingPhaseRunner {
// packages/targets have been visited since the last sync/clear.
boolean loadingSuccessful = pkgLoader.sync(eventHandler, targetsToLoad, labelsToLoad,
keepGoing, loadingPhaseThreads, Integer.MAX_VALUE);
- Set<Package> errorFreePackages = pkgLoader.getErrorFreeVisitedPackages(eventHandler);
ImmutableSet<Target> targetsToAnalyze;
if (loadingSuccessful) {
@@ -307,9 +303,7 @@ public final class LegacyLoadingPhaseRunner extends LoadingPhaseRunner {
} else {
throw new LoadingFailedException("Loading failed; build aborted");
}
- return new BaseLoadingResult(
- targetsToAnalyze, loadingSuccessful,
- LoadingPhaseRunner.collectPackageRoots(errorFreePackages));
+ return new BaseLoadingResult(targetsToAnalyze, loadingSuccessful);
}
private void reportAboutPartiallySuccesfulLoading(ImmutableSet<Target> requestedTargets,
@@ -340,13 +334,10 @@ public final class LegacyLoadingPhaseRunner extends LoadingPhaseRunner {
private static class BaseLoadingResult {
private final ImmutableSet<Target> targets;
private final boolean succesful;
- private final ImmutableMap<PackageIdentifier, Path> roots;
- BaseLoadingResult(ImmutableSet<Target> targets, boolean succesful,
- ImmutableMap<PackageIdentifier, Path> roots) {
+ BaseLoadingResult(ImmutableSet<Target> targets, boolean succesful) {
this.targets = targets;
this.succesful = succesful;
- this.roots = roots;
}
ImmutableSet<Target> getTargets() {
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingResult.java b/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingResult.java
index 80c6fbe4f1..94f597649e 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingResult.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/LoadingResult.java
@@ -13,11 +13,8 @@
// limitations under the License.
package com.google.devtools.build.lib.pkgcache;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.packages.Target;
-import com.google.devtools.build.lib.vfs.Path;
import java.util.Collection;
@@ -30,17 +27,14 @@ public final class LoadingResult {
private final boolean hasLoadingError;
private final ImmutableSet<Target> targetsToAnalyze;
private final ImmutableSet<Target> testsToRun;
- private final ImmutableMap<PackageIdentifier, Path> packageRoots;
public LoadingResult(boolean hasTargetPatternError, boolean hasLoadingError,
- Collection<Target> targetsToAnalyze, Collection<Target> testsToRun,
- ImmutableMap<PackageIdentifier, Path> packageRoots) {
+ Collection<Target> targetsToAnalyze, Collection<Target> testsToRun) {
this.hasTargetPatternError = hasTargetPatternError;
this.hasLoadingError = hasLoadingError;
this.targetsToAnalyze =
targetsToAnalyze == null ? null : ImmutableSet.copyOf(targetsToAnalyze);
this.testsToRun = testsToRun == null ? null : ImmutableSet.copyOf(testsToRun);
- this.packageRoots = packageRoots;
}
/** Whether there were errors during target pattern evaluation. */
@@ -62,12 +56,4 @@ public final class LoadingResult {
public Collection<Target> getTestsToRun() {
return testsToRun;
}
-
- /**
- * The map from package names to the package root where each package was found; this is used to
- * set up the symlink tree.
- */
- public ImmutableMap<PackageIdentifier, Path> getPackageRoots() {
- return packageRoots;
- }
} \ No newline at end of file
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/TransitivePackageLoader.java b/src/main/java/com/google/devtools/build/lib/pkgcache/TransitivePackageLoader.java
index 65582247d1..45c7c931b1 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/TransitivePackageLoader.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/TransitivePackageLoader.java
@@ -17,7 +17,6 @@ import com.google.common.collect.Multimap;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.events.EventHandler;
-import com.google.devtools.build.lib.packages.Package;
import com.google.devtools.build.lib.packages.Target;
import java.util.Set;
@@ -55,16 +54,6 @@ public interface TransitivePackageLoader {
Set<PackageIdentifier> getVisitedPackageNames();
/**
- * Returns a read-only view of the set of the actual packages visited without error since this
- * visitor was constructed.
- *
- * <p>Use {@link #getVisitedPackageNames()} instead when possible.
- *
- * <p>Not thread-safe; do not call during visitation.
- */
- Set<Package> getErrorFreeVisitedPackages(EventHandler eventHandler);
-
- /**
* Return a mapping between the specified top-level targets and root causes. Note that targets in
* the input that are transitively error free will not be in the output map. "Top-level" targets
* are the targetsToVisit and labelsToVisit specified in the last sync.