From f3e6f251d3823a826918ad762d1f69f84030ef8c Mon Sep 17 00:00:00 2001 From: janakr Date: Thu, 18 Jan 2018 07:45:12 -0800 Subject: [PATCH] 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 --- .../build/lib/analysis/AliasProvider.java | 7 +- .../build/lib/analysis/AspectResolver.java | 28 ++-- .../build/lib/analysis/BuildView.java | 38 ++--- .../analysis/ConfiguredRuleClassProvider.java | 18 ++- .../build/lib/analysis/ConfiguredTarget.java | 7 +- .../lib/analysis/ConfiguredTargetFactory.java | 30 ++-- .../build/lib/analysis/RuleContext.java | 132 +++++++++++------- .../build/lib/analysis/TargetContext.java | 16 ++- .../build/lib/analysis/ToolchainContext.java | 12 +- .../rules/BazelPrerequisiteValidator.java | 14 +- .../build/lib/skyframe/AspectFunction.java | 43 ++++-- .../skyframe/ConfiguredTargetAndTarget.java | 64 +++++++++ .../skyframe/ConfiguredTargetFunction.java | 125 ++++++++++++----- .../build/lib/skyframe/SkyframeBuildView.java | 2 +- .../build/lib/skyframe/SkyframeExecutor.java | 124 ++++++++++------ .../ConfigurationsForTargetsTest.java | 22 +-- 16 files changed, 467 insertions(+), 215 deletions(-) create mode 100644 src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetAndTarget.java diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AliasProvider.java b/src/main/java/com/google/devtools/build/lib/analysis/AliasProvider.java index e792cb6a754d80..e650ec53438f4b 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/AliasProvider.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/AliasProvider.java @@ -18,6 +18,7 @@ import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; +import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndTarget; /** * A provider that gives information about the aliases a rule was resolved through. @@ -65,12 +66,12 @@ public ImmutableList