aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/repository/WorkspaceBaseRule.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-02-14 09:45:30 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2017-02-14 14:23:49 +0000
commit015e5954157a6c071b6118b3d9b9f51676ccc6f3 (patch)
treec55d6011439c6f6702c67a5249a6a590fcccc1d1 /src/main/java/com/google/devtools/build/lib/rules/repository/WorkspaceBaseRule.java
parent10e3f00ba1bcb5b5375e88a2b5d03d056aa4bf33 (diff)
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
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/repository/WorkspaceBaseRule.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/repository/WorkspaceBaseRule.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/WorkspaceBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/repository/WorkspaceBaseRule.java
index 581559ca39..2130d1a67a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/repository/WorkspaceBaseRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/repository/WorkspaceBaseRule.java
@@ -17,6 +17,7 @@ package com.google.devtools.build.lib.rules.repository;
import static com.google.devtools.build.lib.packages.Attribute.attr;
import static com.google.devtools.build.lib.syntax.Type.STRING;
+import com.google.devtools.build.lib.analysis.BaseRuleClasses.RootRule;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.packages.RuleClass;
@@ -42,6 +43,7 @@ public class WorkspaceBaseRule implements RuleDefinition {
return RuleDefinition.Metadata.builder()
.name("$workspace_base_rule")
.type(RuleClassType.ABSTRACT)
+ .ancestors(RootRule.class)
.build();
}
}