BEP reports analysis failure for targets with artifact conflicts.
Artifact conflicts are detected through a non-skyframe evaluation that is not
capable of identifying a top-level target or aspect that failed as a result of the
artifact conflict. We do perform a skyframe evaluation to identify which targets
and aspects to actually evaluate however, and *this* evaluation is now used to
report artifact conflicts in BEP.
A previous implementation of this change was rolled back due to a crash that
occurred if a --keep_going build included both action conflicts and other analysis
failures. A new regression test is included for this case.
RELNOTES: None.
PiperOrigin-RevId: 368017860
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AspectValueKey.java b/src/main/java/com/google/devtools/build/lib/skyframe/AspectValueKey.java
index d123290..63f284d 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/AspectValueKey.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/AspectValueKey.java
@@ -35,8 +35,22 @@
private static final Interner<StarlarkAspectLoadingKey> starlarkAspectKeyInterner =
BlazeInterners.newWeakInterner();
+ /**
+ * Gets the name of the aspect that would be returned by the corresponding value's {@code
+ * aspectValue.getAspect().getAspectClass().getName()}, if the value could be produced.
+ *
+ * <p>Only needed for reporting errors in BEP when the key's AspectValue fails evaluation.
+ */
+ public abstract String getAspectName();
+
public abstract String getDescription();
+ @Nullable
+ abstract BuildConfigurationValue.Key getAspectConfigurationKey();
+
+ /** Returns the key for the base configured target for this aspect. */
+ public abstract ConfiguredTargetKey getBaseConfiguredTargetKey();
+
public static AspectKey createAspectKey(
Label label,
@Nullable BuildConfiguration baseConfiguration,
@@ -121,6 +135,10 @@
return SkyFunctions.ASPECT;
}
+ @Override
+ public String getAspectName() {
+ return aspectDescriptor.getDescription();
+ }
@Override
public Label getLabel() {
@@ -174,11 +192,13 @@
* base target's configuration.
*/
@Nullable
+ @Override
BuildConfigurationValue.Key getAspectConfigurationKey() {
return aspectConfigurationKey;
}
/** Returns the key for the base configured target for this aspect. */
+ @Override
public ConfiguredTargetKey getBaseConfiguredTargetKey() {
return baseConfiguredTargetKey;
}
@@ -312,6 +332,11 @@
}
@Override
+ public String getAspectName() {
+ return String.format("%s%%%s", starlarkFileLabel, starlarkValueName);
+ }
+
+ @Override
public Label getLabel() {
return targetLabel;
}
@@ -322,6 +347,18 @@
return String.format("%s%%%s of %s", starlarkFileLabel, starlarkValueName, targetLabel);
}
+ @Nullable
+ @Override
+ BuildConfigurationValue.Key getAspectConfigurationKey() {
+ return aspectConfigurationKey;
+ }
+
+ /** Returns the key for the base configured target for this aspect. */
+ @Override
+ public ConfiguredTargetKey getBaseConfiguredTargetKey() {
+ return baseConfiguredTargetKey;
+ }
+
@Override
public int hashCode() {
// We use the hash code caching strategy employed by java.lang.String. There are three subtle