diff options
author | John Cater <jcater@google.com> | 2017-01-20 16:19:53 +0000 |
---|---|---|
committer | Laszlo Csomor <laszlocsomor@google.com> | 2017-01-23 09:50:13 +0000 |
commit | 1ba41a8c4fa6d21c48145ef3e91cd0315ccac574 (patch) | |
tree | 0195ab83361d35384c48f26c79c8a126511c8a8f /src | |
parent | ea78fbe047853642592ae5d4ac1acdb8200760ae (diff) |
Update GenRuleRule attribute documentation. Also rename files pending a merge
with the internal GenRule implementation.
--
PiperOrigin-RevId: 145087704
MOS_MIGRATED_REVID=145087704
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java | 3 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRule.java (renamed from src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java) | 4 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleAction.java (renamed from src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleAction.java) | 4 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java | 47 |
4 files changed, 38 insertions, 20 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java b/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java index eb4208aef4..3ffc18c8f4 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java @@ -40,8 +40,7 @@ import java.util.Map.Entry; import javax.annotation.Nullable; /** - * Provides shared functionality for parameterized command-line launching - * e.g. {@link com.google.devtools.build.lib.view.genrule.GenRule} + * Provides shared functionality for parameterized command-line launching. * Also used by {@link com.google.devtools.build.lib.rules.extra.ExtraActionFactory}. * * Two largely independent separate sets of functionality are provided: diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRule.java index 3368c9ce97..d257ccbbe7 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRule.java @@ -50,7 +50,7 @@ import java.util.Map; /** * An implementation of genrule. */ -public class GenRule implements RuleConfiguredTargetFactory { +public class BazelGenRule implements RuleConfiguredTargetFactory { private Artifact getExecutable(RuleContext ruleContext, NestedSet<Artifact> filesToBuild) { if (Iterables.size(filesToBuild) == 1) { @@ -135,7 +135,7 @@ public class GenRule implements RuleConfiguredTargetFactory { } ruleContext.registerAction( - new GenRuleAction( + new BazelGenRuleAction( ruleContext.getActionOwner(), ImmutableList.copyOf(commandHelper.getResolvedTools()), inputs.build(), diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleAction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleAction.java index b745972261..209b15d095 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleAction.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleAction.java @@ -31,13 +31,13 @@ import java.util.List; * A spawn action for genrules. Genrules are handled specially in that inputs and outputs are * checked for directories. */ -public final class GenRuleAction extends SpawnAction { +public final class BazelGenRuleAction extends SpawnAction { private static final ResourceSet GENRULE_RESOURCES = // Not chosen scientifically/carefully. 300MB memory, 100% CPU, no I/O. ResourceSet.createWithRamCpuIo(300, 1.0, 0.0); - public GenRuleAction( + public BazelGenRuleAction( ActionOwner owner, Iterable<Artifact> tools, Iterable<Artifact> inputs, diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java index f0f6025b73..2579c1e194 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/BazelGenRuleRule.java @@ -44,8 +44,9 @@ public final class BazelGenRuleRule implements RuleDefinition { @Override public RuleClass build(Builder builder, RuleDefinitionEnvironment env) { /* <!-- #BLAZE_RULE(genrule).NAME --> - <br/>You may refer to this rule by name in the <code>srcs</code> or <code>deps</code> section of - other <code>BUILD</code> rules. If the rule generates source files, you should use the + <br/>You may refer to this rule by name in the + <code>srcs</code> or <code>deps</code> section of other <code>BUILD</code> + rules. If the rule generates source files, you should use the <code>srcs</code> attribute. <!-- #END_BLAZE_RULE.NAME --> */ return builder @@ -72,7 +73,8 @@ public final class BazelGenRuleRule implements RuleDefinition { .legacyAllowAnyFileType()) /* <!-- #BLAZE_RULE(genrule).ATTRIBUTE(tools) --> - A list of <i>tool</i> dependencies for this rule. + A list of <i>tool</i> dependencies for this rule. See the definition of + <a href="../build-ref.html#deps">dependencies</a> for more information. <br/> <p> The build system ensures these prerequisites are built before running the genrule command; they are built using the <a href='../blaze-user-manual.html#configurations'><i>host</i> @@ -136,14 +138,20 @@ public final class BazelGenRuleRule implements RuleDefinition { </li> </ol> <p> - The command may refer to binaries that were declared as - <a href="${link genrule.tools}"><code>tools</code></a>; it should use a - <a href="../build-ref.html#labels">label</a> and <code>$(location)</code> expansion for - this. - The <a href="${link make-variables#predefined_variables}">Predefined "Make" Variables</a> - and the <a href="${link make-variables#predefined_variables.genrule.cmd}"> - genrule-specific "Make" variables</a> are also available for <code>cmd</code>. - </p> + The command may refer to <code>*_binary</code>targets; it should use a <a + href="../build-ref.html#labels">label</a> for this. The following + variables are available within the <code>cmd</code> sublanguage:</p> + <ul> + <li> + <a href="${link make-variables#predefined_variables.genrule.cmd}">"Make" variables</a> + </li> + <li> + "Make" variables that are predefined by the build tools. + Please use these variables instead of hardcoded values. + See <a href="${link make-variables#predefined_variables}">Predefined "Make" Variables + </a> in this document for a list of supported values. + </li> + </ul> <!-- #END_BLAZE_RULE.ATTRIBUTE --> */ .add(attr("cmd", STRING).mandatory()) @@ -162,6 +170,13 @@ public final class BazelGenRuleRule implements RuleDefinition { If set to 1, this option force this <code>genrule</code> to run with the <code>standalone</code> strategy, without sandboxing. </p> + <p> + This is equivalent to providing 'local' as a tag (<code>tags=["local"]</code>). The + local strategy is applied if either one is specified. + </p> + <p> + The <code>--genrule_strategy</code> option value <code>local</code> + overrides this attribute. <!-- #END_BLAZE_RULE.ATTRIBUTE --> */ .add(attr("local", BOOLEAN).value(false)) @@ -176,14 +191,18 @@ public final class BazelGenRuleRule implements RuleDefinition { </p> <!-- #END_BLAZE_RULE.ATTRIBUTE --> */ .add(attr("message", STRING)) + /*<!-- #BLAZE_RULE(genrule).ATTRIBUTE(output_licenses) --> + See <a href="${link common-definitions#binary.output_licenses}"><code>common attributes + </code></a> + <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/ .add(attr("output_licenses", LICENSE)) /* <!-- #BLAZE_RULE(genrule).ATTRIBUTE(executable) --> Declare output to be executable. <p> Setting this flag to 1 means the output is an executable file and can be run using the - <code>bazel run</code> command. The genrule must produce exactly one output in this case. - If this attribute is set, <code>bazel run</code> will try executing the file regardless of + <code>run</code> command. The genrule must produce exactly one output in this case. + If this attribute is set, <code>run</code> will try executing the file regardless of its content. </p> <p>Declaring data dependencies for the generated executable is not supported.</p> @@ -218,7 +237,7 @@ public final class BazelGenRuleRule implements RuleDefinition { return RuleDefinition.Metadata.builder() .name("genrule") .ancestors(BaseRuleClasses.RuleBase.class) - .factoryClass(GenRule.class) + .factoryClass(BazelGenRule.class) .build(); } } |