ルール
action_listener
action_listener(name, compatible_with, deprecation, distribs, exec_compatible_with, exec_properties, extra_actions, features, licenses, mnemonics, restricted_to, tags, target_compatible_with, testonly, visibility)
警告: 追加のアクションはサポートが終了します。代わりにアスペクトを使用してください。
action_listener
ルールは、それ自体の出力を生成しません。 代わりに、デベロッパーがコンテンツを挿入できる
extra_action
s をビルドシステムに追加するextra_action
。
このルールの引数により、アクションのニーモニックが extra_action
ルールにマッピングされます。
--experimental_action_listener=<label>
オプションを指定すると、指定された action_listener
を使用してビルドが extra_action
を挿入します。ビルドグラフ。
例
action_listener( name = "index_all_languages", mnemonics = [ "Javac", "CppCompile", "Python", ], 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)", )
引数
属性 | |
---|---|
name |
このターゲットの一意の名前。 |
extra_actions
|
action_listener のターゲットがビルドグラフに追加される extra_action ターゲットのリストです。
(例: [ "//my/tools:analyzer" ] )。
|
mnemonics
|
action_listener がリッスンするアクションニーモニックのリスト(例: [ "Javac" ] )。
ニーモニックは公開インターフェースではありません。 ニーモニックとその動作が変化しないという保証はありません。 |
extra_action
extra_action(name, data, cmd, compatible_with, deprecation, distribs, exec_compatible_with, exec_properties, features, licenses, out_templates, requires_action_output, restricted_to, tags, target_compatible_with, testonly, toolchains, tools, visibility)
警告: 追加のアクションはサポートが終了します。代わりにアスペクトを使用してください。
extra_action
ルールは、通常のビルド ターゲットとして指定されている場合、意味のある出力を生成しません。代わりに、既存のアクションをシャドーイングする追加のアクションをビルドグラフに挿入できます。
extra_action
を有効にする方法については、action_listener
をご覧ください。
extra_action
はコマンドラインとして実行されます。コマンドライン ツールは、プロトコル バッファを含むファイル($(EXTRA_ACTION_FILE))にアクセスして、シャドーイングする元のアクションに関する詳細情報を取得します。 また、元のアクションでアクセスできるすべての入力ファイルにもアクセスできます。
プロトコル バッファ内に保存されるデータの詳細については、extra_actions_base.proto をご覧ください。各 proto ファイルには、ExtraActionInfo メッセージが含まれています。
他のすべてのアクションと同様に、追加のアクションはサンドボックス化され、その処理を行うように設計する必要があります。
引数
属性 | |
---|---|
name |
このターゲットの一意の名前。 このルールは、 action_listener ルールの extra_actions 引数で、label を使用して参照できます。 |
cmd
|
ただし、genrule cmd 属性との違いは次のとおりです。
|
out_templates
|
extra_action コマンドで生成されたファイルのテンプレートのリスト。 テンプレートでは以下の変数を使用できます。
|
requires_action_output
|
extra_action は、元のアクションの出力がこの extra_action への入力として存在する必要があることを示します。
true(デフォルトは false)の場合、extra_action は、元のアクション出力がその入力の一部として使用できると想定できます。 |
tools
|
tool 依存関係のリスト。
詳細については、依存関係の定義をご覧ください。
ビルドシステムは、 ツールとそのデータ依存関係は 1 つのツリーに統合されるため、コマンドで相対パスを使用できます。作業ディレクトリが統合ツリーのルートになります。 |