aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkgui <kgui@google.com>2022-05-26 23:05:53 +0800
committerKeyi Gui <kgui@google.com>2022-06-10 06:36:26 +0000
commit65239c8c8091e71878ce9c0b58a3444b895c41b0 (patch)
treeb6f264fe79cec7d62680b71d2ea63efdcc91901a
parentc7d5439fbb542949f0f44fbc825f3dd48ce344ff (diff)
downloadbazel-65239c8c8091e71878ce9c0b58a3444b895c41b0.tar.gz
Create a shared jq script to help find modules with test_suites property and the property contains the input argument.android13-dev
Bug: 235555073 Test: no Change-Id: I7a57ff3ec136440d4693d6549a39489e872fa53d Merged-In: I7a57ff3ec136440d4693d6549a39489e872fa53d
-rw-r--r--json_module_graph/findModulesWithTestSuitesValue.jq12
1 files changed, 12 insertions, 0 deletions
diff --git a/json_module_graph/findModulesWithTestSuitesValue.jq b/json_module_graph/findModulesWithTestSuitesValue.jq
new file mode 100644
index 00000000..02af5975
--- /dev/null
+++ b/json_module_graph/findModulesWithTestSuitesValue.jq
@@ -0,0 +1,12 @@
+# CMD: Returns the modules that have test_suites property with $arg as one of its value.
+# Use $arg2 as the top level field key to be collected, e.g. Name, Blueprint.
+
+def hasTestSuitesWithValue($a):
+ .[] | select(.Name == "Test_suites") | .Values | .[] | . == $a
+;
+
+[.[] |
+select(.Module.Android.SetProperties |
+ if . == null then [] else . end |
+ hasTestSuitesWithValue($arg)) |
+.[$arg2] ] | unique | sort | .[]