-
Notifications
You must be signed in to change notification settings - Fork 0
/
ilblu
executable file
·105 lines (98 loc) · 3.08 KB
/
ilblu
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
99
100
101
102
103
104
105
#!/usr/bin/env bash
# resolve shell-specifics
case "$(echo "$SHELL" | sed -E 's|/usr(/local)?||g')" in
"/bin/zsh")
RCPATH="$HOME/.zshrc"
SOURCE="${BASH_SOURCE[0]:-${(%):-%N}}"
;;
*)
RCPATH="$HOME/.bashrc"
if [[ -f "$HOME/.bash_aliases" ]]; then
RCPATH="$HOME/.bash_aliases"
fi
SOURCE="${BASH_SOURCE[0]}"
;;
esac
# get base dir regardless of execution location
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")
source "$basedir/scripts/functions.sh"
source "$basedir/scripts/includemvn.sh"
cd "$basedir/"
failed=0
case "$1" in
"rb" | "rbp" | "rebuild")
(
if [ "$2" == "init" ]; then
./scripts/initupstream.sh "$basedir" || exit 1
fi
./scripts/rebuildpatches.sh "$basedir" || exit 1
) || failed=1
;;
"p" | "patch" | "apply")
(
if [ "$2" == "init" ]; then
./scripts/initupstream.sh "$basedir" || exit 1
fi
./scripts/apply.sh "$basedir" || exit 1
) || failed=1
;;
"mcdev" | "mcdevsrc")
(
if [ "$2" == "init" ]; then
./scripts/initupstream.sh "$basedir" || exit 1
fi
./scripts/generatemcdevsrc.sh "$basedir" || exit 1
) || failed=1
;;
"i" | "init")
(
./scripts/initupstream.sh "$basedir" || exit 1
) || failed=1
;;
"mergeup")
(
./scripts/mergeupstream.sh "$basedir" || exit 1
) || failed=1
;;
"sync" | "syncfork")
(
./scripts/syncfork.sh "$basedir" || exit 1
) || failed=1
;;
"paperclip" | "jar")
(
./scripts/paperclip.sh "$basedir" || exit 1
) || failed=1
;;
*)
echo "Ilblu build tool command. This provides a variety of commands to build and manage the PaperMC build environment."
echo ""
echo " Commands:"
echo " * i, init | Initialize Paper. Can be run from anywhere."
echo " * rb, rebuild | Rebuild patches, can be called from anywhere."
echo " * p, patch, apply | Apply all patches to top of Paper without building it. Can be run from anywhere."
echo " * mcdev, mcdevsrc | Creates folder for mc src access. Can be run from anywhere."
echo " * mergeup | Merge upstream paper and rebuild patches. Can be ran anywhere."
echo " * sync, syncfork | Sync upstream ilblu and rebuild patches. Can be ran anywhere."
echo " * paperclip, jar | Creates the distributable paperclip jar. Can be ran anywhere."
;;
esac
unset RCPATH
unset SOURCE
unset basedir
unset -f bashColor
unset -f bashColorReset
unset -f pushRepo
if [[ "$failed" == "1" ]]; then
unset failed
false
else
unset failed
true
fi