Paper/makePatches.sh
Aikar 8a8312fb92 Improve patch scripts, add applyPatches.sh
When working on CraftBukkit, one may need to update to the latest.
Before adding new work, you would need to rebuild your patched files to latest.
Currently BuildTools does this for you, but BuildTools does not support segment based actions.

So this new script replicates the behavior of rebuilding the patched files using nms-patches.

BuildTools can then be updated to simply call this script.

Also, improved makePatches by removing dos2unix. This command does not exists on all systems,
and can very simply be replaced by sed.

Finally, hard coded path to /ls as a user may of aliased ls to default change the format, so
call it directly to ensure we get the desired behavior.
2014-12-03 14:46:14 -05:00

29 lines
820 B
Bash
Executable File

#!/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
cb=src/main/java/net/minecraft/server
nms="$1/net/minecraft/server"
for file in $(/bin/ls $cb)
do
echo "Diffing $file"
sed -i 's/\r//' "$nms/$file"
outName=$(echo nms-patches/"$(echo $file | cut -d. -f1)".patch)
patchNew=$(diff -u "$nms/$file" "$cb/$file")
if [ -f "$outName" ]
then
patchCut=$(echo "$patchNew" | tail -n +3)
patchOld=$(cat "$outName" | tail -n +3)
if [ "$patchCut" != "$patchOld" ] ; then
echo "$outName changed"
echo "$patchNew" > "$outName"
fi
else
echo "New patch $outName"
echo "$patchNew" > "$outName"
fi
done