Skip to content

Commit

Permalink
Remove ConfiguredTargetValue.key.
Browse files Browse the repository at this point in the history
All uses should be ConfiguredTargetKey.of.

PiperOrigin-RevId: 306476845
  • Loading branch information
katre authored and copybara-github committed Apr 14, 2020
1 parent 4f49982 commit 41a3cb0
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.google.devtools.build.lib.skyframe.AspectFunction;
import com.google.devtools.build.lib.skyframe.AspectValue;
import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData;
import com.google.devtools.build.lib.skyframe.ConfiguredTargetValue;
import com.google.devtools.build.lib.skyframe.ConfiguredTargetKey;
import com.google.devtools.build.lib.util.OrderedSetMultimap;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
Expand Down Expand Up @@ -92,8 +92,7 @@ public static OrderedSetMultimap<Dependency, ConfiguredAspect> resolveAspectDepe

// Validate that aspect is applicable to "bare" configured target.
ConfiguredTargetAndData associatedTarget =
configuredTargetMap.get(
ConfiguredTargetValue.key(dep.getLabel(), dep.getConfiguration()));
configuredTargetMap.get(ConfiguredTargetKey.of(dep.getLabel(), dep.getConfiguration()));
if (!aspectMatchesConfiguredTarget(associatedTarget, aspectValue.getAspect())) {
continue;
}
Expand Down Expand Up @@ -126,7 +125,7 @@ public static OrderedSetMultimap<DependencyKind, ConfiguredTargetAndData> mergeA

