testserver/scripts/upstreamMerge.sh

42 lines
976 B
Bash
Raw Permalink Normal View History

2016-04-02 03:55:54 +00:00
#!/usr/bin/env bash
(
set -e
PS1="$"
basedir="$(cd "$1" && pwd -P)"
2016-04-02 03:55:54 +00:00
workdir="$basedir/work"
gitcmd="git -c commit.gpgsign=false"
updated="0"
function getRef {
git ls-tree $1 $2 | cut -d' ' -f3 | cut -f1
}
function update {
2016-04-02 03:55:54 +00:00
cd "$workdir/$1"
$gitcmd fetch && $gitcmd clean -fd && $gitcmd reset --hard origin/master
refRemote=$(git rev-parse HEAD)
cd ../
$gitcmd add --force $1
refHEAD=$(getRef HEAD "$workdir/$1")
echo "$1 $refHEAD - $refRemote"
if [ "$refHEAD" != "$refRemote" ]; then
export updated="1"
fi
}
update Bukkit
update CraftBukkit
update Spigot
2016-08-19 21:00:59 +00:00
2017-05-21 04:41:39 +00:00
if [[ "$2" = "all" || "$2" = "a" ]] ; then
2016-08-19 21:00:59 +00:00
update BuildData
fi
if [ "$updated" == "1" ]; then
echo "Rebuilding patches without filtering to improve apply ability"
cd "$basedir"
2021-06-15 08:38:41 +00:00
./gradlew cleanCache || exit 1 # todo: Figure out why this is necessary
./gradlew applyPatches -Dpaperweight.debug=true || exit 1
./gradlew rebuildPatches || exit 1
fi
)