From 8e1d61f837ace1830f5cbc5792c5bc892d8256b1 Mon Sep 17 00:00:00 2001 From: izzy2lost Date: Tue, 13 Jan 2026 12:35:04 -0500 Subject: [PATCH] added build aab .bat --- .gitignore | 1 + android/app/build.gradle.kts | 29 ++++++++++++++++++ build-aab.bat | 59 ++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 build-aab.bat diff --git a/.gitignore b/.gitignore index c4b8425..53796a2 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ Makefile android/.gradle/ android/.idea/ android/local.properties +android/key.properties android/*.iml android/**/build/ android/**/.cxx/ diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 1c440a0..e426805 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,8 +1,23 @@ +import java.util.Properties + plugins { id("com.android.application") id("org.jetbrains.kotlin.android") } +val keystorePropertiesFile = rootProject.file("key.properties") +val keystoreProperties = Properties() +val hasKeystoreProperties = keystorePropertiesFile.exists() + +if (hasKeystoreProperties) { + keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) } +} + +val hasReleaseKeystore = hasKeystoreProperties && + listOf("storeFile", "storePassword", "keyAlias", "keyPassword").all { + !keystoreProperties.getProperty(it).isNullOrBlank() + } + android { namespace = "com.izzy2lost.super3" compileSdk = 36 @@ -28,6 +43,17 @@ android { } } + signingConfigs { + if (hasReleaseKeystore) { + create("release") { + storeFile = file(keystoreProperties.getProperty("storeFile")) + storePassword = keystoreProperties.getProperty("storePassword") + keyAlias = keystoreProperties.getProperty("keyAlias") + keyPassword = keystoreProperties.getProperty("keyPassword") + } + } + } + buildTypes { release { isMinifyEnabled = false @@ -35,6 +61,9 @@ android { getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) + if (hasReleaseKeystore) { + signingConfig = signingConfigs.getByName("release") + } } } diff --git a/build-aab.bat b/build-aab.bat new file mode 100644 index 0000000..48b06ed --- /dev/null +++ b/build-aab.bat @@ -0,0 +1,59 @@ +@echo off +setlocal + +set "ROOT=%~dp0" +set "ANDROID_DIR=%ROOT%android" +set "KEY_PROPS=%ANDROID_DIR%\key.properties" + +if not exist "%KEY_PROPS%" ( + echo Creating "%KEY_PROPS%" with placeholders... + >"%KEY_PROPS%" ( + echo storeFile=C:/path/to/your-release-key.jks + echo storePassword=REPLACE_ME + echo keyAlias=REPLACE_ME + echo keyPassword=REPLACE_ME + ) + echo. + echo Edit %KEY_PROPS% with your real values, then rerun this script. + echo. + pause + exit /b 1 +) + +findstr /C:"REPLACE_ME" "%KEY_PROPS%" >nul +if %errorlevel%==0 ( + echo. + echo Please replace the placeholders in %KEY_PROPS% before building. + echo. + pause + exit /b 1 +) + +findstr /C:"C:/path/to/your-release-key.jks" "%KEY_PROPS%" >nul +if %errorlevel%==0 ( + echo. + echo Please replace the storeFile placeholder in %KEY_PROPS% before building. + echo. + pause + exit /b 1 +) + +pushd "%ANDROID_DIR%" || exit /b 1 +call gradlew.bat bundleRelease +set "EXITCODE=%ERRORLEVEL%" +popd + +if not "%EXITCODE%"=="0" ( + echo. + echo Build failed with exit code %EXITCODE%. + echo. + pause + exit /b %EXITCODE% +) + +echo. +echo Build complete. +echo Release AAB: +echo %ANDROID_DIR%\app\build\outputs\bundle\release\app-release.aab +echo. +pause