mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Update byof scripts
This commit is contained in:
119
purpur
119
purpur
@@ -22,6 +22,36 @@ purpurunstash() {
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"p" | "patch" | "apply")
|
||||
(
|
||||
set -e
|
||||
cd "$basedir"
|
||||
if [ "$2" != "fast" ]; then
|
||||
scripts/upstream.sh
|
||||
fi
|
||||
scripts/apply.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
"b" | "bu" | "build")
|
||||
(
|
||||
basedir
|
||||
mvn -N install
|
||||
cd Purpur-API
|
||||
mvn -e clean install
|
||||
cd ../Paper/Paper-MojangAPI
|
||||
mvn -e clean install
|
||||
cd ../../Purpur-Server
|
||||
mvn -e clean install
|
||||
)
|
||||
;;
|
||||
|
||||
"rb" | "rbp" | "rebuild")
|
||||
(
|
||||
set -e
|
||||
cd "$basedir"
|
||||
scripts/rebuildpatches.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
"am" | "amend")
|
||||
(
|
||||
cd "$basedir"/Purpur-API/
|
||||
@@ -34,28 +64,10 @@ case "$1" in
|
||||
scripts/rebuildpatches.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
"rb" | "rbp" | "rebuild")
|
||||
"up" | "upstream")
|
||||
(
|
||||
set -e
|
||||
cd "$basedir"
|
||||
scripts/rebuildpatches.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
"p" | "patch" | "apply")
|
||||
(
|
||||
set -e
|
||||
cd "$basedir"
|
||||
scripts/apply.sh "$basedir"
|
||||
)
|
||||
;;
|
||||
"b" | "bu" | "build")
|
||||
(
|
||||
basedir
|
||||
mvn -N install
|
||||
cd Purpur-API
|
||||
mvn -e clean install
|
||||
cd ../Purpur-Server
|
||||
mvn -e clean install
|
||||
scripts/upstream.sh "$2"
|
||||
)
|
||||
;;
|
||||
"jar" | "purpurclip")
|
||||
@@ -66,73 +78,30 @@ case "$1" in
|
||||
scripts/upstream.sh
|
||||
fi
|
||||
./scripts/apply.sh "$basedir"
|
||||
./scripts/purpurclip.sh
|
||||
)
|
||||
;;
|
||||
"d" | "de" | "deploy")
|
||||
(
|
||||
basedir
|
||||
cd "$basedir"
|
||||
mvn -N install
|
||||
cd Purpur-API
|
||||
mvn clean deploy
|
||||
cd ../Purpur-Server
|
||||
mvn clean install
|
||||
)
|
||||
;;
|
||||
"up" | "upstream")
|
||||
(
|
||||
mvn -e clean install
|
||||
cd ../Paper/Paper-MojangAPI
|
||||
mvn -e clean install
|
||||
cd ../../Purpur-Server
|
||||
mvn -e clean install
|
||||
cd "$basedir"
|
||||
scripts/upstream.sh "$2"
|
||||
./scripts/purpurclip.sh
|
||||
)
|
||||
;;
|
||||
"r" | "root")
|
||||
cd "$basedir"
|
||||
;;
|
||||
"a" | "api")
|
||||
cd "$basedir/Purpur-API"
|
||||
;;
|
||||
"s" | "server")
|
||||
cd "$basedir/Purpur-Server"
|
||||
;;
|
||||
"setup")
|
||||
if [[ -f ~/.bashrc ]]; then
|
||||
NAME="purpur"
|
||||
if [[ -n "${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 purpur tool."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Purpur build tool command. This provides a variety of commands to build and manage the Purpur 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 " * p, patch | Apply all patches to top of Paper without building it"
|
||||
echo " * b, build | Build Purpur API and Server"
|
||||
echo " * rb, rebuild | Rebuild patches"
|
||||
echo " * am, amend | Amend current edits to last patches"
|
||||
echo " * rb, rebuild | Rebuild patches, can be called from anywhere."
|
||||
echo " * p, patch | Apply all patches to top of Paper without building it. Can be run from anywhere."
|
||||
echo " * up, upstream | Build Paper upstream, pass arg up to update paper. Can be run from anywhere."
|
||||
echo " * b, build | Build API and Server but no deploy. Can be ran anywhere."
|
||||
echo " * d, deploy | Build and Deploy API jar and build Server. Can be ran 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 Purpur-API directory."
|
||||
echo " * s, server | Move to the Purpur-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 " | . ./purpur setup"
|
||||
echo " | After you run this command you'll be able to just run 'purpur' from anywhere."
|
||||
echo " | The default name for the resulting alias is 'purpur', you can give an argument to override"
|
||||
echo " | this default, such as:"
|
||||
echo " | . ./purpur setup example"
|
||||
echo " | Which will allow you to run 'example' instead."
|
||||
echo " * up, upstream | Build Paper upstream, pass arg up to update paper"
|
||||
echo " * jar, purpurclip | Apply all patches and build the project, purpurclip.jar will be output"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ function enableCommitSigningIfNeeded {
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Importing MC-DEV"
|
||||
./scripts/importmcdev.sh "$basedir" || exit 1
|
||||
(
|
||||
(applyPatch Paper/Paper-API Purpur-API HEAD api "$API_REPO" &&
|
||||
applyPatch Paper/Paper-Server Purpur-Server HEAD server "$SERVER_REPO") || exit 1
|
||||
|
||||
@@ -11,7 +11,7 @@ done
|
||||
cd "$basedir" || exit
|
||||
paperVer=$(cat current-paper)
|
||||
|
||||
minecraftversion=$(< "$basedir"/Paper/work/BuildData/info.json grep minecraftVersion | cut -d '"' -f 4)
|
||||
minecraftversion=$(grep <"$basedir"/Paper/work/BuildData/info.json minecraftVersion | cut -d '"' -f 4)
|
||||
decompile="Paper/work/Minecraft/$minecraftversion/spigot"
|
||||
|
||||
mkdir -p mc-dev/src/net/minecraft/server
|
||||
|
||||
@@ -9,7 +9,7 @@ done
|
||||
. "$(dirname "$SOURCE")/init.sh"
|
||||
|
||||
workdir=$basedir/Paper/work
|
||||
minecraftversion=$(< "$basedir"/Paper/work/BuildData/info.json grep minecraftVersion | cut -d '"' -f 4)
|
||||
minecraftversion=$(grep <"$basedir"/Paper/work/BuildData/info.json minecraftVersion | cut -d '"' -f 4)
|
||||
decompiledir=$workdir/Minecraft/$minecraftversion/spigot
|
||||
|
||||
nms="net/minecraft/server"
|
||||
@@ -44,6 +44,26 @@ function import() {
|
||||
fi
|
||||
}
|
||||
|
||||
function importLibrary() {
|
||||
group=$1
|
||||
lib=$2
|
||||
prefix=$3
|
||||
shift 3
|
||||
for file in "$@"; do
|
||||
file="$prefix/$file"
|
||||
target="$basedir/Paper/Paper-Server/src/main/java/$file"
|
||||
targetdir=$(dirname "$target")
|
||||
mkdir -p "${targetdir}"
|
||||
base="$workdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file"
|
||||
if [ ! -f "$base" ]; then
|
||||
echo "Missing $base"
|
||||
exit 1
|
||||
fi
|
||||
export MODLOG="$MODLOG Imported $file from $lib\n"
|
||||
sed 's/\r$//' "$base" >"$target" || exit 1
|
||||
done
|
||||
}
|
||||
|
||||
(
|
||||
cd Paper/Paper-Server/ || exit
|
||||
lastlog=$(git log -1 --oneline)
|
||||
@@ -60,7 +80,7 @@ for f in $files; do
|
||||
containsElement "$f" "${nonnms[@]}"
|
||||
if [ "$?" == "1" ]; then
|
||||
if [ ! -f "$basedir/Paper/Paper-Server/src/main/java/net/minecraft/server/$f.java" ]; then
|
||||
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
|
||||
if [ ! -f "$decompiledir/$nms/$f.java" ] && [ true ]; then
|
||||
echo "$(bashColor 1 31) ERROR!!! Missing NMS$(bashColor 1 34) $f $(bashColorReset)"
|
||||
else
|
||||
import "$f"
|
||||
@@ -77,6 +97,16 @@ done
|
||||
|
||||
# import Foo
|
||||
|
||||
########################################################
|
||||
########################################################
|
||||
########################################################
|
||||
# LIBRARY IMPORTS
|
||||
# These must always be mapped manually, no automatic stuff
|
||||
#
|
||||
# # group # lib # prefix # many files
|
||||
|
||||
#importLibrary com.mojang datafixerupper com/mojang/datafixers/util Either.java
|
||||
|
||||
################
|
||||
(
|
||||
cd Paper/Paper-Server/ || exit
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copied from https://github.com/PaperMC/Paper/blob/d54ce6c17fb7a35238d6b9f734d30a4289886773/scripts/paperclip.sh
|
||||
# License from Paper applies to this file
|
||||
|
||||
(
|
||||
set -e
|
||||
basedir="$(cd "$1" && pwd -P)"
|
||||
workdir="$basedir/Paper/work"
|
||||
mcver=$(< "$workdir/BuildData/info.json" grep minecraftVersion | cut -d '"' -f 4)
|
||||
mcver=$(grep <"$workdir/BuildData/info.json" minecraftVersion | cut -d '"' -f 4)
|
||||
purpurjar="$basedir/Purpur-Server/target/purpur-$mcver.jar"
|
||||
vanillajar="$workdir/Minecraft/$mcver/$mcver.jar"
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ function savePatches() {
|
||||
rm "$basedir"/patches/"$2"/*.patch
|
||||
fi
|
||||
|
||||
git format-patch --quiet -N -o "$basedir"/patches/"$2" upstream/upstream
|
||||
git format-patch --no-signature --zero-commit --no-stat -N -o "$basedir"/patches/"$2" upstream/upstream
|
||||
cd "$basedir" || exit
|
||||
git add -A "$basedir"/patches/"$2"
|
||||
cleanupPatches "$basedir"/patches/"$2"/
|
||||
|
||||
@@ -28,7 +28,7 @@ mcVer=$(mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpre
|
||||
basedir
|
||||
. "$basedir"/scripts/importmcdev.sh
|
||||
|
||||
minecraftversion=$(< "$basedir"/Paper/work/BuildData/info.json grep minecraftVersion | cut -d '"' -f 4)
|
||||
minecraftversion=$(grep <"$basedir"/Paper/work/BuildData/info.json minecraftVersion | cut -d '"' -f 4)
|
||||
version=$(echo -e "Paper: $paperVer\nmc-dev:$importedmcdev")
|
||||
tag="${minecraftversion}-${mcVer}-$(echo -e "$version" | shasum | awk '{print $1}')"
|
||||
echo "$tag" >"$basedir"/current-paper
|
||||
|
||||
Reference in New Issue
Block a user