-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·78 lines (71 loc) · 2 KB
/
build.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
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SOURCE=$([[ "$SOURCE" == /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
basedir=$(dirname "$SOURCE")
. "$basedir"/scripts/init.sh
buildshstash() {
STASHED=$(git stash)
}
buildshunstash() {
if [[ "$STASHED" != "No local changes to save" ]]; then
git stash pop
fi
}
case "$1" in
"p" | "patch" | "apply")
(
set -e
cd "$basedir"
scripts/apply.sh "$basedir" || exit 1
)
;;
"b" | "bu" | "build")
(
basedir
cd C2ME-fabric-patched
./gradlew clean build || exit 1
)
;;
"rb" | "rbp" | "rebuild")
(
set -e
cd "$basedir"
scripts/rebuildpatches.sh "$basedir" || exit 1
)
;;
"am" | "amend")
(
cd "$basedir"/C2ME-fabric-patched/
git add .
git commit --amend --no-edit
cd "$basedir"
scripts/rebuildpatches.sh "$basedir" || exit 1
)
;;
"up" | "upstream")
(
cd "$basedir"
scripts/upstream.sh "$2" || exit 1
)
;;
*)
echo "build.sh build tool command. This provides a variety of commands to build and manage the build"
echo "environment. For all of the functionality of this command to be available, you must first run the"
echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup."
echo ""
echo " Normal commands:"
echo " * p, patch | Apply all patches to top of Paper without building it"
echo " * b, build | Build"
echo " * rb, rebuild | Rebuild patches"
echo " * am, amend | Amend current edits to last patches"
echo " * up, upstream | Updates upstream"
;;
esac
unset -f buildshstash
unset -f buildshunstash