Created
October 24, 2016 16:19
-
-
Save vinod8990/50c2a2248681063998d79e2ae69684bf to your computer and use it in GitHub Desktop.
Automate Godot export template builds with separated modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
#This script generates export templates for Godot android builds | |
#Some of the codes from https://gist.github.com/Calinou/3e9f6a961c7c9364a681f8f1a5375247 | |
#Copy this to Godot source directory | |
#Have a project structure like this | |
#/project | |
####/godot_project | |
####/templates | |
########/modules | |
#Run this script like this .generate.sh /project/templates | |
export ANDROID_HOME="/home/vinodkumar/Applications/android-sdk-linux" | |
export ANDROID_NDK_ROOT="/home/vinodkumar/Applications/android-ndk-r13" | |
if [ -f "${1}" ] ; then | |
echo "$1 is not a directory"; | |
return | |
fi | |
GODOT_SOURCE_DIR=$(pwd) | |
GODOT_MODULE_DIR="${GODOT_SOURCE_DIR}/modules" | |
EXPORT_TEMPLATE_DIR=$1 | |
PROJECT_MODULE_DIR=$1"/modules" | |
mkdir -p $GODOT_MODULE_DIR | |
find ${GODOT_MODULE_DIR} -mindepth 1 -maxdepth 1 -type d -name "*_temp" -exec rm -rf "{}" \; | |
for i in `find ${PROJECT_MODULE_DIR} -mindepth 1 -maxdepth 1 -type d`; do | |
NEWNAME="${i}_temp" | |
cp -a $i $NEWNAME | |
done | |
find ${PROJECT_MODULE_DIR} -mindepth 1 -maxdepth 1 -name "*_temp" -type d -exec cp -a "{}" "${GODOT_MODULE_DIR}" \; | |
find ${PROJECT_MODULE_DIR} -mindepth 1 -maxdepth 1 -type d -name "*_temp" -exec rm -rf "{}" \; | |
# Build Godot for Android in debug and release mode | |
scons p=android -j$(nproc) colored=yes tools=no target=release_debug | |
scons p=android -j$(nproc) colored=yes tools=no target=release | |
# Create APK using Gradle | |
cd platform/android/java | |
./gradlew build | |
# Copy to export templates directory | |
cd ../../../bin/ | |
cp android_debug.apk android_release.apk $EXPORT_TEMPLATE_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment