aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skyframe
diff options
context:
space:
mode:
authorGravatar janakr <janakr@google.com>2018-01-18 07:45:12 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-18 07:47:19 -0800
commitf3e6f251d3823a826918ad762d1f69f84030ef8c (patch)
tree6913889c0eeb17dcc51d81faf871abde9ea69c93 /src/test/java/com/google/devtools/build/lib/skyframe
parentaad6304ad938cae6010c1d58f01d92a12a81ac1a (diff)
Start the process of getting Target out of ConfiguredTarget: add a new container, ConfiguredTargetAndTarget, that can be used to access Targets, and deprecate ConfiguredTarget#getTarget. ConfiguredAndTargetObjects are intended to be limited in scope, not being persisted to Skyframe.
The eventual plan is to remove the target field from ConfiguredTarget. This CL is mostly straightforward, except for dealing with AliasConfiguredTargets, which cause some complications. A significant cleanup is still needed before #getTarget can be removed, but I don't see any impossible blockers. We will may still need to store a Target-like object in ConfiguredTarget (that has the RuleClass, or at least a string representation of it, for instance), but that will let us avoid storing a full Target together with its associated Package. PiperOrigin-RevId: 182371566
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skyframe')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java
index 11719c2d2c..fa289c0d94 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ConfigurationsForTargetsTest.java
@@ -19,6 +19,7 @@ import static org.junit.Assert.fail;
import com.google.common.base.VerifyException;
import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Collections2;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -110,8 +111,9 @@ public class ConfigurationsForTargetsTest extends AnalysisTestCase {
* deps of given target.
*/
static class Value implements SkyValue {
- OrderedSetMultimap<Attribute, ConfiguredTarget> depMap;
- Value(OrderedSetMultimap<Attribute, ConfiguredTarget> depMap) {
+ OrderedSetMultimap<Attribute, ConfiguredTargetAndTarget> depMap;
+
+ Value(OrderedSetMultimap<Attribute, ConfiguredTargetAndTarget> depMap) {
this.depMap = depMap;
}
}
@@ -120,11 +122,13 @@ public class ConfigurationsForTargetsTest extends AnalysisTestCase {
public SkyValue compute(SkyKey skyKey, Environment env)
throws EvalException, InterruptedException {
try {
- OrderedSetMultimap<Attribute, ConfiguredTarget> depMap =
+ OrderedSetMultimap<Attribute, ConfiguredTargetAndTarget> depMap =
ConfiguredTargetFunction.computeDependencies(
env,
- new SkyframeDependencyResolver(env, ((ConfiguredRuleClassProvider) stateProvider
- .lateBoundRuleClassProvider()).getDynamicTransitionMapper()),
+ new SkyframeDependencyResolver(
+ env,
+ ((ConfiguredRuleClassProvider) stateProvider.lateBoundRuleClassProvider())
+ .getDynamicTransitionMapper()),
(TargetAndConfiguration) skyKey.argument(),
ImmutableList.<Aspect>of(),
ImmutableMap.<Label, ConfigMatchingProvider>of(),
@@ -198,7 +202,7 @@ public class ConfigurationsForTargetsTest extends AnalysisTestCase {
* Returns the configured deps for a given target, assuming the target uses the target
* configuration.
*/
- private Multimap<Attribute, ConfiguredTarget> getConfiguredDeps(String targetLabel)
+ private Multimap<Attribute, ConfiguredTargetAndTarget> getConfiguredDeps(String targetLabel)
throws Exception {
update(targetLabel);
SkyKey key = ComputeDependenciesFunction.key(getTarget(targetLabel), getTargetConfiguration());
@@ -219,10 +223,12 @@ public class ConfigurationsForTargetsTest extends AnalysisTestCase {
*/
protected List<ConfiguredTarget> getConfiguredDeps(String targetLabel, String attrName)
throws Exception {
- Multimap<Attribute, ConfiguredTarget> allDeps = getConfiguredDeps(targetLabel);
+ Multimap<Attribute, ConfiguredTargetAndTarget> allDeps = getConfiguredDeps(targetLabel);
for (Attribute attribute : allDeps.keySet()) {
if (attribute.getName().equals(attrName)) {
- return ImmutableList.copyOf(allDeps.get(attribute));
+ return ImmutableList.copyOf(
+ Collections2.transform(
+ allDeps.get(attribute), ConfiguredTargetAndTarget::getConfiguredTarget));
}
}
throw new AssertionError(