General cleanup for the configured target / aspect creation code.
- update some comments
- add some comments to make it easier to follow
- delete some dead code, in particular the SkyframeDependencyResolver can
never be null; remove an non-applicable @Nullable annotation
I'm trying to figure out how the error handling code works, in order to add
support for interleaved loading+analysis, which requires handling loading
errors in this code path.
--
MOS_MIGRATED_REVID=112456674
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
index fad923c..aafa943 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
@@ -31,6 +31,7 @@
import com.google.devtools.build.lib.packages.BuildFileContainsErrorsException;
import com.google.devtools.build.lib.packages.NativeAspectClass;
import com.google.devtools.build.lib.packages.NoSuchTargetException;
+import com.google.devtools.build.lib.packages.NoSuchThingException;
import com.google.devtools.build.lib.packages.Package;
import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.packages.RuleClassProvider;
@@ -159,13 +160,9 @@
}
SkyframeDependencyResolver resolver = view.createDependencyResolver(env);
- if (resolver == null) {
- return null;
- }
TargetAndConfiguration ctgValue =
new TargetAndConfiguration(target, key.getConfiguration());
-
try {
// Get the configuration targets that trigger this rule's configurable attributes.
Set<ConfigMatchingProvider> configConditions = ConfiguredTargetFunction.getConfigConditions(
@@ -276,7 +273,7 @@
* Used to indicate errors during the computation of an {@link AspectValue}.
*/
private static final class AspectFunctionException extends SkyFunctionException {
- public AspectFunctionException(Exception e) {
+ public AspectFunctionException(AspectCreationException e) {
super(e, Transience.PERSISTENT);
}
@@ -284,6 +281,10 @@
public AspectFunctionException(SkyKey childKey, Exception transitiveError) {
super(transitiveError, childKey);
}
- }
+ /** Used to rethrow a child error that we cannot handle. */
+ public AspectFunctionException(SkyKey childKey, NoSuchThingException e) {
+ super(e, childKey);
+ }
+ }
}