Merge pull request #26 in SPIGOT/craftbukkit from ~AIKAR/craftbukkit:applyPatches to master

* commit '7fb737c0e7a10ca6612849194c2fae50af291727':
  Improve patch scripts, add applyPatches.sh

By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
CraftBukkit/Spigot 2014-12-10 17:57:01 +01:00
commit 9221e55ec6
2 changed files with 29 additions and 3 deletions

24
paper-server/applyPatches.sh Executable file
View file

@ -0,0 +1,24 @@
#!/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
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"
sed -i 's/\r//' "$nms/$file"
cp "$nms/$file" "$cb/$file"
patch -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"
done

View file

@ -5,13 +5,15 @@ 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
cb=src/main/java/net/minecraft/server
nms="$1/net/minecraft/server"
for file in $(ls src/main/java/net/minecraft/server)
for file in $(/bin/ls $cb)
do
echo "Diffing $file"
dos2unix -q $1/net/minecraft/server/$file $1/net/minecraft/server/$file
sed -i 's/\r//' "$nms/$file"
outName=$(echo nms-patches/"$(echo $file | cut -d. -f1)".patch)
patchNew=$(diff -u $1/net/minecraft/server/$file src/main/java/net/minecraft/server/$file)
patchNew=$(diff -u "$nms/$file" "$cb/$file")
if [ -f "$outName" ]
then
patchCut=$(echo "$patchNew" | tail -n +3)