From ba1031ca7cf288e4f1fd4c45e331f861326b7623 Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Tue, 16 Mar 2021 18:30:17 +0100 Subject: [PATCH] Rename work dir --- scripts/applyPatches.sh | 3 ++- scripts/decompile.sh | 6 +++--- scripts/importmcdev.sh | 7 ++++--- scripts/init.sh | 3 ++- scripts/makemcdevsrc.sh | 3 ++- scripts/paperclip.sh | 3 ++- scripts/remap.sh | 16 ++++++++-------- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/scripts/applyPatches.sh b/scripts/applyPatches.sh index e700fde80b..7f9bdb589f 100755 --- a/scripts/applyPatches.sh +++ b/scripts/applyPatches.sh @@ -97,9 +97,10 @@ echo "Importing MC Dev" applyPatch "work/Spigot/Spigot-API" Paper-API HEAD && applyPatch "work/Spigot/Spigot-Server" Paper-Server HEAD cd "$basedir" + revision="$(cat "$basedir"/revision.txt | tr -d '\n')" # if we have previously ran ./paper mcdev, update it - if [ -d "$workdir/Minecraft/$minecraftversion/src" ]; then + if [ -d "$workdir/Minecraft/$minecraftversion-$revision/src" ]; then ./scripts/makemcdevsrc.sh "$basedir" fi ) || ( diff --git a/scripts/decompile.sh b/scripts/decompile.sh index 53a761bcc1..21b561f3c7 100755 --- a/scripts/decompile.sh +++ b/scripts/decompile.sh @@ -8,7 +8,7 @@ workdir="$basedir/work" revision="$(cat "$basedir"/revision.txt | tr -d '\n')" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) windows="$([[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]] && echo "true" || echo "false")" -decompiledir="$workdir/Minecraft/$minecraftversion" +decompiledir="$workdir/Minecraft/$minecraftversion-$revision" spigotdecompiledir="$decompiledir/spigot" forgedecompiledir="$decompiledir/forge" forgeflowerversion="1.5.380.19" @@ -21,7 +21,7 @@ forgefloweroptions="-dgs=1 -hdc=0 -asc=1 -udv=1 -jvn=1" forgeflowercachefile="$decompiledir/forgeflowercache" forgeflowercachevalue="$forgeflowerurl - $forgeflowerversion - $forgefloweroptions"; classdir="$decompiledir/classes" -versionjson="$workdir/Minecraft/$minecraftversion/$minecraftversion.json" +versionjson="$workdir/Minecraft/$minecraftversion-$revision/$minecraftversion.json" if [[ ! -f "$versionjson" ]]; then echo "Downloading $minecraftversion JSON Data" @@ -74,7 +74,7 @@ if [ ! -d "$classdir" ]; then mkdir -p "$classdir" cd "$classdir" set +e - jar xf "$decompiledir/$minecraftversion-$revision-mapped.jar" net/minecraft + jar xf "$decompiledir/$minecraftversion-mapped.jar" net/minecraft if [ "$?" != "0" ]; then cd "$basedir" echo "Failed to extract NMS classes." diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index fb795a84b2..c3f949a487 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -11,9 +11,10 @@ gitcmd="git -c commit.gpgsign=false" workdir="$basedir/work" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) -decompiledir="$workdir/Minecraft/$minecraftversion/forge" +revision="$(cat "$basedir"/revision.txt | tr -d '\n')" +decompiledir="$workdir/Minecraft/$minecraftversion-$revision/forge" # replace for now -decompiledir="$workdir/Minecraft/$minecraftversion/spigot" +decompiledir="$workdir/Minecraft/$minecraftversion-$revision/spigot" export importedmcdev="" function import { export importedmcdev="$importedmcdev $1" @@ -41,7 +42,7 @@ function importLibrary { target="$workdir/Spigot/Spigot-Server/src/main/java/${file}" targetdir=$(dirname "$target") mkdir -p "${targetdir}" - base="$workdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file" + base="$workdir/Minecraft/$minecraftversion-$revision/libraries/${group}/${lib}/$file" if [ ! -f "$base" ]; then echo "Missing $base" exit 1 diff --git a/scripts/init.sh b/scripts/init.sh index 9c51762ae6..40ed4a2661 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -5,8 +5,9 @@ set -e PS1="$" basedir="$(cd "$1" && pwd -P)" workdir="$basedir/work" +revision="$(cat "$basedir"/revision.txt | tr -d '\n')" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) -spigotdecompiledir="$workdir/Minecraft/$minecraftversion/spigot" +spigotdecompiledir="$workdir/Minecraft/$minecraftversion-$revision/spigot" nms="$spigotdecompiledir" cb="src/main/java" gitcmd="git -c commit.gpgsign=false" diff --git a/scripts/makemcdevsrc.sh b/scripts/makemcdevsrc.sh index dd4c4e48aa..a7186e3092 100755 --- a/scripts/makemcdevsrc.sh +++ b/scripts/makemcdevsrc.sh @@ -7,8 +7,9 @@ PS1="$" basedir="$(cd "$1" && pwd -P)" cd "$basedir" workdir="$basedir/work" +revision="$(cat "$basedir"/revision.txt | tr -d '\n')" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) -decompiledir="$workdir/Minecraft/$minecraftversion" +decompiledir="$workdir/Minecraft/$minecraftversion-$revision" nms="$decompiledir/spigot/net/minecraft/server" papernms="Paper-Server/src/main/java/net/minecraft/server" mcdevsrc="${decompiledir}/src/net/minecraft/server" diff --git a/scripts/paperclip.sh b/scripts/paperclip.sh index 2722ca3dda..cdb540de15 100755 --- a/scripts/paperclip.sh +++ b/scripts/paperclip.sh @@ -4,9 +4,10 @@ set -e basedir="$(cd "$1" && pwd -P)" workdir="$basedir/work" +revision="$(cat "$basedir"/revision.txt | tr -d '\n')" mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) paperjar="$basedir/Paper-Server/target/paper-$mcver.jar" -vanillajar="$workdir/Minecraft/$mcver/$mcver.jar" +vanillajar="$workdir/Minecraft/$mcver-$revision/$mcver.jar" ( cd "$workdir/Paperclip" diff --git a/scripts/remap.sh b/scripts/remap.sh index 60680ac81a..8f5746e4a1 100755 --- a/scripts/remap.sh +++ b/scripts/remap.sh @@ -13,7 +13,7 @@ accesstransforms="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info. classmappings="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info.json" | grep classMappings | cut -d '"' -f 4) membermappings="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info.json" | grep memberMappings | cut -d '"' -f 4) packagemappings="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info.json" | grep packageMappings | cut -d '"' -f 4) -decompiledir="$workdir/Minecraft/$minecraftversion" +decompiledir="$workdir/Minecraft/$minecraftversion-$revision" jarpath="$decompiledir/$minecraftversion" mkdir -p "$decompiledir" @@ -46,8 +46,8 @@ fi # These specialsource commands are from https://hub.spigotmc.org/stash/projects/SPIGOT/repos/builddata/browse/info.json echo "Applying class mappings..." -if [ ! -f "$jarpath-$revision-cl.jar" ]; then - java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map --only . --only net/minecraft --only com/mojang/math --auto-lvt BASIC --auto-member SYNTHETIC -i "$jarpath.jar" -m "$classmappings" -o "$jarpath-$revision-cl.jar" 1>/dev/null +if [ ! -f "$jarpath-cl.jar" ]; then + java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map --only . --only net/minecraft --only com/mojang/math --auto-lvt BASIC --auto-member SYNTHETIC -i "$jarpath.jar" -m "$classmappings" -o "$jarpath-cl.jar" 1>/dev/null if [ "$?" != "0" ]; then echo "Failed to apply class mappings." exit 1 @@ -55,8 +55,8 @@ if [ ! -f "$jarpath-$revision-cl.jar" ]; then fi echo "Applying member mappings..." -if [ ! -f "$jarpath-$revision-m.jar" ]; then - java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map --only . --only net/minecraft --only com/mojang/math --auto-member LOGGER --auto-member TOKENS -i "$jarpath-$revision-cl.jar" -m "$membermappings" -o "$jarpath-$revision-m.jar" 1>/dev/null +if [ ! -f "$jarpath-m.jar" ]; then + java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map --only . --only net/minecraft --only com/mojang/math --auto-member LOGGER --auto-member TOKENS -i "$jarpath-cl.jar" -m "$membermappings" -o "$jarpath-m.jar" 1>/dev/null if [ "$?" != "0" ]; then echo "Failed to apply member mappings." exit 1 @@ -64,8 +64,8 @@ if [ ! -f "$jarpath-$revision-m.jar" ]; then fi echo "Creating remapped jar..." -if [ ! -f "$jarpath-$revision-mapped.jar" ]; then - java -jar "$workdir/BuildData/bin/SpecialSource.jar" --only . --only net/minecraft --only com/mojang/math -i "$jarpath-$revision-m.jar" --access-transformer "$accesstransforms" -m "$packagemappings" -o "$jarpath-$revision-mapped.jar" 1>/dev/null +if [ ! -f "$jarpath-mapped.jar" ]; then + java -jar "$workdir/BuildData/bin/SpecialSource.jar" --only . --only net/minecraft --only com/mojang/math -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 @@ -74,7 +74,7 @@ fi echo "Installing remapped jar..." 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-$revision-mapped.jar" -Dpackaging=jar -DgroupId=io.papermc -DartifactId=minecraft-server -Dversion="$minecraftversion-$revision-SNAPSHOT" +mvn install:install-file -q -Dfile="$jarpath-mapped.jar" -Dpackaging=jar -DgroupId=io.papermc -DartifactId=minecraft-server -Dversion="$minecraftversion-SNAPSHOT" if [ "$?" != "0" ]; then echo "Failed to install remapped jar." exit 1