mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 06:25:15 +01:00
Add submodules and build scripts
These will be made default in 1.9, dropping PaperTools support
This commit is contained in:
parent
861d6c6247
commit
c86923f08f
11 changed files with 225 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -22,6 +22,7 @@ build/
|
|||
bin/
|
||||
dist/
|
||||
manifest.mf
|
||||
work/
|
||||
|
||||
# Mac filesystem dust
|
||||
.DS_Store/
|
||||
|
|
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
[submodule "Bukkit"]
|
||||
path = Bukkit
|
||||
url = https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
|
||||
[submodule "CraftBukkit"]
|
||||
path = CraftBukkit
|
||||
url = https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
|
||||
[submodule "BuildData"]
|
||||
path = BuildData
|
||||
url = https://hub.spigotmc.org/stash/scm/spigot/builddata.git
|
1
BuildData
Submodule
1
BuildData
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 838b40587fa7a68a130b75252959bc8a3481d94f
|
1
Bukkit
Submodule
1
Bukkit
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit f10a7a92f33995b08f63633b23de6ec80b50a609
|
1
CraftBukkit
Submodule
1
CraftBukkit
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit a66b96584771093d7199eff150161b83384b7056
|
3
build.sh
Executable file
3
build.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
git submodule update --init && ./remap.sh && ./decompile.sh && ./init.sh && ./newApplyPatches.sh && mvn clean install
|
30
decompile.sh
Executable file
30
decompile.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
PS1="$"
|
||||
basedir=`pwd`
|
||||
workdir=$basedir/work
|
||||
minecraftversion=$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
decompiledir=$workdir/$minecraftversion
|
||||
classdir=$decompiledir/classes
|
||||
|
||||
echo "Extracting NMS classes..."
|
||||
if [ ! -d "$classdir" ]; then
|
||||
mkdir -p "$classdir"
|
||||
cd "$classdir"
|
||||
jar xf "$decompiledir/$minecraftversion-mapped.jar" net/minecraft/server
|
||||
if [ "$?" != "0" ]; then
|
||||
cd "$basedir"
|
||||
echo "Failed to extract NMS classes."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Decompiling classes..."
|
||||
if [ ! -d "$decompiledir/net/minecraft/server" ]; then
|
||||
cd "$basedir"
|
||||
java -jar BuildData/bin/fernflower.jar -dgs=1 -hdc=0 -rbr=0 -asc=1 -udv=0 "$classdir" "$decompiledir"
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed to decompile classes."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
35
init.sh
Executable file
35
init.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
PS1="$"
|
||||
basedir=`pwd`
|
||||
workdir=$basedir/work
|
||||
minecraftversion=$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
decompiledir=$workdir/$minecraftversion
|
||||
nms=$decompiledir/net/minecraft/server
|
||||
cb=src/main/java/net/minecraft/server
|
||||
|
||||
patch=$(which patch 2>/dev/null)
|
||||
if [ "x$patch" == "x" ]; then
|
||||
patch=$basedir/hctap.exe
|
||||
fi
|
||||
|
||||
echo "Applying CraftBukkit patches to NMS..."
|
||||
cd "$basedir/CraftBukkit"
|
||||
git checkout -B patched HEAD >/dev/null 2>&1
|
||||
rm -rf $cb
|
||||
mkdir -p $cb
|
||||
for file in $(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" > /dev/null
|
||||
|
||||
cp "$nms/$file" "$cb/$file"
|
||||
"$patch" -s -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"
|
||||
done
|
||||
|
||||
git add src >/dev/null 2>&1
|
||||
git commit -m "CraftBukkit $ $(date)" >/dev/null 2>&1
|
||||
git checkout -f HEAD^ >/dev/null 2>&1
|
39
newApplyPatches.sh
Executable file
39
newApplyPatches.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
PS1="$"
|
||||
basedir=`pwd`
|
||||
echo "Rebuilding Forked projects.... "
|
||||
|
||||
function applyPatch {
|
||||
what=$1
|
||||
target=$2
|
||||
branch=$3
|
||||
cd "$basedir/$what"
|
||||
git fetch
|
||||
git branch -f upstream "$branch" >/dev/null
|
||||
|
||||
cd "$basedir"
|
||||
if [ ! -d "$basedir/$target" ]; then
|
||||
git clone "$what" "$target"
|
||||
fi
|
||||
cd "$basedir/$target"
|
||||
echo "Resetting $target to $what..."
|
||||
git remote add -f upstream ../$what >/dev/null 2>&1
|
||||
git checkout master >/dev/null 2>&1
|
||||
git fetch upstream >/dev/null 2>&1
|
||||
git reset --hard upstream/upstream
|
||||
echo " Applying patches to $target..."
|
||||
git am --abort >/dev/null 2>&1
|
||||
git am --3way --ignore-whitespace "$basedir/${what}-Patches/"*.patch
|
||||
if [ "$?" != "0" ]; then
|
||||
echo " Something did not apply cleanly to $target."
|
||||
echo " Please review above details and finish the apply then"
|
||||
echo " save the changes with rebuildPatches.sh"
|
||||
exit 1
|
||||
else
|
||||
echo " Patches applied cleanly to $target"
|
||||
fi
|
||||
}
|
||||
|
||||
applyPatch Bukkit Spigot-API HEAD && applyPatch CraftBukkit Spigot-Server patched
|
||||
applyPatch Spigot-API PaperSpigot-API HEAD && applyPatch Spigot-Server PaperSpigot-Server HEAD
|
42
newRebuildPatches.sh
Executable file
42
newRebuildPatches.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
PS1="$"
|
||||
basedir=`pwd`
|
||||
echo "Rebuilding patch files from current fork state..."
|
||||
git config core.safecrlf false
|
||||
|
||||
function cleanupPatches {
|
||||
cd "$1"
|
||||
for patch in *.patch; do
|
||||
echo "$patch"
|
||||
gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1)
|
||||
diffs=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index)")
|
||||
|
||||
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
|
||||
if [ "x$testver" != "x" ]; then
|
||||
diffs=$(echo "$diffs" | sed 'N;$!P;$!D;$d')
|
||||
fi
|
||||
|
||||
if [ "x$diffs" == "x" ] ; then
|
||||
git reset HEAD $patch >/dev/null
|
||||
git checkout -- $patch >/dev/null
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function savePatches {
|
||||
what=$1
|
||||
target=$2
|
||||
echo "Formatting patches for $what..."
|
||||
cd "$basedir/$target"
|
||||
git format-patch --no-stat -N -o "$basedir/${what}-Patches/" upstream/upstream >/dev/null
|
||||
cd "$basedir"
|
||||
git add -A "$basedir/${what}-Patches"
|
||||
cleanupPatches "$basedir/${what}-Patches"
|
||||
echo " Patches saved for $what to $what-Patches/"
|
||||
}
|
||||
if [ "$1" == "clean" ]; then
|
||||
rm -rf Spigot-*-Patches
|
||||
fi
|
||||
savePatches Spigot-API PaperSpigot-API
|
||||
savePatches Spigot-Server PaperSpigot-Server
|
63
remap.sh
Executable file
63
remap.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
|
||||
PS1="$"
|
||||
basedir=`pwd`
|
||||
workdir=$basedir/work
|
||||
minecraftversion=$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||
minecrafthash=$(cat BuildData/info.json | grep minecraftHash | cut -d '"' -f 4)
|
||||
accesstransforms=BuildData/mappings/$(cat BuildData/info.json | grep accessTransforms | cut -d '"' -f 4)
|
||||
classmappings=BuildData/mappings/$(cat BuildData/info.json | grep classMappings | cut -d '"' -f 4)
|
||||
membermappings=BuildData/mappings/$(cat BuildData/info.json | grep memberMappings | cut -d '"' -f 4)
|
||||
packagemappings=BuildData/mappings/$(cat BuildData/info.json | grep packageMappings | cut -d '"' -f 4)
|
||||
jarpath=$workdir/$minecraftversion/$minecraftversion
|
||||
|
||||
echo "Downloading unmapped vanilla jar..."
|
||||
if [ ! -f "$jarpath.jar" ]; then
|
||||
mkdir -p "$workdir/$minecraftversion"
|
||||
curl -s -o "$jarpath.jar" "https://s3.amazonaws.com/Minecraft.Download/versions/$minecraftversion/minecraft_server.$minecraftversion.jar"
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed to download the vanilla server jar. Check connectivity or try again later."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
checksum=$(md5sum "$jarpath.jar" | cut -d ' ' -f 1)
|
||||
if [ "$checksum" != "$minecrafthash" ]; then
|
||||
echo "The MD5 checksum of the downloaded server jar does not match the BuildData hash."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Applying class mappings..."
|
||||
if [ ! -f "$jarpath-cl.jar" ]; then
|
||||
java -jar BuildData/bin/SpecialSource-2.jar map -i "$jarpath.jar" -m "$classmappings" -o "$jarpath-cl.jar" 1>/dev/null
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed to apply class mappings."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Applying member mappings..."
|
||||
if [ ! -f "$jarpath-m.jar" ]; then
|
||||
java -jar BuildData/bin/SpecialSource-2.jar map -i "$jarpath-cl.jar" -m "$membermappings" -o "$jarpath-m.jar" 1>/dev/null
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed to apply member mappings."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Creating remapped jar..."
|
||||
if [ ! -f "$jarpath-mapped.jar" ]; then
|
||||
java -jar BuildData/bin/SpecialSource.jar --kill-lvt -i "$jarpath-m.jar" --access-transformer "$accesstransforms" -m "$packagemappings" -o "$jarpath-mapped.jar" 1>/dev/null
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed to create remapped jar."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Installing remapped jar..."
|
||||
cd CraftBukkit # Need to be in a directory with a valid POM at the time of install.
|
||||
mvn install:install-file -q -Dfile="$jarpath-mapped.jar" -Dpackaging=jar -DgroupId=org.spigotmc -DartifactId=minecraft-server -Dversion="$minecraftversion-SNAPSHOT"
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed to install remapped jar."
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in a new issue