From 5445a755174351544a8742bcd848cc99851a22a7 Mon Sep 17 00:00:00 2001 From: Alexander Koskovich Date: Sun, 13 Sep 2020 12:05:50 -0700 Subject: [PATCH] pa: extract_utils: Add support for extracting APEX images. * Also set the final package list at the end of type determination so it can run through the args and make any changes to the final list that it needs. For the APEX images I was having an issue where I renamed the pkgname depending on an arg present but the final list only recieved the name prior to the rename. Change-Id: Ie5082cb1a426efbf1db26d32cbeb2cb5aef82156 --- build/tools/extract_utils.sh | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh index 89f5d661..81f6060b 100755 --- a/build/tools/extract_utils.sh +++ b/build/tools/extract_utils.sh @@ -382,9 +382,6 @@ function write_blueprint_packages() { EXTENSION=${BASENAME##*.} PKGNAME=${BASENAME%.*} - # Add to final package list - PACKAGE_LIST+=("$PKGNAME") - SRC="proprietary" if [ "$PARTITION" = "system" ]; then SRC+="/system" @@ -398,7 +395,20 @@ function write_blueprint_packages() { SRC+="/odm" fi - if [ "$CLASS" = "SHARED_LIBRARIES" ]; then + if [ "$CLASS" = "APEX" ]; then + ARGS=(${ARGS//;/ }) + SRC="$SRC/apex" + printf 'prebuilt_apex {\n' + for ARG in "${ARGS[@]}"; do + if [[ "$ARG" =~ "PKGNAME" ]]; then + PKGNAME=${ARG##*\=} + printf '\tname: "%s",\n' "$PKGNAME" + fi + done + printf '\tsrc: "%s/%s",\n' "$SRC" "$FILE" + printf '\towner: "%s",\n' "${VENDOR%\/*}" + printf '\tfilename: "%s",\n' "$BASENAME" + elif [ "$CLASS" = "SHARED_LIBRARIES" ]; then printf 'cc_prebuilt_library_shared {\n' printf '\tname: "%s",\n' "$PKGNAME" printf '\towner: "%s",\n' "${VENDOR%\/*}" @@ -505,7 +515,7 @@ function write_blueprint_packages() { printf '\tsub_dir: "%s",\n' "$DIRNAME" fi fi - if [ "$CLASS" = "SHARED_LIBRARIES" ] || [ "$CLASS" = "EXECUTABLES" ] ; then + if [ "$CLASS" = "SHARED_LIBRARIES" ] || [ "$CLASS" = "EXECUTABLES" ] || [ "$CLASS" = "APEX" ] ; then printf '\tprefer: true,\n' fi if [ "$EXTRA" = "priv-app" ]; then @@ -521,6 +531,9 @@ function write_blueprint_packages() { printf '\tdevice_specific: true,\n' fi printf '}\n\n' + + # Add to final package list. + PACKAGE_LIST+=("$PKGNAME") done } @@ -787,6 +800,16 @@ function write_product_packages() { write_blueprint_packages "SHARED_LIBRARIES" "odm" "64" "O_LIB64" >> "$ANDROIDBP" fi + # Apex + local APEX=( $(prefix_match "apex/") ) + if [ "${#APEX[@]}" -gt "0" ]; then + write_blueprint_packages "APEX" "" "" "APEX" >> "$ANDROIDBP" + fi + local S_APEX=( $(prefix_match "system/apex/") ) + if [ "${#S_APEX[@]}" -gt "0" ]; then + write_blueprint_packages "APEX" "system" "" "S_APEX" >> "$ANDROIDBP" + fi + # Apps local APPS=( $(prefix_match "app/") ) if [ "${#APPS[@]}" -gt "0" ]; then