aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages/Package.java
diff options
context:
space:
mode:
authorGravatar Mark Schaller <mschaller@google.com>2016-01-13 18:41:24 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-01-14 09:53:17 +0000
commitee624453d9f5dd908d721abb4663246c70bf4509 (patch)
treeba90c489d6fb079438a8015f786fc3c9f1cad0c3 /src/main/java/com/google/devtools/build/lib/packages/Package.java
parent3d9441bb4fc224c6551f5063d2a5d2c84a76e3e8 (diff)
For native rule classes, (de)serialize only explicit attrs
Native rule classes can provide default values for rules after they're deserialized, so there isn't a need to serialize those default values. This doesn't apply yet to rules with Skylark-defined rule classes, due to the non-serializablity of Skylark rule classes. -- MOS_MIGRATED_REVID=112066930
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages/Package.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Package.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java
index ecf1df70dc..bc7804475c 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Package.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java
@@ -1001,17 +1001,16 @@ public class Package {
}
/**
- * Returns a new Rule belonging to this package instance, and uses the given Label.
+ * Creates a new {@link Rule} {@code r} where {@code r.getPackage()} is the {@link Package}
+ * associated with this {@link Builder}.
*
- * <p>Useful for RuleClass instantiation, where the rule name is checked by trying to create a
- * Label. This label can then be used again here.
+ * <p>The created {@link Rule} will have no attribute values, no output files, and therefore
+ * will be in an invalid state.
*/
- Rule newRuleWithLabel(Label label, RuleClass ruleClass, Location location) {
- return newRuleWithLabelAndAttrContainer(label, ruleClass, location,
- new AttributeContainer(ruleClass));
- }
-
- Rule newRuleWithLabelAndAttrContainer(Label label, RuleClass ruleClass, Location location,
+ Rule createRule(
+ Label label,
+ RuleClass ruleClass,
+ Location location,
AttributeContainer attributeContainer) {
return new Rule(pkg, label, ruleClass, location, attributeContainer);
}