@@ -254,6 +254,23 @@ build_pwa() {
254254 APPDEF_PACKAGE_NAME=" "
255255}
256256
257+ build_modern_pwa () {
258+ echo " Build Modern PWA"
259+ echo " OUTPUT_DIR=${OUTPUT_DIR} "
260+ cd " $PROJECT_DIR " || exit 1
261+
262+ PWA_OUTPUT_DIR=/tmp/output/pwa
263+ mkdir -p " ${PWA_OUTPUT_DIR} "
264+
265+ # shellcheck disable=SC2086
266+ $APP_BUILDER_SCRIPT_PATH -load build.appDef -no-save -build-modern-pwa -fp pwa.output=" ${PWA_OUTPUT_DIR} " ${SCRIPT_OPT}
267+ pushd " ${PWA_OUTPUT_DIR} /${APPDEF_PACKAGE_NAME} /build"
268+ zip -r " ${OUTPUT_DIR} /pwa.zip" .
269+ popd
270+ VERSION_CODE=" "
271+ APPDEF_PACKAGE_NAME=" "
272+ }
273+
257274set_default_asset_package () {
258275 ASSET_FILENAME=" ${APPDEF_PACKAGE_NAME} .zip"
259276 echo " Updating ipa-app-type=assets"
@@ -554,6 +571,25 @@ prepare_appbuilder_project() {
554571 fi
555572 fi
556573
574+ # If modern-pwa, then use the subdirectory configuration for the rclone publish path if not defined
575+ for target in $TARGETS ; do
576+ if [ " $target " = " modern-pwa" ]; then
577+ PUBLISH_TMP=$( mktemp)
578+ INPUT_PUBLISH_PROPERTIES=$PUBLISH_PROPERTIES
579+ if [ -f " ${OUTPUT_PUBLISH_PROPERTIES} " ]; then
580+ INPUT_PUBLISH_PROPERTIES=$OUTPUT_PUBLISH_PROPERTIES
581+ fi
582+ if jq -e ' .PUBLISH_CLOUD_REMOTE_PATH' " ${INPUT_PUBLISH_PROPERTIES} " > /dev/null; then
583+ echo " PUBLISH_CLOUD_REMOTE_PATH exists."
584+ else
585+ echo " PUBLISH_CLOUD_REMOTE_PATH set to PWA SUBDIR."
586+ PWA_SUBDIR=$( xmllint --xpath " /app-definition/pwa-manifest/pwa-sub-directory/text()" build.appDef)
587+ jq -cM " .PUBLISH_CLOUD_REMOTE_PATH += \" ${PWA_SUBDIR} \" " " ${INPUT_PUBLISH_PROPERTIES} " > " ${PUBLISH_TMP} "
588+ cp " ${PUBLISH_TMP} " " ${OUTPUT_PUBLISH_PROPERTIES} "
589+ fi
590+ fi
591+ done
592+
557593 if [ ! -f " ${OUTPUT_PUBLISH_PROPERTIES} " ]; then
558594 # if no Scripture Earth record, then copy straight as normal
559595 cp " ${PUBLISH_PROPERTIES} " " ${OUTPUT_PUBLISH_PROPERTIES} "
612648 " play-listing" ) build_play_listing ;;
613649 " html" ) build_html ;;
614650 " pwa" ) build_pwa ;;
651+ " modern-pwa" ) build_modern_pwa ;;
615652 * ) build_gradle " $target " ;;
616653 esac
617654done
0 commit comments