From 2b81545de77afb691c3d5f4243f60efe8fb97d1b Mon Sep 17 00:00:00 2001 From: lberki Date: Tue, 10 Apr 2018 05:59:54 -0700 Subject: Improve documentation of genquery. RELNOTES: None. PiperOrigin-RevId: 192274504 --- .../build/lib/rules/genquery/GenQuery.java | 2 ++ .../build/lib/rules/genquery/GenQueryRule.java | 25 ++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java index 5149f50df8..95c45dea83 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java +++ b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java @@ -123,6 +123,8 @@ public class GenQuery implements RuleConfiguredTargetFactory { // Parsed query options QueryOptions queryOptions = optionsParser.getOptions(QueryOptions.class); + // If you change the list of options here, also change the documentation of genquery.opts in + // GenQueryRule.java . if (optionsParser.getOptions(KeepGoingOption.class).keepGoing) { ruleContext.attributeError("opts", "option --keep_going is not allowed"); return null; diff --git a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQueryRule.java b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQueryRule.java index 7565717e57..ce273b0078 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQueryRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQueryRule.java @@ -34,26 +34,29 @@ public final class GenQueryRule implements RuleDefinition { public RuleClass build(Builder builder, RuleDefinitionEnvironment env) { return builder /* - The scope of the query. The query is not allowed to - touch targets outside the transitive closure of these targets. + The scope of the query. The query is not allowed to touch targets outside the transitive + closure of these targets. */ .add(attr("scope", LABEL_LIST).mandatory().legacyAllowAnyFileType()) /* - If true, targets whose queries escape the transitive closure of their - scopes will fail to build. If false, Blaze will print a warning and skip - whatever query path led it outside of the scope, while completing the rest - of the query. + If true, targets whose queries escape the transitive closure of their scopes will fail to + build. If false, Blaze will print a warning and skip whatever query path led it outside of + the scope, while completing the rest of the query. */ .add(attr("strict", BOOLEAN).value(true)) /* - The query to be executed. + The query to be executed. In contrast to the command line and other places in BUILD files, + labels here are resolved relative to the root directory of the workspace. For example, the + label :b in this attribute in the file a/BUILD will refer to the + target //:b. */ .add(attr("expression", STRING).mandatory()) /* - The options that are passed to the query engine. - These correspond to the command line options that can be passed to - blaze query. The only query options that are not allowed here - are --keep_going and --order_output. + The options that are passed to the query engine. These correspond to the command line + options that can be passed to blaze query. Some query options are not allowed + here: --keep_going, --query_file, --universe_scope, + --order_results and --order_output. Options not specified here + will have their default values just like on the command line of blaze query. */ .add(attr("opts", STRING_LIST)) .build(); -- cgit v1.2.3