forked from docker-android-sdk/android-31
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-game.sh
executable file
·64 lines (55 loc) · 1.59 KB
/
build-game.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
PACKAGE_TYPES=${PACKAGE_TYPES:="assemble bundle"}
APP_TYPES=${APP_TYPES:="embed"}
RECORD_TYPES=${RECORD_TYPES:="record noRecord"}
BUILD_TYPES=${BUILD_TYPES:="release"}
BUILD_TASKS=""
for PACKAGE in $PACKAGE_TYPES
do
for APP in $APP_TYPES
do
for RECORD in $RECORD_TYPES
do
for BUILD in $BUILD_TYPES
do
BUILD_TASKS="${BUILD_TASKS} ${PACKAGE}${APP^}${RECORD^}${BUILD^}"
done
done
done
done
APPLICATION_ID=${APPLICATION_ID:="org.love2d.android"}
GAME_TITLE=${GAME_TITLE:="LOVE for Android"}
VERSION_CODE=${VERSION_CODE:=1}
VERSION_NAME=${VERSION_NAME:="0.0.0"}
ICON=${ICON:="@drawable/love"}
GAME_DIR=${GAME_DIR:="/game"}
# package the apk with your own LÖVE game
if [ -d "$GAME_DIR" ]
then
mkdir -p app/src/embed/assets
cp -R "$GAME_DIR"/* app/src/embed/assets
fi
# give your package a unique name, change the version
sed -i -r \
-e "s/applicationId .+/applicationId '$APPLICATION_ID'/" \
-e "s/versionCode .+/versionCode $VERSION_CODE/" \
-e "s/versionName .+/versionName '$VERSION_NAME'/" \
app/build.gradle
# change the name
xmlstarlet ed -L \
-u "/manifest/application/@android:label" -v "$GAME_TITLE" \
-u "/manifest/application/activity/@android:label" -v "$GAME_TITLE" \
app/src/main/AndroidManifest.xml
# change the icon
if [ -d "$ICONS_DIR" ]
then
cp -R "$ICONS_DIR"/* app/src/main/res
fi
xmlstarlet ed -L \
-u "/manifest/application/@android:icon" -v "$ICON" \
app/src/main/AndroidManifest.xml
./gradlew $BUILD_TASKS
cd app/build
./sign-releases.sh
./package-debug-symbols.sh
cd ../..