Skip to content

Commit

Permalink
Filter null values more carefully while checking for incompatible tar…
Browse files Browse the repository at this point in the history
…gets.

PiperOrigin-RevId: 481976671
Change-Id: Idf0fcb4f62240ae8fc21855362973633d8974eb7
  • Loading branch information
katre authored and copybara-github committed Oct 18, 2022
1 parent a5ab6c5 commit 441eefe
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.google.devtools.build.lib.analysis.constraints;

import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.ImmutableList.toImmutableList;

import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -142,8 +143,10 @@ public static Optional<RuleConfiguredTargetValue> createDirectlyIncompatibleTarg
ImmutableList<ConstraintValueInfo> invalidConstraintValues =
constraintKeys.stream()
.map(key -> (ConfiguredTargetValue) constraintValues.get(key))
.filter(notNull())
.map(ctv -> PlatformProviderUtils.constraintValue(ctv.getConfiguredTarget()))
.filter(cv -> cv != null && !platformInfo.constraints().hasConstraintValue(cv))
.filter(notNull())
.filter(cv -> !platformInfo.constraints().hasConstraintValue(cv))
.collect(toImmutableList());
if (invalidConstraintValues.isEmpty()) {
return Optional.empty();
Expand Down

0 comments on commit 441eefe

Please sign in to comment.