This repository has been archived by the owner on Jun 18, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhotpur
executable file
·98 lines (92 loc) · 2.66 KB
/
hotpur
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/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
hotpurstash() {
STASHED=$(git stash)
}
hotpurunstash() {
if [[ "$STASHED" != "No local changes to save" ]]; then
git stash pop
fi
}
case "$1" in
"p" | "patch" | "apply")
(
set -e
cd "$basedir"
git submodule update --init --progress --recursive
scripts/apply.sh "$basedir"
)
;;
"b" | "bu" | "build")
(
basedir
./gradlew clean build publishToMavenLocal
)
;;
"rb" | "rbp" | "rebuild")
(
set -e
cd "$basedir"
scripts/rebuildpatches.sh "$basedir"
)
;;
"am" | "amend")
(
cd "$basedir"/Hotpur-API/
git add .
git commit --amend --no-edit
cd "$basedir"/Hotpur-Server/
git add .
git commit --amend --no-edit
cd "$basedir"/Hotpur-fabric-loader/
git add .
git commit --amend --no-edit
cd "$basedir"
scripts/rebuildpatches.sh "$basedir"
)
;;
"up" | "upstream")
(
cd "$basedir"
git submodule update --init --progress --recursive
scripts/upstream.sh "$2"
)
;;
"jar" | "hotpurclip")
(
basedir
cd "$basedir"
git submodule update --init --progress --recursive
if [ "$2" != "fast" ]; then
scripts/upstream.sh
fi
./scripts/apply.sh "$basedir" || exit 1
cd "$basedir"
./gradlew clean build publishToMavenLocal
)
;;
*)
echo "Hotpur build tool command. This provides a variety of commands to build and manage the Hotpur 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 Hotpur without building it"
echo " * b, build | Build Hotpur API and Server"
echo " * rb, rebuild | Rebuild patches"
echo " * am, amend | Amend current edits to last patches"
echo " * up, upstream | Build Purpur upstream, pass arg up to update Purpur"
echo " * jar, hotperclip | Apply all patches and build the project, hotpur-paperclip.jar will be output"
;;
esac
unset -f hotpurstash
unset -f hotpurunstash