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
This commit is contained in:
Alexander Koskovich 2020-09-13 12:05:50 -07:00
parent 537b960396
commit 5445a75517
No known key found for this signature in database
GPG Key ID: F1107C9A417AC130
1 changed files with 28 additions and 5 deletions

View File

@ -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