check-flagged-apis: extract argument names into constants
Extract the command line argument names (and help texts) into constants.
This will allow future subcommands to re-use the same names and keep
things consistent.
Bug: 345207706
Test: atest check-flagged-apis-test
Flag: EXEMPT host side tool
Change-Id: I430f36c99f28aab8511a357f572086ee238d653b
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 26d3c9c..4696efd 100644
--- a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
+++ b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
@@ -142,6 +142,29 @@
}
}
+val ARG_API_SIGNATURE = "--api-signature"
+val ARG_API_SIGNATURE_HELP =
+ """
+Path to API signature file.
+Usually named *current.txt.
+Tip: `m frameworks-base-api-current.txt` will generate a file that includes all platform and mainline APIs.
+"""
+
+val ARG_FLAG_VALUES = "--flag-values"
+val ARG_FLAG_VALUES_HELP =
+ """
+Path to aconfig parsed_flags binary proto file.
+Tip: `m all_aconfig_declarations` will generate a file that includes all information about all flags.
+"""
+
+val ARG_API_VERSIONS = "--api-versions"
+val ARG_API_VERSIONS_HELP =
+ """
+Path to API versions XML file.
+Usually named xml-versions.xml.
+Tip: `m sdk dist` will generate a file that includes all platform and mainline APIs.
+"""
+
class MainCommand : CliktCommand() {
override fun run() {}
}
@@ -157,32 +180,18 @@
The tool will exit with a non-zero exit code if any flagged APIs are found to be used in the incorrect way.
""") {
private val apiSignaturePath by
- option("--api-signature")
- .help(
- """
- Path to API signature file.
- Usually named *current.txt.
- Tip: `m frameworks-base-api-current.txt` will generate a file that includes all platform and mainline APIs.
- """)
+ option(ARG_API_SIGNATURE)
+ .help(ARG_API_SIGNATURE_HELP)
.path(mustExist = true, canBeDir = false, mustBeReadable = true)
.required()
private val flagValuesPath by
- option("--flag-values")
- .help(
- """
- Path to aconfig parsed_flags binary proto file.
- Tip: `m all_aconfig_declarations` will generate a file that includes all information about all flags.
- """)
+ option(ARG_FLAG_VALUES)
+ .help(ARG_FLAG_VALUES_HELP)
.path(mustExist = true, canBeDir = false, mustBeReadable = true)
.required()
private val apiVersionsPath by
- option("--api-versions")
- .help(
- """
- Path to API versions XML file.
- Usually named xml-versions.xml.
- Tip: `m sdk dist` will generate a file that includes all platform and mainline APIs.
- """)
+ option(ARG_API_VERSIONS)
+ .help(ARG_API_VERSIONS_HELP)
.path(mustExist = true, canBeDir = false, mustBeReadable = true)
.required()