From 015e5954157a6c071b6118b3d9b9f51676ccc6f3 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 14 Feb 2017 09:45:30 +0000 Subject: Remove special handling of name attribute. Fixes #278 The name attribute gets special treatment in the codebase, in that it's not simply yet another attribute but stored in it's own field. Thus, every callside dealing with attributes needs to be aware of this special case and explicitly handle the name attribute. It's easy to see that this can lead to bugs. For example, querying for the name attribute is currently broken due the querying code not being aware of the special case [1]. Discussions with experienced bazel developers came to the conclusion that there is no need (anymore) to treat the name attribute specially and thus we decided it's best to remove the special treatment and handle the name attribute as any other attribute. This change removes the handling of name attributes and also adds a test case to verify that bug [1] is fixed. [1] https://github.com/bazelbuild/bazel/issues/278 -- PiperOrigin-RevId: 147446345 MOS_MIGRATED_REVID=147446345 --- .../java/com/google/devtools/build/lib/analysis/util/TestAspects.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/test/java/com/google') diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/TestAspects.java b/src/test/java/com/google/devtools/build/lib/analysis/util/TestAspects.java index 0566c43c36..2f5595f4af 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/TestAspects.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/TestAspects.java @@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; +import com.google.devtools.build.lib.analysis.BaseRuleClasses; import com.google.devtools.build.lib.analysis.ConfiguredAspect; import com.google.devtools.build.lib.analysis.ConfiguredAspectFactory; import com.google.devtools.build.lib.analysis.ConfiguredTarget; @@ -497,6 +498,7 @@ public class TestAspects { return RuleDefinition.Metadata.builder() .name("base") .factoryClass(DummyRuleFactory.class) + .ancestors(BaseRuleClasses.RootRule.class) .build(); } } -- cgit v1.2.3