3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00
Paper/applyPatches.sh
konsolas 689f429c50 #634: Cross platform patch scripts
Removes the need for installing gnu sed on Mac
2020-02-20 10:58:01 +11:00

37 Zeilen
832 B
Bash
Ausführbare Datei

#!/bin/bash
if [ -z "$1" ]
then
echo "Please run this script again with the clean decompile sources as an argument. In most cases this will be ../work/decompile-XXXX"
exit
fi
# https://stackoverflow.com/a/38595160
# https://stackoverflow.com/a/800644
if sed --version >/dev/null 2>&1; then
strip_cr() {
sed -i -- "s/\r//" "$@"
}
else
strip_cr () {
sed -i "" "s/$(printf '\r')//" "$@"
}
fi
nms=$1/net/minecraft/server
cb=src/main/java/net/minecraft/server
#clean up and rebuild
rm -rf $cb
mkdir -p $cb
for file in $(/bin/ls nms-patches)
do
patchFile="nms-patches/$file"
file="$(echo $file | cut -d. -f1).java"
echo "Patching $file < $patchFile"
strip_cr "$nms/$file" > /dev/null
cp "$nms/$file" "$cb/$file"
patch -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"
done