aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
diff options
context:
space:
mode:
authorGravatar janakr <janakr@google.com>2018-03-26 09:26:53 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-26 09:28:16 -0700
commit171a7ebd9a28c4169f2c3018b9c4d740dadcf324 (patch)
tree6c97755630f7bce831ae7cc8a5fe0f0c9ee6cf1a /src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java
parent8688b68d4331449f97b04a868c0d61c62eff71f2 (diff)
Deprecate TransitiveInfoCollection#getConfiguration(), adding two new methods, TransitiveInfoCollection#getConfigurationKey() and ConfiguredTarget#getConfigurationChecksum(). These methods currently delegate to #getConfiguration(), but in the future they won't. I hope to get rid of #getConfigurationChecksum(), but I may have to fold the checksum into BuildConfigurationValue.Key or leave it as a separate field in ConfiguredTarget.
Transform a representative (random?) selection of #getConfiguration calls, to show that it's pretty much possible everywhere. PiperOrigin-RevId: 190474978
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java31
1 files changed, 26 insertions, 5 deletions
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 bbce1d67e5..6e8e6033ff 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
@@ -291,16 +291,37 @@ public final class AspectFunction implements SkyFunction {
ConfiguredTarget associatedTarget = baseConfiguredTargetValue.getConfiguredTarget();
ConfiguredTargetAndData associatedConfiguredTargetAndData;
- Package targetPkg =
- ((PackageValue)
- env.getValue(PackageValue.key(associatedTarget.getLabel().getPackageIdentifier())))
- .getPackage();
+ Package targetPkg;
+ BuildConfiguration configuration = null;
+ PackageValue.Key packageKey =
+ PackageValue.key(associatedTarget.getLabel().getPackageIdentifier());
+ if (associatedTarget.getConfigurationKey() == null) {
+ PackageValue val = ((PackageValue) env.getValue(packageKey));
+ if (val == null) {
+ // Unexpected in Bazel logic, but Skyframe makes no guarantees that this package is
+ // actually present.
+ return null;
+ }
+ targetPkg = val.getPackage();
+ } else {
+ Map<SkyKey, SkyValue> result =
+ env.getValues(ImmutableSet.of(packageKey, associatedTarget.getConfigurationKey()));
+ if (env.valuesMissing()) {
+ // Unexpected in Bazel logic, but Skyframe makes no guarantees that this package and
+ // configuration are actually present.
+ return null;
+ }
+ targetPkg = ((PackageValue) result.get(packageKey)).getPackage();
+ configuration =
+ ((BuildConfigurationValue) result.get(associatedTarget.getConfigurationKey()))
+ .getConfiguration();
+ }
try {
associatedConfiguredTargetAndData =
new ConfiguredTargetAndData(
associatedTarget,
targetPkg.getTarget(associatedTarget.getLabel().getName()),
- associatedTarget.getConfiguration());
+ configuration);
} catch (NoSuchTargetException e) {
throw new IllegalStateException("Name already verified", e);
}