extract_utils: allow overriding package name
* Useful for BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES
if package name conflicts with something source-built but the output location differs
Change-Id: I3af45eae6b2d2cfc583128628edfef9e37ea3976
diff --git a/extract_utils.sh b/extract_utils.sh
index a350b8f..e46eed3 100644
--- a/extract_utils.sh
+++ b/extract_utils.sh
@@ -362,17 +362,28 @@
local EXTENSION=
local PKGNAME=
local SRC=
+ local STEM=
local OVERRIDEPKG=
for P in "${FILELIST[@]}"; do
FILE=$(target_file "$P")
ARGS=$(target_args "$P")
+ ARGS=(${ARGS//;/ })
BASENAME=$(basename "$FILE")
DIRNAME=$(dirname "$FILE")
EXTENSION=${BASENAME##*.}
PKGNAME=${BASENAME%.*}
+ # Allow overriding module name
+ STEM=
+ for ARG in "${ARGS[@]}"; do
+ if [[ "$ARG" =~ "MODULE" ]]; then
+ STEM="$PKGNAME"
+ PKGNAME=${ARG#*=}
+ fi
+ done
+
# Add to final package list
PACKAGE_LIST+=("$PKGNAME")
@@ -392,6 +403,9 @@
if [ "$CLASS" = "SHARED_LIBRARIES" ]; then
printf 'cc_prebuilt_library_shared {\n'
printf '\tname: "%s",\n' "$PKGNAME"
+ if [ ! -z "$STEM" ]; then
+ printf '\tstem: "%s",\n' "$STEM"
+ fi
printf '\towner: "%s",\n' "$VENDOR"
printf '\tstrip: {\n'
printf '\t\tnone: true,\n'
@@ -435,7 +449,6 @@
SRC="$SRC/app"
fi
printf '\tapk: "%s/%s",\n' "$SRC" "$FILE"
- ARGS=(${ARGS//;/ })
USE_PLATFORM_CERTIFICATE="true"
for ARG in "${ARGS[@]}"; do
if [ "$ARG" = "PRESIGNED" ]; then