Skip to content

Commit

Permalink
Fix --target_environment crash on alias to an output file.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 249294325
  • Loading branch information
gregestren authored and copybara-github committed May 21, 2019
1 parent 1193e69 commit b7a9615
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.google.devtools.build.lib.packages.NoSuchTargetException;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.pkgcache.PackageManager;
import com.google.devtools.build.lib.rules.AliasConfiguredTarget;
import com.google.devtools.build.lib.skyframe.BuildConfigurationValue.Key;
import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -216,6 +217,9 @@ private Collection<MissingEnvironment> getMissingEnvironments(ConfiguredTarget t
EnvironmentCollection expectedEnvironments = expectedEnvironmentsBuilder.build();

// Now check the target against expected environments.
if (topLevelTarget instanceof AliasConfiguredTarget) {
topLevelTarget = ((AliasConfiguredTarget) topLevelTarget).getActual();
}
TransitiveInfoCollection asProvider;
if (topLevelTarget instanceof OutputFileConfiguredTarget) {
asProvider = ((OutputFileConfiguredTarget) topLevelTarget).getGeneratingRule();
Expand Down

0 comments on commit b7a9615

Please sign in to comment.