Merge pull request #177 from DemonWav/cleanup
Cleanup and restructure the project
This commit is contained in:
commit
bbfe383410
|
@ -22,7 +22,16 @@ build/
|
||||||
bin/
|
bin/
|
||||||
dist/
|
dist/
|
||||||
manifest.mf
|
manifest.mf
|
||||||
work/
|
|
||||||
|
work/1.*
|
||||||
|
work/BuildData
|
||||||
|
work/Bukkit
|
||||||
|
work/CraftBukkit
|
||||||
|
work/Paperclip
|
||||||
|
work/Spigot
|
||||||
|
work/Spigot-Server
|
||||||
|
work/Spigot-API
|
||||||
|
work/*.jar
|
||||||
|
|
||||||
# Mac filesystem dust
|
# Mac filesystem dust
|
||||||
.DS_Store/
|
.DS_Store/
|
||||||
|
@ -37,15 +46,11 @@ work/
|
||||||
*~
|
*~
|
||||||
|
|
||||||
# other stuff
|
# other stuff
|
||||||
Spigot-API
|
|
||||||
Spigot-Server
|
|
||||||
Paper-Server
|
Paper-Server
|
||||||
Paper-API
|
Paper-API
|
||||||
PaperSpigot-Server
|
PaperSpigot-Server
|
||||||
PaperSpigot-API
|
PaperSpigot-API
|
||||||
Bukkit
|
|
||||||
CraftBukkit
|
|
||||||
Paperclip
|
|
||||||
Paperclip.jar
|
Paperclip.jar
|
||||||
paperclip.jar
|
paperclip.jar
|
||||||
paperclip-*.jar
|
paperclip-*.jar
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
[submodule "Bukkit"]
|
[submodule "work/Bukkit"]
|
||||||
path = Bukkit
|
path = work/Bukkit
|
||||||
url = https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
|
url = https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
|
||||||
[submodule "CraftBukkit"]
|
[submodule "work/CraftBukkit"]
|
||||||
path = CraftBukkit
|
path = work/CraftBukkit
|
||||||
url = https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
|
url = https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
|
||||||
[submodule "BuildData"]
|
[submodule "work/BuildData"]
|
||||||
path = BuildData
|
path = work/BuildData
|
||||||
url = https://hub.spigotmc.org/stash/scm/spigot/builddata.git
|
url = https://hub.spigotmc.org/stash/scm/spigot/builddata.git
|
||||||
[submodule "Paperclip"]
|
[submodule "work/Spigot"]
|
||||||
path = Paperclip
|
path = work/Spigot
|
||||||
url = https://github.com/PaperMC/Paperclip.git
|
|
||||||
[submodule "Spigot"]
|
|
||||||
path = Spigot
|
|
||||||
url = https://hub.spigotmc.org/stash/scm/spigot/spigot.git
|
url = https://hub.spigotmc.org/stash/scm/spigot/spigot.git
|
||||||
|
[submodule "work/Paperclip"]
|
||||||
|
path = work/Paperclip
|
||||||
|
url = https://github.com/PaperMC/Paperclip.git
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 6bff72410effad0b2b0b0d8471a477f42bd484ff
|
|
9
build.sh
9
build.sh
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
(git submodule update --init && ./remap.sh && ./decompile.sh && ./init.sh && ./applyPatches.sh) || (
|
|
||||||
echo "Failed to build Paper"
|
|
||||||
exit 1
|
|
||||||
) || exit 1
|
|
||||||
if [ "$1" == "--jar" ]; then
|
|
||||||
(mvn clean install && ./paperclip.sh) || exit 1
|
|
||||||
fi
|
|
40
init.sh
40
init.sh
|
@ -1,40 +0,0 @@
|
||||||
#!/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
|
|
||||||
|
|
||||||
paperjar="Paper-Server/target/paper-${minecraftversion}.jar"
|
|
||||||
vanillajar="work/${minecraftversion}/${minecraftversion}.jar"
|
|
||||||
|
|
||||||
echo -e "mcver=${minecraftversion}\npaperjar=../${paperjar}\nvanillajar=../${vanillajar}\n" > paperclip.properties
|
|
||||||
|
|
||||||
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 || exit 1
|
|
||||||
git commit -m "CraftBukkit $ $(date)" >/dev/null 2>&1 || exit 1
|
|
||||||
git checkout -f HEAD^ >/dev/null 2>&1 || exit 1
|
|
|
@ -0,0 +1,146 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# get base dir regardless of execution location
|
||||||
|
SOURCE="${BASH_SOURCE[0]}"
|
||||||
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||||
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
|
SOURCE="$(readlink "$SOURCE")"
|
||||||
|
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||||
|
done
|
||||||
|
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
|
||||||
|
basedir=$(dirname "$SOURCE")
|
||||||
|
|
||||||
|
paperstash() {
|
||||||
|
STASHED=$(git stash)
|
||||||
|
}
|
||||||
|
|
||||||
|
paperunstash() {
|
||||||
|
if [[ "$STASHED" != "No local changes to save" ]] ; then
|
||||||
|
git stash pop
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
"rbp" | "rebuild")
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
cd "$basedir"
|
||||||
|
scripts/rebuildPatches.sh "$basedir"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
"p" | "patch")
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
cd "$basedir"
|
||||||
|
scripts/build.sh "$basedir"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
"j" | "jar")
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
cd "$basedir"
|
||||||
|
scripts/build.sh "$basedir" "--jar"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
"make")
|
||||||
|
(
|
||||||
|
if [[ "$2" = "bacon" ]] ; then
|
||||||
|
set -e
|
||||||
|
cd "$basedir"
|
||||||
|
scripts/build.sh "$basedir" "--jar"
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
"r" | "root")
|
||||||
|
cd "$basedir"
|
||||||
|
;;
|
||||||
|
"a" | "api")
|
||||||
|
cd "$basedir/Paper-API"
|
||||||
|
;;
|
||||||
|
"s" | "server")
|
||||||
|
cd "$basedir"
|
||||||
|
;;
|
||||||
|
"e" | "edit")
|
||||||
|
case "$2" in
|
||||||
|
"s" | "server")
|
||||||
|
export LAST_EDIT="$basedir/Paper-Server"
|
||||||
|
cd "$basedir/Paper-Server"
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
|
||||||
|
paperstash
|
||||||
|
git rebase -i upstream/upstream
|
||||||
|
paperunstash
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
"a" | "api")
|
||||||
|
export LAST_EDIT="$basedir/Paper-API"
|
||||||
|
cd "$basedir/Paper-API"
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
|
||||||
|
paperstash
|
||||||
|
git rebase -i upstream/upstream
|
||||||
|
paperunstash
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
"c" | "continue")
|
||||||
|
cd "$LAST_EDIT"
|
||||||
|
unset LAST_EDIT
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit --amend
|
||||||
|
git rebase --continue
|
||||||
|
|
||||||
|
cd "$basedir"
|
||||||
|
scripts/rebuildPatches.sh "$basedir"
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "You must edit either the api or server."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
"setup")
|
||||||
|
if [[ -f ~/.bashrc ]] ; then
|
||||||
|
NAME="paper"
|
||||||
|
if [[ ! -z "${2+x}" ]] ; then
|
||||||
|
NAME="$2"
|
||||||
|
fi
|
||||||
|
(grep "alias $NAME=" ~/.bashrc > /dev/null) && (sed -i "s|alias $NAME=.*|alias $NAME='. $SOURCE'|g" ~/.bashrc) || (echo "alias $NAME='. $SOURCE'" >> ~/.bashrc)
|
||||||
|
alias "$NAME=. $SOURCE"
|
||||||
|
echo "You can now just type '$NAME' at any time to access the paper tool."
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "PaperMC build tool command. This provides a variety of commands to build and manage the PaperMC build"
|
||||||
|
echo "environment. For all of the functionality of this command to be available, you must first run the"
|
||||||
|
echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup."
|
||||||
|
echo ""
|
||||||
|
echo " Normal commands:"
|
||||||
|
echo " * rbp, rebuild | Rebuild patches, can be called from anywhere."
|
||||||
|
echo " * p, patch | Apply all patches to the project without building it. Can be run from anywhere."
|
||||||
|
echo " * j, jar | Apply all patches and build the project, paperclip.jar will be output. Can be run from anywhere."
|
||||||
|
echo ""
|
||||||
|
echo " These commands require the setup command before use:"
|
||||||
|
echo " * r, root | Change directory to the root of the project."
|
||||||
|
echo " * a. api | Move to the Paper-API directory."
|
||||||
|
echo " * s, server | Move to the Paper-Server directory."
|
||||||
|
echo " * e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\""
|
||||||
|
echo " | respectively to edit the correct project. Use the argument \"continue\" after"
|
||||||
|
echo " | the changes have been made to finish and rebuild patches. Can be called from anywhere."
|
||||||
|
echo ""
|
||||||
|
echo " * setup | Add an alias to .bashrc to allow full functionality of this script. Run as:"
|
||||||
|
echo " | . ./paper setup"
|
||||||
|
echo " | After you run this command you'll be able to just run 'paper' from anywhere."
|
||||||
|
echo " | The default name for the resulting alias is 'paper', you can give an argument to override"
|
||||||
|
echo " | this default, such as:"
|
||||||
|
echo " | . ./paper setup example"
|
||||||
|
echo " | Which will allow you to run 'example' instead."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
unset -f paperstash
|
||||||
|
unset -f paperunstash
|
15
paperclip.sh
15
paperclip.sh
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
basedir=`pwd`
|
|
||||||
workdir=$basedir/work
|
|
||||||
mcver=$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
|
||||||
|
|
||||||
cd ./Paperclip
|
|
||||||
mvn clean package
|
|
||||||
cd ..
|
|
||||||
cp ./Paperclip/target/paperclip-${mcver}.jar ./paperclip.jar
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo "Build success!"
|
|
||||||
echo "Copied final jar to $(pwd)/paperclip.jar"
|
|
|
@ -1,12 +1,15 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=`pwd`
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
|
workdir="$basedir/work"
|
||||||
echo "Rebuilding Forked projects.... "
|
echo "Rebuilding Forked projects.... "
|
||||||
|
|
||||||
function applyPatch {
|
function applyPatch {
|
||||||
what=$1
|
what=$1
|
||||||
what_name=$(basename $what)
|
what_name=$(basename "$what")
|
||||||
target=$2
|
target=$2
|
||||||
branch=$3
|
branch=$3
|
||||||
|
|
||||||
|
@ -21,7 +24,7 @@ function applyPatch {
|
||||||
cd "$basedir/$target"
|
cd "$basedir/$target"
|
||||||
echo "Resetting $target to $what_name..."
|
echo "Resetting $target to $what_name..."
|
||||||
git remote rm upstream > /dev/null 2>&1
|
git remote rm upstream > /dev/null 2>&1
|
||||||
git remote add upstream $basedir/$what >/dev/null 2>&1
|
git remote add upstream "$basedir/$what" >/dev/null 2>&1
|
||||||
git checkout master 2>/dev/null || git checkout -b master
|
git checkout master 2>/dev/null || git checkout -b master
|
||||||
git fetch upstream >/dev/null 2>&1
|
git fetch upstream >/dev/null 2>&1
|
||||||
git reset --hard upstream/upstream
|
git reset --hard upstream/upstream
|
||||||
|
@ -39,8 +42,8 @@ function applyPatch {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Move into spigot dir
|
# Move into spigot dir
|
||||||
pushd Spigot
|
cd "$workdir/Spigot"
|
||||||
basedir=$basedir/Spigot
|
basedir=$(pwd)
|
||||||
# Apply Spigot
|
# Apply Spigot
|
||||||
(
|
(
|
||||||
applyPatch ../Bukkit Spigot-API HEAD &&
|
applyPatch ../Bukkit Spigot-API HEAD &&
|
||||||
|
@ -50,19 +53,20 @@ basedir=$basedir/Spigot
|
||||||
exit 1
|
exit 1
|
||||||
) || exit 1
|
) || exit 1
|
||||||
# Move out of Spigot
|
# Move out of Spigot
|
||||||
popd
|
basedir="$1"
|
||||||
basedir=$(dirname "$basedir")
|
cd "$basedir"
|
||||||
|
|
||||||
echo "Importing MC Dev"
|
echo "Importing MC Dev"
|
||||||
|
|
||||||
./importmcdev.sh
|
./scripts/importmcdev.sh "$basedir"
|
||||||
|
|
||||||
# Apply paper
|
# Apply paper
|
||||||
|
cd "$basedir"
|
||||||
(
|
(
|
||||||
applyPatch Spigot/Spigot-API Paper-API HEAD &&
|
applyPatch "work/Spigot/Spigot-API" Paper-API HEAD &&
|
||||||
applyPatch Spigot/Spigot-Server Paper-Server HEAD
|
applyPatch "work/Spigot/Spigot-Server" Paper-Server HEAD
|
||||||
) || (
|
) || (
|
||||||
echo "Failed to apply Paper Patches"
|
echo "Failed to apply Paper Patches"
|
||||||
exit 1
|
exit 1
|
||||||
) || exit 1
|
) || exit 1
|
||||||
|
)
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
|
|
||||||
|
(git submodule update --init && ./scripts/remap.sh "$basedir" && ./scripts/decompile.sh "$basedir" && ./scripts/init.sh "$basedir" && ./scripts/applyPatches.sh "$basedir") || (
|
||||||
|
echo "Failed to build Paper"
|
||||||
|
exit 1
|
||||||
|
) || exit 1
|
||||||
|
if [ "$2" == "--jar" ]; then
|
||||||
|
mvn clean install && ./scripts/paperclip.sh "$basedir"
|
||||||
|
fi
|
||||||
|
)
|
|
@ -1,11 +1,13 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=`pwd`
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
workdir=$basedir/work
|
workdir="$basedir/work"
|
||||||
minecraftversion=$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
||||||
decompiledir=$workdir/$minecraftversion
|
decompiledir="$workdir/$minecraftversion"
|
||||||
classdir=$decompiledir/classes
|
classdir="$decompiledir/classes"
|
||||||
|
|
||||||
echo "Extracting NMS classes..."
|
echo "Extracting NMS classes..."
|
||||||
if [ ! -d "$classdir" ]; then
|
if [ ! -d "$classdir" ]; then
|
||||||
|
@ -22,9 +24,10 @@ fi
|
||||||
echo "Decompiling classes..."
|
echo "Decompiling classes..."
|
||||||
if [ ! -d "$decompiledir/net/minecraft/server" ]; then
|
if [ ! -d "$decompiledir/net/minecraft/server" ]; then
|
||||||
cd "$basedir"
|
cd "$basedir"
|
||||||
java -jar BuildData/bin/fernflower.jar -dgs=1 -hdc=0 -asc=1 -udv=0 "$classdir" "$decompiledir"
|
java -jar "$workdir/BuildData/bin/fernflower.jar" -dgs=1 -hdc=0 -asc=1 -udv=0 "$classdir" "$decompiledir"
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
echo "Failed to decompile classes."
|
echo "Failed to decompile classes."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
)
|
|
@ -1,19 +1,21 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
nms="net/minecraft/server"
|
nms="net/minecraft/server"
|
||||||
export MODLOG=""
|
export MODLOG=""
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=`pwd`
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
|
|
||||||
workdir=$basedir/work
|
workdir="$basedir/work"
|
||||||
minecraftversion=$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
||||||
decompiledir=$workdir/$minecraftversion
|
decompiledir="$workdir/$minecraftversion"
|
||||||
|
|
||||||
export importedmcdev=""
|
export importedmcdev=""
|
||||||
function import {
|
function import {
|
||||||
export importedmcdev="$importedmcdev $1"
|
export importedmcdev="$importedmcdev $1"
|
||||||
file="${1}.java"
|
file="${1}.java"
|
||||||
target="$basedir/Spigot/Spigot-Server/src/main/java/$nms/$file"
|
target="$workdir/Spigot/Spigot-Server/src/main/java/$nms/$file"
|
||||||
base="$decompiledir/$nms/$file"
|
base="$decompiledir/$nms/$file"
|
||||||
|
|
||||||
if [[ ! -f "$target" ]]; then
|
if [[ ! -f "$target" ]]; then
|
||||||
|
@ -24,7 +26,7 @@ function import {
|
||||||
}
|
}
|
||||||
|
|
||||||
(
|
(
|
||||||
cd Spigot/Spigot-Server/
|
cd "$workdir/Spigot/Spigot-Server/"
|
||||||
lastlog=$(git log -1 --oneline)
|
lastlog=$(git log -1 --oneline)
|
||||||
if [[ "$lastlog" = *"mc-dev Imports"* ]]; then
|
if [[ "$lastlog" = *"mc-dev Imports"* ]]; then
|
||||||
git reset --hard HEAD^
|
git reset --hard HEAD^
|
||||||
|
@ -59,8 +61,7 @@ import PathfinderGoalFloat
|
||||||
import PersistentVillage
|
import PersistentVillage
|
||||||
import TileEntityEnderChest
|
import TileEntityEnderChest
|
||||||
|
|
||||||
(
|
cd "$workdir/Spigot/Spigot-Server/"
|
||||||
cd Spigot/Spigot-Server/
|
git add src -A
|
||||||
git add src -A
|
echo -e "mc-dev Imports\n\n$MODLOG" | git commit src -F -
|
||||||
echo -e "mc-dev Imports\n\n$MODLOG" | git commit src -F -
|
|
||||||
)
|
)
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
PS1="$"
|
||||||
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
|
workdir="$basedir/work"
|
||||||
|
minecraftversion=$(cat "$workdir/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 "$workdir/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"
|
||||||
|
set +e
|
||||||
|
sed -i 's/\r//' "$nms/$file" > /dev/null
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
|
@ -1,14 +1,16 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
|
|
||||||
workdir=work
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
minecraftversion=$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
workdir="$basedir/work"
|
||||||
decompiledir=$workdir/$minecraftversion
|
minecraftversion=$(cat "$basedir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
||||||
nms=$decompiledir/net/minecraft/server
|
decompiledir="$workdir/$minecraftversion"
|
||||||
cb=src/main/java/net/minecraft/server
|
nms="$decompiledir/net/minecraft/server"
|
||||||
papernms=Paper-Server/src/main/java/net/minecraft/server
|
papernms="Paper-Server/src/main/java/net/minecraft/server"
|
||||||
mcdevsrc=${decompiledir}/src/net/minecraft/server
|
mcdevsrc="${decompiledir}/src/net/minecraft/server"
|
||||||
rm -rf "${mcdevsrc}"
|
rm -rf "${mcdevsrc}"
|
||||||
mkdir -p "${mcdevsrc}"
|
mkdir -p "${mcdevsrc}"
|
||||||
cp ${nms}/*.java "${mcdevsrc}/"
|
cp ${nms}/*.java "${mcdevsrc}/"
|
||||||
|
@ -23,3 +25,4 @@ do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "Built $decompiledir/src to be included in your project for src access";
|
echo "Built $decompiledir/src to be included in your project for src access";
|
||||||
|
)
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
|
workdir="$basedir/work"
|
||||||
|
mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
||||||
|
paperjar="../../Paper-Server/target/paper-$mcver.jar"
|
||||||
|
vanillajar="../$mcver/$mcver.jar"
|
||||||
|
|
||||||
|
(
|
||||||
|
cd "$workdir/Paperclip"
|
||||||
|
mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$paperjar" "-Dvanillajar=$vanillajar"
|
||||||
|
)
|
||||||
|
cp "$workdir/Paperclip/target/paperclip-${mcver}.jar" "$basedir/paperclip.jar"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
echo "Build success!"
|
||||||
|
echo "Copied final jar to $(cd "$basedir" && pwd -P)/paperclip.jar"
|
||||||
|
)
|
|
@ -1,7 +1,10 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=`pwd`
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
|
workdir="$basedir/work"
|
||||||
echo "Rebuilding patch files from current fork state..."
|
echo "Rebuilding patch files from current fork state..."
|
||||||
git config core.safecrlf false
|
git config core.safecrlf false
|
||||||
|
|
||||||
|
@ -9,24 +12,26 @@ function cleanupPatches {
|
||||||
cd "$1"
|
cd "$1"
|
||||||
for patch in *.patch; do
|
for patch in *.patch; do
|
||||||
echo "$patch"
|
echo "$patch"
|
||||||
gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1)
|
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)")
|
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")
|
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
|
||||||
if [ "x$testver" != "x" ]; then
|
if [ "x$testver" != "x" ]; then
|
||||||
|
set +e
|
||||||
diffs=$(echo "$diffs" | sed 'N;$!P;$!D;$d')
|
diffs=$(echo "$diffs" | sed 'N;$!P;$!D;$d')
|
||||||
|
set -e
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x$diffs" == "x" ] ; then
|
if [ "x$diffs" == "x" ] ; then
|
||||||
git reset HEAD $patch >/dev/null
|
git reset HEAD "$patch" >/dev/null
|
||||||
git checkout -- $patch >/dev/null
|
git checkout -- "$patch" >/dev/null
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function savePatches {
|
function savePatches {
|
||||||
what=$1
|
what=$1
|
||||||
what_name=$(basename $what)
|
what_name=$(basename "$what")
|
||||||
target=$2
|
target=$2
|
||||||
echo "Formatting patches for $what..."
|
echo "Formatting patches for $what..."
|
||||||
|
|
||||||
|
@ -42,5 +47,6 @@ function savePatches {
|
||||||
echo " Patches saved for $what to $what_name-Patches/"
|
echo " Patches saved for $what to $what_name-Patches/"
|
||||||
}
|
}
|
||||||
|
|
||||||
savePatches Spigot/Spigot-API Paper-API
|
savePatches "$workdir/Spigot/Spigot-API" "Paper-API"
|
||||||
savePatches Spigot/Spigot-Server Paper-Server
|
savePatches "$workdir/Spigot/Spigot-Server" "Paper-Server"
|
||||||
|
)
|
|
@ -1,15 +1,17 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=`pwd`
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
workdir=$basedir/work
|
workdir="$basedir/work"
|
||||||
minecraftversion=$(cat BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
minecraftversion=$(cat ${workdir}/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
||||||
minecrafthash=$(cat BuildData/info.json | grep minecraftHash | cut -d '"' -f 4)
|
minecrafthash=$(cat ${workdir}/BuildData/info.json | grep minecraftHash | cut -d '"' -f 4)
|
||||||
accesstransforms=BuildData/mappings/$(cat BuildData/info.json | grep accessTransforms | cut -d '"' -f 4)
|
accesstransforms="$workdir/BuildData/mappings/"$(cat ${workdir}/BuildData/info.json | grep accessTransforms | cut -d '"' -f 4)
|
||||||
classmappings=BuildData/mappings/$(cat BuildData/info.json | grep classMappings | cut -d '"' -f 4)
|
classmappings="$workdir/BuildData/mappings/"$(cat ${workdir}/BuildData/info.json | grep classMappings | cut -d '"' -f 4)
|
||||||
membermappings=BuildData/mappings/$(cat BuildData/info.json | grep memberMappings | cut -d '"' -f 4)
|
membermappings="$workdir/BuildData/mappings/"$(cat ${workdir}/BuildData/info.json | grep memberMappings | cut -d '"' -f 4)
|
||||||
packagemappings=BuildData/mappings/$(cat BuildData/info.json | grep packageMappings | cut -d '"' -f 4)
|
packagemappings="$workdir/BuildData/mappings/"$(cat ${workdir}/BuildData/info.json | grep packageMappings | cut -d '"' -f 4)
|
||||||
jarpath=$workdir/$minecraftversion/$minecraftversion
|
jarpath="$workdir/$minecraftversion/$minecraftversion"
|
||||||
|
|
||||||
echo "Downloading unmapped vanilla jar..."
|
echo "Downloading unmapped vanilla jar..."
|
||||||
if [ ! -f "$jarpath.jar" ]; then
|
if [ ! -f "$jarpath.jar" ]; then
|
||||||
|
@ -36,7 +38,7 @@ fi
|
||||||
|
|
||||||
echo "Applying class mappings..."
|
echo "Applying class mappings..."
|
||||||
if [ ! -f "$jarpath-cl.jar" ]; then
|
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
|
java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map -i "$jarpath.jar" -m "$classmappings" -o "$jarpath-cl.jar" 1>/dev/null
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
echo "Failed to apply class mappings."
|
echo "Failed to apply class mappings."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -45,7 +47,7 @@ fi
|
||||||
|
|
||||||
echo "Applying member mappings..."
|
echo "Applying member mappings..."
|
||||||
if [ ! -f "$jarpath-m.jar" ]; then
|
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
|
java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map -i "$jarpath-cl.jar" -m "$membermappings" -o "$jarpath-m.jar" 1>/dev/null
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
echo "Failed to apply member mappings."
|
echo "Failed to apply member mappings."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -54,7 +56,7 @@ fi
|
||||||
|
|
||||||
echo "Creating remapped jar..."
|
echo "Creating remapped jar..."
|
||||||
if [ ! -f "$jarpath-mapped.jar" ]; then
|
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
|
java -jar "$workdir/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
|
if [ "$?" != "0" ]; then
|
||||||
echo "Failed to create remapped jar."
|
echo "Failed to create remapped jar."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -62,9 +64,10 @@ if [ ! -f "$jarpath-mapped.jar" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing remapped jar..."
|
echo "Installing remapped jar..."
|
||||||
cd CraftBukkit # Need to be in a directory with a valid POM at the time of install.
|
cd "$workdir/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"
|
mvn install:install-file -q -Dfile="$jarpath-mapped.jar" -Dpackaging=jar -DgroupId=org.spigotmc -DartifactId=minecraft-server -Dversion="$minecraftversion-SNAPSHOT"
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
echo "Failed to install remapped jar."
|
echo "Failed to install remapped jar."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
)
|
|
@ -1,10 +1,13 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=`pwd`
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
|
workdir="$basedir/work"
|
||||||
|
|
||||||
function update {
|
function update {
|
||||||
cd "$basedir/$1"
|
cd "$workdir/$1"
|
||||||
git fetch && git reset --hard origin/master
|
git fetch && git reset --hard origin/master
|
||||||
cd ../
|
cd ../
|
||||||
git add $1
|
git add $1
|
||||||
|
@ -13,3 +16,4 @@ function update {
|
||||||
update Bukkit
|
update Bukkit
|
||||||
update CraftBukkit
|
update CraftBukkit
|
||||||
update Spigot
|
update Spigot
|
||||||
|
)
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 90e566f21456fb83ba33a8910ee99c2e426c6de7
|
Loading…
Reference in New Issue