aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
diff options
context:
space:
mode:
authorGravatar Michajlo Matijkiw <michajlo@google.com>2016-08-09 20:35:45 +0000
committerGravatar Yue Gan <yueg@google.com>2016-08-10 08:37:52 +0000
commit6d4714164d312375b7dd3849130b2977665d86ce (patch)
treee7b98cfd166e3626dfb01b92a46919b60b6fef7a /src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
parent679e911e948e6965afe1c23bb20ac4efdd65bac4 (diff)
Allow ImplicitOutputsFunctions to be overriden on Rule creation.
-- MOS_MIGRATED_REVID=129787305
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.java29
1 files changed, 19 insertions, 10 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 62f8a24903..751e6cf7f6 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
@@ -1136,18 +1136,21 @@ public final class RuleClass {
}
/**
- * Returns the function which determines the set of implicit outputs
- * generated by a given rule.
+ * Returns the default function for determining the set of implicit outputs generated by a given
+ * rule. If not otherwise specified, this will be the implementation used by {@link Rule}s
+ * created with this {@link RuleClass}.
*
- * <p>An implicit output is an OutputFile that automatically comes into
- * existence when a rule of this class is declared, and whose name is derived
- * from the name of the rule.
+ * <p>Do not use this value to calculate implicit outputs for a rule, instead use
+ * {@link Rule#getImplicitOutputsFunction()}.
*
- * <p>Implicit outputs are a widely-relied upon. All ".so",
- * and "_deploy.jar" targets referenced in BUILD files are examples.
+ * <p>An implicit output is an OutputFile that automatically comes into existence when a rule of
+ * this class is declared, and whose name is derived from the name of the rule.
+ *
+ * <p>Implicit outputs are a widely-relied upon. All ".so", and "_deploy.jar" targets referenced
+ * in BUILD files are examples.
*/
@VisibleForTesting
- public ImplicitOutputsFunction getImplicitOutputsFunction() {
+ public ImplicitOutputsFunction getDefaultImplicitOutputsFunction() {
return implicitOutputsFunction;
}
@@ -1349,9 +1352,15 @@ public final class RuleClass {
Label ruleLabel,
AttributeValuesMap attributeValues,
Location location,
- AttributeContainer attributeContainer)
+ AttributeContainer attributeContainer,
+ ImplicitOutputsFunction implicitOutputsFunction)
throws LabelSyntaxException, InterruptedException {
- Rule rule = pkgBuilder.createRule(ruleLabel, this, location, attributeContainer);
+ Rule rule = pkgBuilder.createRule(
+ ruleLabel,
+ this,
+ location,
+ attributeContainer,
+ implicitOutputsFunction);
populateRuleAttributeValues(rule, pkgBuilder, attributeValues, NullEventHandler.INSTANCE);
rule.populateOutputFiles(NullEventHandler.INSTANCE, pkgBuilder);
return rule;