Archiviert
13
0

#634: Cross platform patch scripts

Removes the need for installing gnu sed on Mac
Dieser Commit ist enthalten in:
konsolas 2020-02-19 22:50:56 +00:00 committet von md_5
Ursprung ab85433d7f
Commit 689f429c50
2 geänderte Dateien mit 28 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -6,6 +6,18 @@ then
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
@ -17,7 +29,7 @@ do
file="$(echo $file | cut -d. -f1).java"
echo "Patching $file < $patchFile"
sed -i 's/\r//' "$nms/$file" > /dev/null
strip_cr "$nms/$file" > /dev/null
cp "$nms/$file" "$cb/$file"
patch -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"

Datei anzeigen

@ -5,6 +5,19 @@ 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
cb=src/main/java/net/minecraft/server
nms="$1/net/minecraft/server"
show_diff_msg=true
@ -24,8 +37,8 @@ do
then
echo "Diffing $file"
fi
sed -i 's/\r//' "$nms/$file"
sed -i 's/\r//' "$cb/$file"
strip_cr "$nms/$file" > /dev/null
strip_cr "$cb/$file" > /dev/null
outName=$(echo nms-patches/"$(echo $file | cut -d. -f1)".patch)
patchNew=$(diff -u --label a/net/minecraft/server/$file "$nms/$file" --label b/net/minecraft/server/$file "$cb/$file")
if [ -f "$outName" ]