summaryrefslogtreecommitdiffstats
path: root/makePatches.sh
blob: 8dd725d630400a9cd038b05b06483d5ca14e8e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/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

for file in $(ls src/main/java/net/minecraft/server)
do
	echo "Diffing $file"
	dos2unix -q $1/net/minecraft/server/$file $1/net/minecraft/server/$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)
        patchCut=$(echo "$patchNew" | tail -n +3)
        patchOld=$(cat "$outName" | tail -n +3)
        if [ "$patchCut" != "$patchOld" ] ; then
            echo "$outName changed"
            echo "$patchNew" > "$outName"
        fi
done