aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
diff options
context:
space:
mode:
authorGravatar Marian Lobur <loburm@google.com>2015-08-07 08:04:34 +0000
committerGravatar David Chen <dzc@google.com>2015-08-07 09:11:35 +0000
commitb29cfdcf48d97dd61f72948d9d293aca114de487 (patch)
treeecfea0dba4782ae2815d90d5e11622698f6f8ef6 /src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
parentb47cb4979e7709c65ce8b29cec6f9491fd40d2c6 (diff)
Stop checking package roots for incompatible changes after loading phase.
Instead we can just recreate artifact in ArtifactFactory if source root has changed. Additional optimization is to save with Artifact's some unique id of build when they have been created. If the build is the same we should not check source root changes. -- MOS_MIGRATED_REVID=100104312
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/BuildView.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/BuildView.java38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
index 42fe145684..3baae742e9 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/BuildView.java
@@ -215,12 +215,6 @@ public class BuildView {
@Nullable private final CoverageReportActionFactory coverageReportActionFactory;
/**
- * A union of package roots of all previous incremental analysis results. This is used to detect
- * changes of package roots between incremental analysis instances.
- */
- private final Map<PackageIdentifier, Path> cumulativePackageRoots = new HashMap<>();
-
- /**
* Used only for testing that we clear Skyframe caches correctly.
* TODO(bazel-team): Remove this once we get rid of legacy Skyframe synchronization.
*/
@@ -312,7 +306,6 @@ public class BuildView {
*/
@VisibleForTesting
public void clear() {
- cumulativePackageRoots.clear();
artifactFactory.clear();
}
@@ -574,22 +567,8 @@ public class BuildView {
}
skyframeAnalysisWasDiscarded = false;
ImmutableMap<PackageIdentifier, Path> packageRoots = loadingResult.getPackageRoots();
-
- if (buildHasIncompatiblePackageRoots(packageRoots)) {
- // When a package root changes source artifacts with the new root will be created, but we
- // cannot be sure that there are no references remaining to the corresponding artifacts
- // with the old root. To avoid that scenario, the analysis cache is simply dropped when
- // a package root change is detected.
- LOG.info("Discarding analysis cache: package roots have changed.");
-
- skyframeExecutor.dropConfiguredTargets();
- skyframeCacheWasInvalidated = true;
- clear();
- }
- cumulativePackageRoots.putAll(packageRoots);
this.configurations = configurations;
setArtifactRoots(packageRoots);
-
// Determine the configurations.
List<TargetAndConfiguration> nodes = nodesForTargets(targets);
@@ -778,23 +757,6 @@ public class BuildView {
}
/**
- * Detects when a package root changes between instances of incremental analysis.
- *
- * <p>This case is currently problematic for incremental analysis because when a package root
- * changes, source artifacts with the new root will be created, but we can not be sure that there
- * are no references remaining to the corresponding artifacts with the old root.
- */
- private boolean buildHasIncompatiblePackageRoots(Map<PackageIdentifier, Path> packageRoots) {
- for (Map.Entry<PackageIdentifier, Path> entry : packageRoots.entrySet()) {
- Path prevRoot = cumulativePackageRoots.get(entry.getKey());
- if (prevRoot != null && !entry.getValue().equals(prevRoot)) {
- return true;
- }
- }
- return false;
- }
-
- /**
* Returns an existing ConfiguredTarget for the specified target and
* configuration, or null if none exists. No validity check is done.
*/