Update android build script to support aab file

This commit is contained in:
Benau
2020-08-27 16:28:13 +08:00
parent 4ee72fde50
commit 4e6fbd2787
4 changed files with 74 additions and 42 deletions

View File

@@ -127,18 +127,10 @@ Before compilation you have to set:
export BUILD_TYPE=release
It's also needed to set STK_STOREPASS, STK_KEYSTORE and STK_ALIAS environment
variables, so that the apk files can be signed.
and then you make standard compilation with:
./generate_assets.sh
./make.sh -j5
The compiled apk is unsigned, so you have to sign it with your key. To sign it,
you have to run:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore \
my-release-key.keystore SuperTuxKart-release-unsigned.apk alias_name
and then:
zipalign -v 4 SuperTuxKart-release-unsigned.apk SuperTuxKart-release.apk
./make.sh -j $(($(nproc) + 1))

View File

@@ -28,6 +28,25 @@ android
compileSdkVersion compile_sdk_version.toInteger()
buildToolsVersion build_tools_ver
signingConfigs
{
release
{
storeFile file(keystore)
storePassword storepass
keyAlias alias
keyPassword storepass
}
}
buildTypes
{
release
{
signingConfig signingConfigs.release
}
}
sourceSets
{
main

View File

@@ -218,6 +218,29 @@ if [ ! -d "$SDK_PATH" ]; then
exit
fi
# Check if we have key for signing in release build
if [ "$GRADLE_BUILD_TYPE" = "assembleRelease" ]; then
if [ -z "$STK_KEYSTORE" ]; then
echo "Error: STK_KEYSTORE variable is empty."
exit
fi
if [ ! -f "$STK_KEYSTORE" ]; then
echo "Error: Couldn't find $STK_KEYSTORE file."
exit
fi
if [ -z "$STK_STOREPASS" ]; then
echo "Error: STK_STOREPASS variable is empty"
exit
fi
if [ -z "$STK_ALIAS" ]; then
echo "Error: STK_ALIAS variable is empty."
exit
fi
fi
# Find newest build-tools version
if [ -z "$BUILD_TOOLS_VER" ]; then
BUILD_TOOLS_DIRS=`ls -1 "$SDK_PATH/build-tools" | sort -V -r`
@@ -681,11 +704,17 @@ fi
export ANDROID_HOME="$SDK_PATH"
./gradlew -Pcompile_sdk_version=$COMPILE_SDK_VERSION \
-Pbuild_tools_ver="$BUILD_TOOLS_VER" \
-Pstorepass="$STK_STOREPASS" \
-Pkeystore="$STK_KEYSTORE" \
-Palias="$STK_ALIAS" \
$GRADLE_BUILD_TYPE
if [ "$GRADLE_BUILD_TYPE" = "assembleRelease" ]; then
./gradlew -Pcompile_sdk_version=$COMPILE_SDK_VERSION \
-Pbuild_tools_ver="$BUILD_TOOLS_VER" \
-Pstorepass="$STK_STOREPASS" \
-Pkeystore="$STK_KEYSTORE" \
-Palias="$STK_ALIAS" \
"bundleRelease"
fi