for (Map.Entry<DependencyKind, Dependency> entry : depValueNames.entries()) {
Dependency dep = entry.getValue();
SkyKey depKey = ConfiguredTargetValue.key(dep.getLabel(), dep.getConfiguration());
SkyKey depKey = ConfiguredTargetKey.of(dep.getLabel(), dep.getConfiguration());
ConfiguredTargetAndData depConfiguredTarget = depConfiguredTargetMap.get(depKey);

result.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public Label getCorrectLabel(ConfiguredTargetValue configuredTargetValue) {
@Nullable
@Override
protected ConfiguredTargetValue getHostConfiguredTarget(Label label) throws InterruptedException {
return this.getConfiguredTargetValue(ConfiguredTargetValue.key(label, hostConfiguration));
return this.getConfiguredTargetValue(ConfiguredTargetKey.of(label, hostConfiguration));
}

@Nullable
Expand All @@ -246,12 +246,12 @@ protected ConfiguredTargetValue getTargetConfiguredTarget(Label label)
throws InterruptedException {
if (topLevelConfigurations.isTopLevelTarget(label)) {
return this.getConfiguredTargetValue(
ConfiguredTargetValue.key(
ConfiguredTargetKey.of(
label, topLevelConfigurations.getConfigurationForTopLevelTarget(label)));
} else {
ConfiguredTargetValue toReturn;
for (BuildConfiguration configuration : topLevelConfigurations.getConfigurations()) {
toReturn = this.getConfiguredTargetValue(ConfiguredTargetValue.key(label, configuration));
toReturn = this.getConfiguredTargetValue(ConfiguredTargetKey.of(label, configuration));
if (toReturn != null) {
return toReturn;
}
Expand All @@ -263,8 +263,7 @@ protected ConfiguredTargetValue getTargetConfiguredTarget(Label label)
@Nullable
@Override
protected ConfiguredTargetValue getNullConfiguredTarget(Label label) throws InterruptedException {
return this.getConfiguredTargetValue(
ConfiguredTargetValue.key(label, /* configuration= */ null));
return this.getConfiguredTargetValue(ConfiguredTargetKey.of(label, /* configuration= */ null));
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.google.devtools.build.lib.query2.engine.QueryExpression;
import com.google.devtools.build.lib.query2.engine.QueryVisibility;
import com.google.devtools.build.lib.skyframe.BuildConfigurationValue;
import com.google.devtools.build.lib.skyframe.ConfiguredTargetKey;
import com.google.devtools.build.lib.skyframe.ConfiguredTargetValue;
import com.google.devtools.build.lib.skyframe.PackageValue;
import com.google.devtools.build.lib.skyframe.UnloadedToolchainContext;
Expand Down Expand Up @@ -189,7 +190,7 @@ public RuleConfiguredTarget getGeneratingConfiguredTarget(OutputFileConfiguredTa
return (RuleConfiguredTarget)
((ConfiguredTargetValue)
walkableGraph.getValue(
ConfiguredTargetValue.key(
ConfiguredTargetKey.of(
oct.getGeneratingRule().getLabel(),
queryEnvironment.getConfiguration(oct))))
.getConfiguredTarget();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public QueryTaskFuture<Void> getTargetsMatchingPattern(
@Nullable
private ConfiguredTarget getConfiguredTarget(Label label, BuildConfiguration configuration)
throws InterruptedException {
return getValueFromKey(ConfiguredTargetValue.key(label, configuration));
return getValueFromKey(ConfiguredTargetKey.of(label, configuration));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ static ImmutableMap<Label, ConfigMatchingProvider> getConfigConditions(

// Get the configured targets as ConfigMatchingProvider interfaces.
for (Dependency entry : configConditionDeps) {
SkyKey baseKey = ConfiguredTargetValue.key(entry.getLabel(), entry.getConfiguration());
SkyKey baseKey = ConfiguredTargetKey.of(entry.getLabel(), entry.getConfiguration());
ConfiguredTarget value = configValues.get(baseKey).getConfiguredTarget();
// The code above guarantees that value is non-null here and since the rule is a
// config_setting, provider must also be non-null.
Expand Down Expand Up @@ -795,8 +795,7 @@ private static Map<SkyKey, ConfiguredTargetAndData> resolveConfiguredTargetDepen
Iterable<SkyKey> depKeys =
Iterables.concat(
Iterables.transform(
deps,
input -> ConfiguredTargetValue.key(input.getLabel(), input.getConfiguration())),
deps, input -> ConfiguredTargetKey.of(input.getLabel(), input.getConfiguration())),
Iterables.transform(
deps, input -> PackageValue.key(input.getLabel().getPackageIdentifier())));
Map<SkyKey, ValueOrException<ConfiguredValueCreationException>> depValuesOrExceptions =
Expand All @@ -808,7 +807,7 @@ private static Map<SkyKey, ConfiguredTargetAndData> resolveConfiguredTargetDepen
Collection<Dependency> depsToProcess = deps;
for (int i = 0; i < 2; i++) {
for (Dependency dep : depsToProcess) {
SkyKey key = ConfiguredTargetValue.key(dep.getLabel(), dep.getConfiguration());
SkyKey key = ConfiguredTargetKey.of(dep.getLabel(), dep.getConfiguration());
try {
ConfiguredTargetValue depValue =
(ConfiguredTargetValue) depValuesOrExceptions.get(key).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@
package com.google.devtools.build.lib.skyframe;

import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.skyframe.SkyKey;

/**
* A {@link com/google/devtools/build/lib/skyframe/ConfiguredTargetValue.java used only in javadoc:
* com.google.devtools.build.skyframe.SkyValue} for a {@link ConfiguredTarget}.
*/
public interface ConfiguredTargetValue extends ConfiguredObjectValue {
static SkyKey key(Label label, BuildConfiguration configuration) {
return ConfiguredTargetKey.of(label, configuration);
}

/** Returns the configured target for this value. */
ConfiguredTarget getConfiguredTarget();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,7 @@ private ImmutableMultimap<Dependency, ConfiguredTargetAndData> getConfiguredTarg
continue;
}
for (BuildConfiguration depConfig : configs.get(key)) {
skyKeys.add(ConfiguredTargetValue.key(key.getLabel(), depConfig));
skyKeys.add(ConfiguredTargetKey.of(key.getLabel(), depConfig));
for (AspectDescriptor aspectDescriptor : key.getAspects().getAllAspects()) {
skyKeys.add(
AspectValue.createAspectKey(key.getLabel(), depConfig, aspectDescriptor, depConfig));
Expand Down Expand Up @@ -1783,7 +1783,7 @@ private ImmutableMultimap<Dependency, ConfiguredTargetAndData> getConfiguredTarg
continue;
}
for (BuildConfiguration depConfig : configs.get(key)) {
SkyKey configuredTargetKey = ConfiguredTargetValue.key(key.getLabel(), depConfig);
SkyKey configuredTargetKey = ConfiguredTargetKey.of(key.getLabel(), depConfig);
if (result.get(configuredTargetKey) == null) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.devtools.build.lib.events.ExtendedEventHandler;
import com.google.devtools.build.lib.packages.NoSuchTargetException;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.skyframe.ConfiguredTargetKey;
import com.google.devtools.build.lib.skyframe.ConfiguredTargetValue;
import com.google.devtools.build.lib.skyframe.PackageValue;
import com.google.devtools.build.lib.skyframe.SkyFunctions;
Expand Down Expand Up @@ -88,7 +89,7 @@ public static <T extends SkyValue> EvaluationResult<T> evaluate(
public static ConfiguredTargetValue getExistingConfiguredTargetValue(
SkyframeExecutor skyframeExecutor, Label label, BuildConfiguration config)
throws InterruptedException {
SkyKey key = ConfiguredTargetValue.key(label, config);
SkyKey key = ConfiguredTargetKey.of(label, config);
return (ConfiguredTargetValue) getExistingValue(skyframeExecutor, key);
}

Expand Down

0 comments on commit 41a3cb0

Please sign in to comment.