Files
apk/build.sh

38 lines
914 B
Bash
Raw Normal View History

#!/bin/bash
# This script will initialize the gradle build process for all subprojects in src dicetory
# Check for a build mode argument
if [ "$1" == "clean" ]; then
2025-12-10 10:53:14 +01:00
BUILD_MODE="clean build"
BUILD_LOGGING=""
else
BUILD_MODE="assembleDebug"
BUILD_LOGGING="--warning-mode all"
fi
2025-12-09 17:36:31 +01:00
# check if user is root and change user to builder
if [ "$EUID" -eq 0 ]; then
echo "Please do not run this script as root."
BUILD_USER="builder"
else
BUILD_USER="$USER"
fi
source /home/$BUILD_USER/.bashrc
2025-12-09 17:45:15 +01:00
yes | /opt/android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses
# Find all src subdirectories containing a build.gradle file
for dir in src/*/; do
if [ -f "$dir/build.gradle" ]; then
echo "Building project in $dir"
2025-12-10 11:05:14 +01:00
gradle --stop
(cd "$dir" && gradle clean $BUILD_MODE $BUILD_LOGGING)
else
echo "No build.gradle found in $dir, skipping."
fi
done