added build aab .bat

This commit is contained in:
izzy2lost
2026-01-13 12:35:04 -05:00
parent 1fbb50ab92
commit 8e1d61f837
3 changed files with 89 additions and 0 deletions
+1
View File
@@ -51,6 +51,7 @@ Makefile
android/.gradle/
android/.idea/
android/local.properties
android/key.properties
android/*.iml
android/**/build/
android/**/.cxx/
+29
View File
@@ -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")
}
}
}
+59
View File
@@ -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