mirror of
https://github.com/godotengine/godot-build-scripts.git
synced 2026-01-04 02:09:44 +03:00
Add environment variables to sign the release build for the Godot Android editor and to publish the library to MavenCentral. If the environment vars are not defined, we do a simple unsigned `release_debug` build for the Android editor. Change `config.sh.in` template to use single quotes by default, to prevent expanding special characters in environment variables. To publish to MavenCentral, a new `build-android/upload-mavencentral.sh` script is added. It needs to run after the build using gradle, but we still want it to be optional and used only when making an official release, so we copy the compiled sources in the first step. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
122 lines
5.1 KiB
Bash
Executable File
122 lines
5.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Config
|
|
|
|
export SCONS="scons -j${NUM_CORES} verbose=yes warnings=no progress=no"
|
|
export OPTIONS="production=yes"
|
|
export OPTIONS_MONO="module_mono_enabled=yes mono_static=no"
|
|
export TERM=xterm
|
|
|
|
rm -rf godot
|
|
mkdir godot
|
|
cd godot
|
|
tar xf /root/godot.tar.gz --strip-components=1
|
|
|
|
# Environment variables and keystore needed for signing store editor build,
|
|
# as well as signing and publishing to MavenCentral.
|
|
source /root/keystore/config.sh
|
|
|
|
store_release="yes"
|
|
if [ -z "${GODOT_ANDROID_SIGN_KEYSTORE}" ]; then
|
|
echo "No keystore provided to sign the Android release editor build, using debug build instead."
|
|
store_release="no"
|
|
fi
|
|
|
|
# Classical
|
|
|
|
if [ "${CLASSICAL}" == "1" ]; then
|
|
echo "Starting classical build for Android..."
|
|
|
|
$SCONS platform=android android_arch=armv7 $OPTIONS tools=yes target=release_debug store_release=$store_release
|
|
$SCONS platform=android android_arch=arm64v8 $OPTIONS tools=yes target=release_debug store_release=$store_release
|
|
$SCONS platform=android android_arch=x86 $OPTIONS tools=yes target=release_debug store_release=$store_release
|
|
$SCONS platform=android android_arch=x86_64 $OPTIONS tools=yes target=release_debug store_release=$store_release
|
|
|
|
pushd platform/android/java
|
|
./gradlew generateGodotEditor
|
|
popd
|
|
|
|
mkdir -p /root/out/tools
|
|
# Copy the generated Android editor binaries (apk & aab).
|
|
if [ "$store_release" == "yes" ]; then
|
|
cp bin/android_editor_builds/android_editor-release.apk /root/out/tools/android_editor.apk
|
|
cp bin/android_editor_builds/android_editor-release.aab /root/out/tools/android_editor.aab
|
|
else
|
|
cp bin/android_editor_builds/android_editor-debug.apk /root/out/tools/android_editor.apk
|
|
cp bin/android_editor_builds/android_editor-debug.aab /root/out/tools/android_editor.aab
|
|
fi
|
|
|
|
# Restart from a clean tarball, as we'll copy all the contents
|
|
# outside the container for the MavenCentral upload.
|
|
rm -rf /root/godot/*
|
|
tar xf /root/godot.tar.gz --strip-components=1
|
|
|
|
$SCONS platform=android android_arch=armv7 $OPTIONS tools=no target=release_debug
|
|
$SCONS platform=android android_arch=armv7 $OPTIONS tools=no target=release
|
|
|
|
$SCONS platform=android android_arch=arm64v8 $OPTIONS tools=no target=release_debug
|
|
$SCONS platform=android android_arch=arm64v8 $OPTIONS tools=no target=release
|
|
|
|
$SCONS platform=android android_arch=x86 $OPTIONS tools=no target=release_debug
|
|
$SCONS platform=android android_arch=x86 $OPTIONS tools=no target=release
|
|
|
|
$SCONS platform=android android_arch=x86_64 $OPTIONS tools=no target=release_debug
|
|
$SCONS platform=android android_arch=x86_64 $OPTIONS tools=no target=release
|
|
|
|
pushd platform/android/java
|
|
./gradlew generateGodotTemplates
|
|
|
|
if [ "$store_release" == "yes" ]; then
|
|
# Copy source folder with compiled libs so we can optionally use it
|
|
# in a separate script to upload the templates to MavenCentral.
|
|
cp -r /root/godot /root/out/source/
|
|
# Backup ~/.gradle too so we can reuse all the downloaded stuff.
|
|
cp -r /root/.gradle /root/out/source/.gradle
|
|
fi
|
|
popd
|
|
|
|
mkdir -p /root/out/templates
|
|
cp bin/android_source.zip /root/out/templates/
|
|
cp bin/android_debug.apk /root/out/templates/
|
|
cp bin/android_release.apk /root/out/templates/
|
|
cp bin/godot-lib.release.aar /root/out/templates/
|
|
fi
|
|
|
|
# Mono
|
|
|
|
if [ "${MONO}" == "1" ]; then
|
|
echo "Starting Mono build for Android..."
|
|
|
|
cp /root/mono-glue/*.cpp modules/mono/glue/
|
|
cp -r /root/mono-glue/GodotSharp/GodotSharp/Generated modules/mono/glue/GodotSharp/GodotSharp/
|
|
|
|
$SCONS platform=android android_arch=armv7 $OPTIONS $OPTIONS_MONO mono_prefix=/root/mono-installs/android-armv7-release tools=no target=release_debug
|
|
$SCONS platform=android android_arch=armv7 $OPTIONS $OPTIONS_MONO mono_prefix=/root/mono-installs/android-armv7-release tools=no target=release
|
|
|
|
$SCONS platform=android android_arch=arm64v8 $OPTIONS $OPTIONS_MONO mono_prefix=/root/mono-installs/android-arm64v8-release tools=no target=release_debug
|
|
$SCONS platform=android android_arch=arm64v8 $OPTIONS $OPTIONS_MONO mono_prefix=/root/mono-installs/android-arm64v8-release tools=no target=release
|
|
|
|
$SCONS platform=android android_arch=x86 $OPTIONS $OPTIONS_MONO mono_prefix=/root/mono-installs/android-x86-release tools=no target=release_debug
|
|
$SCONS platform=android android_arch=x86 $OPTIONS $OPTIONS_MONO mono_prefix=/root/mono-installs/android-x86-release tools=no target=release
|
|
|
|
$SCONS platform=android android_arch=x86_64 $OPTIONS $OPTIONS_MONO mono_prefix=/root/mono-installs/android-x86_64-release tools=no target=release_debug
|
|
$SCONS platform=android android_arch=x86_64 $OPTIONS $OPTIONS_MONO mono_prefix=/root/mono-installs/android-x86_64-release tools=no target=release
|
|
|
|
pushd platform/android/java
|
|
./gradlew generateGodotTemplates
|
|
popd
|
|
|
|
mkdir -p /root/out/templates-mono
|
|
cp bin/android_source.zip /root/out/templates-mono/
|
|
cp bin/android_debug.apk /root/out/templates-mono/
|
|
cp bin/android_release.apk /root/out/templates-mono/
|
|
cp bin/godot-lib.release.aar /root/out/templates-mono/
|
|
|
|
mkdir -p /root/out/templates-mono/bcl
|
|
cp -r /root/mono-installs/android-bcl/* /root/out/templates-mono/bcl/
|
|
fi
|
|
|
|
echo "Android build successful"
|