check-flagged-apis: add support for subcommands
The tool currently only supports a single subcommand, the "check"
command. Follow-up CLs will add new subcommands.
Bug: 345207706
Test: build/tools/check-flagged-apis/check-flagged-apis.sh
Flag: EXEMPT host side tool
Change-Id: I1aaaf313db8a10a7427aab378aac8d946d5a8a3d
diff --git a/tools/check-flagged-apis/check-flagged-apis.sh b/tools/check-flagged-apis/check-flagged-apis.sh
index d9934a1..dad1236 100755
--- a/tools/check-flagged-apis/check-flagged-apis.sh
+++ b/tools/check-flagged-apis/check-flagged-apis.sh
@@ -56,7 +56,7 @@
local errors=0
echo "# current"
- check-flagged-apis \
+ check-flagged-apis check \
--api-signature $(path_to_api_signature_file "frameworks-base-api-current.txt") \
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
--api-versions $PUBLIC_XML_VERSIONS
@@ -64,7 +64,7 @@
echo
echo "# system-current"
- check-flagged-apis \
+ check-flagged-apis check \
--api-signature $(path_to_api_signature_file "frameworks-base-api-system-current.txt") \
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
--api-versions $SYSTEM_XML_VERSIONS
@@ -72,7 +72,7 @@
echo
echo "# system-server-current"
- check-flagged-apis \
+ check-flagged-apis check \
--api-signature $(path_to_api_signature_file "frameworks-base-api-system-server-current.txt") \
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
--api-versions $SYSTEM_SERVER_XML_VERSONS
@@ -80,7 +80,7 @@
echo
echo "# module-lib"
- check-flagged-apis \
+ check-flagged-apis check \
--api-signature $(path_to_api_signature_file "frameworks-base-api-module-lib-current.txt") \
--flag-values $(gettop)/out/soong/.intermediates/all_aconfig_declarations.pb \
--api-versions $MODULE_LIB_XML_VERSIONS
diff --git a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
index 1d2440d..26d3c9c 100644
--- a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
+++ b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
@@ -26,6 +26,7 @@
import com.android.tools.metalava.model.text.ApiFile
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.ProgramResult
+import com.github.ajalt.clikt.core.subcommands
import com.github.ajalt.clikt.parameters.options.help
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
@@ -141,6 +142,10 @@
}
}
+class MainCommand : CliktCommand() {
+ override fun run() {}
+}
+
class CheckCommand :
CliktCommand(
help =
@@ -446,4 +451,4 @@
return errors
}
-fun main(args: Array<String>) = CheckCommand().main(args)
+fun main(args: Array<String>) = MainCommand().subcommands(CheckCommand()).main(args)