Implement proper error handling for interleaved loading and analysis.
Add test coverage by re-running BuildViewTest with the new Skyframe loading
phase runner.
--
MOS_MIGRATED_REVID=113517509
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 403528e..35d3c12 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
@@ -809,7 +809,7 @@
}
@Override
- protected Target getTarget(Label label) {
+ protected Target getTarget(Target from, Label label, NestedSetBuilder<Label> rootCauses) {
if (targetCache == null) {
try {
return LoadedPackageProvider.Bridge.getLoadedTarget(
@@ -879,9 +879,13 @@
}
@Override
- protected Target getTarget(Label label) throws NoSuchThingException {
- return LoadedPackageProvider.Bridge.getLoadedTarget(
- skyframeExecutor.getPackageManager(), eventHandler, label);
+ protected Target getTarget(Target from, Label label, NestedSetBuilder<Label> rootCauses) {
+ try {
+ return LoadedPackageProvider.Bridge.getLoadedTarget(
+ skyframeExecutor.getPackageManager(), eventHandler, label);
+ } catch (NoSuchThingException e) {
+ throw new IllegalStateException(e);
+ }
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java b/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java
index 8d30b12..2d7edd2 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/DependencyResolver.java
@@ -157,17 +157,6 @@
return outgoingEdges;
}
- @Nullable
- private Target getTarget(Target from, Label label, NestedSetBuilder<Label> rootCauses) {
- try {
- return getTarget(label);
- } catch (NoSuchThingException e) {
- rootCauses.add(label);
- missingEdgeHook(from, label, e);
- }
- return null;
- }
-
private ListMultimap<Attribute, LabelAndConfiguration> resolveAttributes(
Rule rule, AspectDefinition aspect, BuildConfiguration configuration,
BuildConfiguration hostConfiguration, Set<ConfigMatchingProvider> configConditions)
@@ -615,13 +604,11 @@
/**
* Returns the target by the given label.
*
- * <p>Throws {@link NoSuchThingException} if the target is known not to exist.
- *
* <p>Returns null if the target is not ready to be returned at this moment. If getTarget returns
* null once or more during a {@link #dependentNodeMap} call, the results of that call will be
* incomplete. For use within Skyframe, where several iterations may be needed to discover
* all dependencies.
*/
@Nullable
- protected abstract Target getTarget(Label label) throws NoSuchThingException;
+ protected abstract Target getTarget(Target from, Label label, NestedSetBuilder<Label> rootCauses);
}