forked from Roboron3042/simutrans-android-cmake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepareAndBuild.sh
More file actions
executable file
·40 lines (31 loc) · 1.59 KB
/
prepareAndBuild.sh
File metadata and controls
executable file
·40 lines (31 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
if [ ! -d "simutrans/jni/simutrans" ]; then
echo "First you must copy simutrans source directory to simutrans/jni/simutrans"
exit 1
fi
# Init submodules
git submodule init
git submodule update
cd simutrans/jni
# Build libraries
if ! ./build_libraries.sh; then
exit 1
fi
# Fluidsynth is a PITA to build; using the prebuilt release instead
#wget https://github.com/FluidSynth/fluidsynth/releases/download/v2.3.5/fluidsynth-2.3.5-android24.zip
#unzip fluidsynth-*.zip -d fluidsynth
# Assets
./simutrans/src/android/AndroidPreBuild.sh
cp -rf simutrans/simutrans/. ../src/main/assets
# Revision
cd simutrans/tools
REVISION=$(./get_revision.sh)
sed -i "s/versionCode [0-9]\+/versionCode $REVISION/" ../../../build.gradle
# Get the version and nightly status
cd ../../../..
VERSION=`sed -n 's/#define SIM_VERSION_MAJOR *\([0-9]*\)$/\1/ p' <simutrans/jni/simutrans/src/simutrans/simversion.h`.`sed -n 's/#define SIM_VERSION_MINOR *\([0-9]*\)$/\1/ p' <simutrans/jni/simutrans/src/simutrans/simversion.h`.`sed -n 's/#define SIM_VERSION_PATCH *\([0-9]*\)$/\1/ p' <simutrans/jni/simutrans/src/simutrans/simversion.h`
NIGHTLY=`sed -n 's/#define SIM_VERSION_BUILD SIM_BUILD_NIGHTLY/ Nightly/ p' <simutrans/jni/simutrans/src/simutrans/simversion.h``sed -n 's/#define SIM_VERSION_BUILD SIM_BUILD_RELEASE_CANDIDATE/ Release candidate/ p' <simutrans/jni/simutrans/src/simutrans/simversion.h`
sed -i 's/versionName.*$/versionName "'"$VERSION$NIGHTLY"'"/' simutrans/build.gradle
# Build Android project
cp -r simutrans/jni/SDL/android-project/app/src/main/java simutrans/src/main
./gradlew assembleRelease
./gradlew bundleRelease