forked from starlis/empirecraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.sh
executable file
·41 lines (38 loc) · 1.14 KB
/
compile.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
#!/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")
cd "$basedir"
git pull
. scripts/init.sh
git submodule sync
git submodule update --init --recursive
(
cd Paper/
git submodule update --init
)
mc=$(cat $basedir/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
function update() {
cd $basedir
folder=${FORK_NAME}-$1
if [ ! -d "$folder" ]; then
git clone "$2" $folder
fi
cd $basedir/$folder
git fetch origin
git checkout master
git reset --hard origin/$mc
}
mvn clean install -N
update API "$API_REPO"
update Server "$SERVER_REPO"
cd ..
if [ "$1" != "--nocompile" ]; then
mvn clean install
fi