Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5ce20fc authored by Mårten Kongstad's avatar Mårten Kongstad
Browse files

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
parent a96b36bd
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ function run() {
    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 @@ function run() {

    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 @@ function run() {

    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 @@ function run() {

    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
+6 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.tools.metalava.model.MethodItem
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 @@ internal data class UnknownFlagError(override val symbol: Symbol, override val f
  }
}

class MainCommand : CliktCommand() {
  override fun run() {}
}

class CheckCommand :
    CliktCommand(
        help =
@@ -446,4 +451,4 @@ internal fun findErrors(
  return errors
}

fun main(args: Array<String>) = CheckCommand().main(args)
fun main(args: Array<String>) = MainCommand().subcommands(CheckCommand()).main(args)