diff --git a/Makefile b/Makefile index 91d2608..86783ed 100644 --- a/Makefile +++ b/Makefile @@ -16,3 +16,8 @@ docker-compose-build.log: Dockerfile compose.yml docker-compose down --remove-orphans --rmi all BUILDKIT_PROGRESS=plain docker-compose build | tee docker-compose-build.log +new-app: FORCE + ./Makefile.make.new-app.sh + +FORCE: + @true diff --git a/Makefile.make.Makefile.apps.sh b/Makefile.make.Makefile.apps.sh index 76115da..5659ea4 100755 --- a/Makefile.make.Makefile.apps.sh +++ b/Makefile.make.Makefile.apps.sh @@ -7,7 +7,9 @@ do test -d "$APP" || continue; APP="${APP%/}"; cat << MAKEFILE -apps/$APP/app.apk: docker-compose-build.log +apps/.files.$APP: FORCE + cmp -q <(cd apps/$APP; find -type f -ls) apps/.files."$APP" || (cd apps/$APP; find -type f -ls) > apps/.files."$APP" +apps/$APP/app.apk: docker-compose-build.log apps/.files.$APP docker compose run --rm compile $APP build-$APP: apps/$APP/app.apk true diff --git a/Makefile.make.new-app.sh b/Makefile.make.new-app.sh new file mode 100755 index 0000000..7cd6e29 --- /dev/null +++ b/Makefile.make.new-app.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +set -xe + +#APP_NAME +while test -z "${APP_NAME:-}" +do + read -p "Please provide a Name for the Android App:" APP_NAME +done + +#APP_PACKAGE +while test -z "${APP_PACKAGE:-}" +do + APP_PACKAGE_DEFAULT="${APP_NAME,,}" + APP_PACKAGE_DEFAULT="${APP_PACKAGE_DEFAULT//[!a-z0-9]/_}" + read -p "Please provide a Package.Name for the App [default=$APP_PACKAGE_DEFAULT]:" APP_PACKAGE + APP_PACKAGE="${APP_PACKAGE:-$APP_PACKAGE_DEFAULT}" + APP_PACKAGE="${APP_PACKAGE,,}" + APP_PACKAGE="${APP_PACKAGE//[!a-z0-9\.]/}" + test -d "apps/$APP_PACKAGE" && { + echo "There is already an app with APP_PACKAGE '$APP_PACKAGE'. Choose other APP_PACKAGE name" >&2 + APP_PACKAGE="" + } +done + + +#APP_TARGET_VERSION +while test -z "${APP_TARGET_VERSION:-}" +do + cat << API_LEVEL +read -p "Please choose the APP_TARGET_VERSION Apilevel:' +35 = Android 15 = 2024 +34 = Android 14 = 2023 +33 = Android 13 = 2022 +32 = Android 12L = 2022 +31 = Android 12 = 2021 +30 = Android 11 = 2020 +20 = Android 10 = 2019 +(see https://apilevels.com/ for more info) +API_LEVEL + APP_TARGET_VERSION_DEFAULT="33" + read -p "Please choose [default=$APP_TARGET_VERSION_DEFAULT]:" APP_TARGET_VERSION + APP_TARGET_VERSION="${APP_TARGET_VERSION:-$APP_TARGET_VERSION_DEFAULT}" + test "$APP_TARGET_VERSION" -gt 0 || { + echo "Error: APP_TARGET_VERSION 'APP_TARGET_VERSION' is not valid" + APP_TARGET_VERSION=''; + } +done + + +cat << INFO +Creating an skeleton for an Android app with the following info: +APP_PACKAGE: ${APP_PACKAGE} +APP_NAME: ${APP_NAME} +INFO + + +mkdir -p "apps/$APP_PACKAGE" +cat > "apps/$APP_PACKAGE/AndroidManifest.xml" << ANDROIDMANIFEST + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ANDROIDMANIFEST