forked from Electroid/SportPaper
-
Notifications
You must be signed in to change notification settings - Fork 2
/
sportpaper
executable file
·71 lines (65 loc) · 1.81 KB
/
sportpaper
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
#!/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"
paperstash() {
STASHED=$(git stash)
}
paperunstash() {
if [[ "$STASHED" != "No local changes to save" ]] ; then
git stash pop
fi
}
case "$1" in
"setup")
cd "$basedir"
scripts/upstream.sh
;;
"build")
log_info "Preparing to build SportPaper"
cd "$basedir"
scripts/upstream.sh
scripts/apply.sh "$basedir"
mvn clean install
;;
"rb" | "rbp" | "rebuild")
(
set -e
cd "$basedir"
scripts/rebuildpatches.sh "$basedir"
)
;;
"p" | "patch" | "apply")
(
set -e
cd "$basedir"
scripts/apply.sh "$basedir"
log_info " Run './sportpaper jar' to create a runnable JAR."
)
;;
"j" | "jar")
(
set -e
mvn clean install
)
;;
*)
echo "SportPaper build tool."
echo ""
echo " Commands:"
echo " * setup | Setup the build environment"
echo " * build | Setup the build environment, apply patches, and create a runnable JAR"
echo " * p, patch | Apply patches"
echo " * rb, rebuild | Rebuild patches"
echo " * j, jar | Create a runnable JAR"
;;
esac
unset -f paperstash
unset -f paperunstash