aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
diff options
context:
space:
mode:
authorGravatar Mark Schaller <mschaller@google.com>2015-07-07 22:29:28 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-07-08 11:41:42 +0000
commit766e96f76a9c62fd1b6779588874a6329080c2c1 (patch)
tree3a294939c2492a8d928fe0c638b54a340ec4031c /src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
parent6ab88033fc55a7344fcda528c2490ce0ea8eab93 (diff)
[]*** Reason for rollback *** Large number of newly broken targets found by [] *** Original change description *** Provide placeholder rule class for deserialized Skylark rules At this time, Skylark-defined rule classes don't get serialized, and aren't available at package deserialization time. To allow packages with Skylark-defined rule classes to deserialize, we provide a placeholder rule class implementation for deserialized Skylark rules. -- MOS_MIGRATED_REVID=97716849
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages/RuleClass.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/RuleClass.java43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
index e7cbf9edec..0286796470 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
@@ -31,7 +31,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Ordering;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.Location;
-import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
import com.google.devtools.build.lib.syntax.Argument;
import com.google.devtools.build.lib.syntax.BaseFunction;
import com.google.devtools.build.lib.syntax.Environment;
@@ -340,29 +339,6 @@ public final class RuleClass {
attribute.getName(), attribute.getType());
}
}
- },
-
- /**
- * Placeholder rules are only instantiated when packages which refer to non-native rule
- * classes are deserialized. At this time, non-native rule classes can't be serialized. To
- * prevent crashes on deserialization, when a package containing a rule with a non-native rule
- * class is deserialized, the rule is assigned a placeholder rule class. This is compatible
- * with our limited set of package serialization use cases.
- *
- * Placeholder rule class names obey the rule for identifiers.
- */
- PLACEHOLDER {
- @Override
- public void checkName(String name) {
- Preconditions.checkArgument(RULE_NAME_PATTERN.matcher(name).matches(), name);
- }
-
- @Override
- public void checkAttributes(Map<String, Attribute> attributes) {
- // No required attributes; this rule class cannot have the wrong set of attributes now
- // because, if it did, the rule class would have failed to build before the package
- // referring to it was serialized.
- }
};
/**
@@ -714,11 +690,6 @@ public final class RuleClass {
}
}
- /** True if the rule class contains an attribute named {@code name}. */
- public boolean contains(String name) {
- return attributes.containsKey(name);
- }
-
/**
* Sets the rule implementation function. Meant for Skylark usage.
*/
@@ -818,20 +789,6 @@ public final class RuleClass {
}
}
- public static Builder createPlaceholderBuilder(final String name, final Location ruleLocation,
- ImmutableList<RuleClass> parents) {
- return new Builder(name, RuleClassType.PLACEHOLDER, /*skylark=*/true,
- parents.toArray(new RuleClass[parents.size()])).factory(
- new ConfiguredTargetFactory<Object, Object>() {
- @Override
- public Object create(Object ruleContext) throws InterruptedException {
- throw new IllegalStateException(
- "Cannot create configured targets from rule with placeholder class named \"" + name
- + "\" at " + ruleLocation);
- }
- });
- }
-
private final String name; // e.g. "cc_library"
/**