Modify build script
* Run bundletool prebuilt directly instead of build
DISABLE_TOPIC_PROTECTOR
Bug: 406584715
Change-Id: Ibd5661ac65517e0df707c574d9348d4018e4e0e3
(cherry picked from commit ea2ec9498b)
This commit is contained in:
@@ -27,7 +27,7 @@ readonly -a ARCHS=(
|
||||
)
|
||||
|
||||
|
||||
function die() { format=$1; shift; printf >&2 "$format\n" $@; exit 1; }
|
||||
function die() { format=$1; shift; printf >&2 "$format\n" "$@"; exit 1; }
|
||||
|
||||
|
||||
# $@: additional build targets
|
||||
@@ -76,8 +76,9 @@ function build_bundle() {
|
||||
"${base_zip}" \
|
||||
"${zips[@]}"
|
||||
|
||||
# Use prebuilt bundletool JAR
|
||||
# build bundle
|
||||
${BUNDLETOOL} build-bundle \
|
||||
"${JAVA_EXE}" -jar "${BUNDLETOOL_PREBUILT_JAR}" build-bundle \
|
||||
--overwrite \
|
||||
--modules "${base_zip}" \
|
||||
--config "${TMPDIR}/${apex}/bundle_config.json" \
|
||||
@@ -88,6 +89,8 @@ function build_bundle() {
|
||||
# inputs: ${DIST_DIR}/${arch}/${apex}-base.zip
|
||||
# outputs: ${DIST_DIR}/${apex}.aab
|
||||
function build_bundles() {
|
||||
# Assume TARGET_BUILD_APPS is set in the environment
|
||||
local app
|
||||
for app in ${TARGET_BUILD_APPS}; do
|
||||
build_bundle "${app}"
|
||||
done
|
||||
@@ -98,7 +101,7 @@ function build_bundles() {
|
||||
# outputs: ${DIST_DIR}/dev_keys_signed/${apex}/${apex}.apks
|
||||
function sign_bundles() {
|
||||
${DEV_SIGN_BUNDLE} \
|
||||
--java_binary_path "${ANDROID_JAVA_HOME}/bin/java" \
|
||||
--java_binary_path "${JAVA_EXE}" \
|
||||
--input_dir "${DIST_DIR}" \
|
||||
--output_dir "${DIST_DIR}/dev_keys_signed"
|
||||
}
|
||||
@@ -108,10 +111,16 @@ function configure_build() {
|
||||
# Assign to a variable and eval that, since bash ignores any error status from
|
||||
# the command substitution if it's directly on the eval line.
|
||||
local -r vars="$(TARGET_PRODUCT='' build/soong/soong_ui.bash --dumpvars-mode \
|
||||
--vars="ANDROID_JAVA_HOME TMPDIR OUT_DIR")"
|
||||
--vars="ANDROID_JAVA_HOME TMPDIR OUT_DIR TARGET_BUILD_APPS DIST_DIR")"
|
||||
eval "${vars}"
|
||||
|
||||
declare -gr BUNDLETOOL=${OUT_DIR}/host/linux-x86/bin/bundletool
|
||||
# Define prebuilt bundletool path and JAVA_EXE
|
||||
# Assume exactly one JAR matches
|
||||
local -a jar_matches=(prebuilts/bundletool/bundletool-all-*.jar)
|
||||
declare -gr BUNDLETOOL_PREBUILT_JAR="${jar_matches[0]}"
|
||||
declare -gr JAVA_EXE="${ANDROID_JAVA_HOME}/bin/java"
|
||||
|
||||
# Keep declarations for built tools
|
||||
declare -gr MERGE_ZIPS=${OUT_DIR}/host/linux-x86/bin/merge_zips
|
||||
declare -gr DEV_SIGN_BUNDLE=${OUT_DIR}/host/linux-x86/bin/dev_sign_bundle
|
||||
}
|
||||
@@ -120,10 +129,11 @@ function configure_build() {
|
||||
function main() {
|
||||
[[ -e "build/make/core/Makefile" ]] || die "$0 must be run from the top of the Android source tree."
|
||||
configure_build
|
||||
build_modules bundletool merge_zips dev_sign_bundle
|
||||
build_bundles # use bundletool & merge_zips
|
||||
sign_bundles # use dev_sign_bundle
|
||||
|
||||
build_modules merge_zips dev_sign_bundle
|
||||
build_bundles # use prebuilt bundletool & merge_zips
|
||||
sign_bundles # use built dev_sign_bundle
|
||||
}
|
||||
|
||||
|
||||
main
|
||||
main
|
||||
Reference in New Issue
Block a user