Add --build-release option to mainline_modules_sdks.sh

This change makes it easier to test the behavior of specific build
releases.

Bug: 218685706
Test: atest --host mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      packages/modules/common/build/mainline_modules_sdks.sh --build-release=S --build-release=latest
      pyformat -s 4 --force_quote_type double -i build/mainline_modules_sdks*.py
      /usr/bin/pylint --rcfile $ANDROID_BUILD_TOP/tools/repohooks/tools/pylintrc build/mainline_modules_sdks*.py
Change-Id: Ib9ef2f35d27d10cd960c4b6225417d930cb10afc
This commit is contained in:
Paul Duffin
2022-03-17 18:10:24 +00:00
parent de60aeb525
commit 14c6bd8c38
2 changed files with 23 additions and 5 deletions

View File

@@ -18,7 +18,7 @@
If the environment variable TARGET_BUILD_APPS is nonempty then only the SDKs for If the environment variable TARGET_BUILD_APPS is nonempty then only the SDKs for
the APEXes in it are built, otherwise all configured SDKs are built. the APEXes in it are built, otherwise all configured SDKs are built.
""" """
import argparse
import dataclasses import dataclasses
import io import io
import os import os
@@ -757,16 +757,34 @@ def filter_modules(modules):
return modules return modules
def main(): def main(args):
"""Program entry point.""" """Program entry point."""
if not os.path.exists("build/make/core/Makefile"): if not os.path.exists("build/make/core/Makefile"):
sys.exit("This script must be run from the top of the tree.") sys.exit("This script must be run from the top of the tree.")
args_parser = argparse.ArgumentParser(
description="Build snapshot zips for consumption by Gantry.")
args_parser.add_argument(
"--build-release",
action="append",
choices=[br.name for br in ALL_BUILD_RELEASES],
help="A target build for which snapshots are required.",
)
args = args_parser.parse_args(args)
build_releases = ALL_BUILD_RELEASES
if args.build_release:
selected_build_releases = {b.lower() for b in args.build_release}
build_releases = [
b for b in build_releases
if b.name.lower() in selected_build_releases
]
producer = create_producer() producer = create_producer()
modules = filter_modules(MAINLINE_MODULES) modules = filter_modules(MAINLINE_MODULES)
producer.produce_dist(modules, ALL_BUILD_RELEASES) producer.produce_dist(modules, build_releases)
if __name__ == "__main__": if __name__ == "__main__":
main() main(sys.argv[1:])

View File

@@ -56,7 +56,7 @@ function main() {
# provided by the build to ensure consistency across build environments. # provided by the build to ensure consistency across build environments.
export DIST_DIR OUT_DIR export DIST_DIR OUT_DIR
prebuilts/build-tools/linux-x86/bin/py3-cmd -u "${py3script}" prebuilts/build-tools/linux-x86/bin/py3-cmd -u "${py3script}" "$@"
} }
init "$@" init "$@"