|
71 | 71 | import com.google.devtools.build.lib.events.StoredEventHandler;
|
72 | 72 | import com.google.devtools.build.lib.packages.Aspect;
|
73 | 73 | import com.google.devtools.build.lib.packages.BuildType;
|
| 74 | +import com.google.devtools.build.lib.packages.ConfiguredAttributeMapper; |
74 | 75 | import com.google.devtools.build.lib.packages.ExecGroup;
|
75 | 76 | import com.google.devtools.build.lib.packages.NoSuchTargetException;
|
76 | 77 | import com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper;
|
|
108 | 109 | import java.util.function.Predicate;
|
109 | 110 | import java.util.stream.Collectors;
|
110 | 111 | import javax.annotation.Nullable;
|
| 112 | +import net.starlark.java.syntax.Location; |
111 | 113 |
|
112 | 114 | /**
|
113 | 115 | * SkyFunction for {@link ConfiguredTargetValue}s.
|
@@ -335,13 +337,28 @@ public SkyValue compute(SkyKey key, Environment env)
|
335 | 337 | getPrioritizedDetailedExitCode(causes)));
|
336 | 338 | }
|
337 | 339 |
|
338 |
| - Optional<RuleConfiguredTargetValue> incompatibleTarget = |
339 |
| - IncompatibleTargetChecker.createDirectlyIncompatibleTarget( |
340 |
| - targetAndConfiguration, |
341 |
| - configConditions, |
342 |
| - env, |
343 |
| - platformInfo, |
344 |
| - state.transitivePackages); |
| 340 | + Optional<RuleConfiguredTargetValue> incompatibleTarget; |
| 341 | + try { |
| 342 | + incompatibleTarget = |
| 343 | + IncompatibleTargetChecker.createDirectlyIncompatibleTarget( |
| 344 | + targetAndConfiguration, |
| 345 | + configConditions, |
| 346 | + env, |
| 347 | + platformInfo, |
| 348 | + state.transitivePackages); |
| 349 | + } catch (ConfiguredAttributeMapper.ValidationException e) { |
| 350 | + BuildConfigurationValue configuration = targetAndConfiguration.getConfiguration(); |
| 351 | + Label label = targetAndConfiguration.getLabel(); |
| 352 | + Location location = targetAndConfiguration.getTarget().getLocation(); |
| 353 | + env.getListener().post(new AnalysisRootCauseEvent(configuration, label, e.getMessage())); |
| 354 | + throw new DependencyEvaluationException( |
| 355 | + new ConfiguredValueCreationException( |
| 356 | + location, e.getMessage(), label, configuration.getEventId(), null, null), |
| 357 | + // These errors occur within DependencyResolver, which is attached to the current |
| 358 | + // target. i.e. no dependent ConfiguredTargetFunction call happens to report its own |
| 359 | + // error. |
| 360 | + /* depReportedOwnError= */ false); |
| 361 | + } |
345 | 362 | if (incompatibleTarget == null) {
|
346 | 363 | return null;
|
347 | 364 | }
|
|
0 commit comments