From 642d7d4e93486e7fefa3c8ec01f56c48a8b590ca Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 12 Mar 2015 15:48:09 +0000 Subject: BazelActionListenerRule is documented. -- MOS_MIGRATED_REVID=88444163 --- .../rules/common/BazelActionListenerRule.java | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'src/main/java/com/google/devtools/build') diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/common/BazelActionListenerRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/common/BazelActionListenerRule.java index eba1553ac8..0865c34bbc 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/common/BazelActionListenerRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/common/BazelActionListenerRule.java @@ -35,7 +35,22 @@ public final class BazelActionListenerRule implements RuleDefinition { @Override public RuleClass build(Builder builder, RuleDefinitionEnvironment environment) { return builder + /* + A list of action mnemonics this action_listener should listen + for, e.g. [ "Javac" ]. + ${SYNOPSIS} +

+ Mnemonics are not a public interface. + There's no guarantee that the mnemonics and their actions don't change. +

+ */ .add(attr("mnemonics", STRING_LIST).mandatory()) + /* + A list of extra_action targets + this action_listener should add to the build graph. + ${SYNOPSIS} + E.g. [ "//my/tools:analyzer" ]. + */ .add(attr("extra_actions", LABEL_LIST).mandatory() .allowedRuleClasses("extra_action") .allowedFileTypes()) @@ -45,3 +60,52 @@ public final class BazelActionListenerRule implements RuleDefinition { .build(); } } + +/* + +

+ DISCLAIMER: + This is an experimental feature, expect breaking changes when + implementing an action_listener/extra_action. +

+ +${ATTRIBUTE_SIGNATURE} + +

+ An action_listener rule doesn't produce any output itself. + Instead, it allows tool developers to insert + extra_actions into the build system, + by providing a mapping from action to extra_action. +

+ +

+ This rule's arguments map action mnemonics to + extra_action rules. +

+ +

+ By specifying the option + --experimental_action_listener=<label>, + the build will use the specified action_listener to insert + extra_actions into the build graph. +

+ +${ATTRIBUTE_DEFINITION} + +

Example

+
+    action_listener(name = "index_all_languages",
+                    mnemonics = [ "Javac", "CppCompile" ],
+                    extra_actions = [ ":indexer" ])
+
+    action_listener(name = "index_java",
+                    mnemonics = [ "Javac" ],
+                    extra_actions = [ ":indexer" ])
+
+    extra_action(name = "indexer",
+                 tools = [ "//my/tools:indexer" ],
+                 cmd = "$(location //my/tools:indexer)" +
+                       "--extra_action_file=$(EXTRA_ACTION_FILE)")
+
+ +*/ -- cgit v1.2.3