diff options
author | 2016-12-16 16:52:37 +0000 | |
---|---|---|
committer | 2016-12-16 17:08:09 +0000 | |
commit | 1575652972d80f224fb3f7398eef3439e4f5a5dd (patch) | |
tree | 419932b5b7e4379331953aa41e3b9a04b871f9f0 /src/main/java/com/google/devtools/build/lib/packages/Aspect.java | |
parent | bb984fd26f0fc9b519eb11fe330852f8d1b708a7 (diff) |
Names of extra-action protos now take into account all aspect names.
If an Aspect registered an action that an extra-action is
shadowing, its name is used when creating the extra-action's ID and
name.
Since recently, an aspect can see other aspects applied to the same
target. This CL record the names of other aspects applied to the target
as well, disambiguating the action owners.
--
PiperOrigin-RevId: 142264153
MOS_MIGRATED_REVID=142264153
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages/Aspect.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/packages/Aspect.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Aspect.java b/src/main/java/com/google/devtools/build/lib/packages/Aspect.java index 8e0be0cfe1..817bc3c69c 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/Aspect.java +++ b/src/main/java/com/google/devtools/build/lib/packages/Aspect.java @@ -30,20 +30,17 @@ public final class Aspect implements DependencyFilter.AttributeInfoProvider { /** */ public static final String INJECTING_RULE_KIND_PARAMETER_KEY = "$injecting_rule_kind"; - // TODO(bazel-team): class objects are not really hashable or comparable for equality other than - // by reference. We should identify the aspect here in a way that does not rely on comparison - // by reference so that keys can be serialized and deserialized properly. - private final AspectClass aspectClass; - private final AspectParameters parameters; + private final AspectDescriptor aspectDescriptor; private final AspectDefinition aspectDefinition; private Aspect( AspectClass aspectClass, AspectDefinition aspectDefinition, AspectParameters parameters) { - this.aspectClass = Preconditions.checkNotNull(aspectClass); + this.aspectDescriptor = new AspectDescriptor( + Preconditions.checkNotNull(aspectClass), + Preconditions.checkNotNull(parameters)); this.aspectDefinition = Preconditions.checkNotNull(aspectDefinition); - this.parameters = Preconditions.checkNotNull(parameters); } public static Aspect forNative( @@ -66,19 +63,23 @@ public final class Aspect implements DependencyFilter.AttributeInfoProvider { * Returns the aspectClass required for building the aspect. */ public AspectClass getAspectClass() { - return aspectClass; + return aspectDescriptor.getAspectClass(); } /** * Returns parameters for evaluation of the aspect. */ public AspectParameters getParameters() { - return parameters; + return aspectDescriptor.getParameters(); + } + + public AspectDescriptor getDescriptor() { + return aspectDescriptor; } @Override public String toString() { - return String.format("Aspect %s(%s)", aspectClass, parameters); + return String.format("Aspect %s", aspectDescriptor.toString()); } public AspectDefinition getDefinition() { |