Add BUILD_PRE_S_APEX to conditionally generate pre-S apex.

Used in CI and BUILD_PRE_S_APEX passed in via command line arguments.
default=false, to prevent presubmit run-time regression.

Ignore-AOSP-First: Will cherrypick into AOSP once tm-mlp is done.
BUG: 198437211
BUG: 235701311
Test: TH and local build.
Change-Id: Iae29c0c7119ec2cfc641e346280bd60f861b8ae1
This commit is contained in:
Baligh Uddin
2022-09-06 18:14:55 +00:00
parent dea15f5393
commit d1ae2611f2

View File

@@ -110,12 +110,13 @@ function init() {
exit 1
fi
declare -grx DIST_DIR="${dist_dir}"
DIST_DIR="${dist_dir}"
declare -grx TARGET_BUILD_APPS="${TARGET_BUILD_APPS:-${DEFAULT_MODULES[*]}}"
declare -grx TARGET_BUILD_DENSITY="${TARGET_BUILD_DENSITY:-alldpi}"
declare -grx TARGET_BUILD_TYPE="${TARGET_BUILD_TYPE:-release}"
declare -grx TARGET_BUILD_VARIANT="${TARGET_BUILD_VARIANT:-user}"
declare -grx TARGET_PRODUCT="${product}"
declare -grx BUILD_PRE_S_APEX="${BUILD_PRE_S_APEX:-false}"
# This script cannot handle compressed apexes
declare -grx OVERRIDE_PRODUCT_COMPRESSED_APEX=false
@@ -125,6 +126,18 @@ function init() {
# frameworks/base).
}
function build_modules() {
build/soong/soong_ui.bash --make-mode "$@" \
ALWAYS_EMBED_NOTICES=true \
MODULE_BUILD_FROM_SOURCE=true \
${extra_build_params} \
"${RUN_ERROR_PRONE:+"RUN_ERROR_PRONE=true"}" \
apps_only \
dist \
lint-check
}
function main() {
if [ ! -e "build/make/core/Makefile" ]; then
echo "$0 must be run from the top of the Android source tree."
@@ -135,13 +148,18 @@ function main() {
# the buildbots.
build/soong/soong_ui.bash --make-mode installclean
build/soong/soong_ui.bash --make-mode "$@" \
ALWAYS_EMBED_NOTICES=true \
MODULE_BUILD_FROM_SOURCE=true \
"${RUN_ERROR_PRONE:+"RUN_ERROR_PRONE=true"}" \
apps_only \
dist \
lint-check
DIST_DIR="${DIST_DIR}" build_modules
# TODO(b/198437211): remove unconditionally added APEX_BUILD_FOR_PRE_S_DEVICES
# below.
# Command line flag passed in would also build modules configured
# for PRE_S configuration. Disabled by default, this feature enables
# building modules with statically linked libraries.
# https://goto.google.com/building-dynamic-common-apex-variants
# Artifacts are stored in a different dist_dir (*_pre_s)
if [[ "${BUILD_PRE_S_APEX}" == "true" ]]; then
DIST_DIR="${DIST_DIR}_pre_s" APEX_BUILD_FOR_PRE_S_DEVICES=true build_modules
fi
}
init "$@"