Use `set -e` to handle errors better in the build scripts
This commit is contained in:
parent
7effde04b1
commit
0394633734
114
paper
114
paper
|
@ -22,59 +22,81 @@ paperunstash() {
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"rbp" | "rebuild")
|
"rbp" | "rebuild")
|
||||||
(
|
(
|
||||||
|
set -e
|
||||||
cd "$basedir"
|
cd "$basedir"
|
||||||
scripts/rebuildPatches.sh "$basedir"
|
scripts/rebuildPatches.sh "$basedir"
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
"a" | "apply")
|
"p" | "patch")
|
||||||
(
|
(
|
||||||
|
set -e
|
||||||
cd "$basedir"
|
cd "$basedir"
|
||||||
scripts/build.sh "$basedir"
|
scripts/build.sh "$basedir"
|
||||||
)
|
)
|
||||||
;;
|
;;
|
||||||
"j" | "jar")
|
"j" | "jar")
|
||||||
(
|
(
|
||||||
cd "$basedir"
|
set -e
|
||||||
|
cd "$basedir"
|
||||||
scripts/build.sh "$basedir" "--jar"
|
scripts/build.sh "$basedir" "--jar"
|
||||||
)
|
)
|
||||||
|
;;
|
||||||
|
"make")
|
||||||
|
(
|
||||||
|
if [[ "$2" = "bacon" ]] ; then
|
||||||
|
set -e
|
||||||
|
cd "$basedir"
|
||||||
|
scripts/build.sh "$basedir" "--jar"
|
||||||
|
fi
|
||||||
|
)
|
||||||
;;
|
;;
|
||||||
"r" | "root")
|
"r" | "root")
|
||||||
cd "$basedir"
|
cd "$basedir"
|
||||||
;;
|
;;
|
||||||
"api")
|
"a" | "api")
|
||||||
cd "$basedir/Paper-API"
|
cd "$basedir/Paper-API"
|
||||||
;;
|
;;
|
||||||
"serv" | "server")
|
"s" | "server")
|
||||||
cd "$basedir"
|
cd "$basedir"
|
||||||
;;
|
;;
|
||||||
"e" | "edit")
|
"e" | "edit")
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"server")
|
"s" | "server")
|
||||||
cd "$basedir/Paper-Server"
|
export LAST_EDIT="$basedir/Paper-Server"
|
||||||
export LAST_EDIT=$(pwd)
|
cd "$basedir/Paper-Server"
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
|
||||||
paperstash
|
paperstash
|
||||||
git rebase -i upstream/upstream
|
git rebase -i upstream/upstream
|
||||||
paperunstash
|
paperunstash
|
||||||
|
)
|
||||||
;;
|
;;
|
||||||
"api")
|
"a" | "api")
|
||||||
cd "$basedir/Paper-API"
|
export LAST_EDIT="$basedir/Paper-API"
|
||||||
export LAST_EDIT=$(pwd)
|
cd "$basedir/Paper-API"
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
|
||||||
paperstash
|
paperstash
|
||||||
git rebase -i upstream/upstream
|
git rebase -i upstream/upstream
|
||||||
paperunstash
|
paperunstash
|
||||||
|
)
|
||||||
;;
|
;;
|
||||||
"continue")
|
"c" | "continue")
|
||||||
cd "$LAST_EDIT"
|
cd "$LAST_EDIT"
|
||||||
|
unset LAST_EDIT
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
|
||||||
git add .
|
git add .
|
||||||
|
git commit --amend
|
||||||
git rebase --continue
|
git rebase --continue
|
||||||
unset LAST_EDIT
|
|
||||||
(
|
cd "$basedir"
|
||||||
cd "$basedir"
|
scripts/rebuildPatches.sh "$basedir"
|
||||||
scripts/rebuildPatches.sh "$basedir"
|
)
|
||||||
)
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "You must edit either the api or server."
|
echo "You must edit either the api or server."
|
||||||
|
@ -83,24 +105,40 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
"setup")
|
"setup")
|
||||||
if [[ -f ~/.bashrc ]] ; then
|
if [[ -f ~/.bashrc ]] ; then
|
||||||
(grep "alias paper=" ~/.bashrc > /dev/null) && (sed -i "s|alias paper=.*|alias paper='. $SOURCE'|g" ~/.bashrc) || (echo "alias paper='. $SOURCE'" >> ~/.bashrc)
|
NAME="paper"
|
||||||
alias paper=". $SOURCE"
|
if [[ ! -z "${2+x}" ]] ; then
|
||||||
echo "You can now just type 'paper' at any time to access the paper tool."
|
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
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "rbp, rebuild | Rebuild patches, can be called from anywhere."
|
echo "PaperMC build tool command. This provides a variety of commands to build and manage the PaperMC build"
|
||||||
echo "p, patch | Apply all patches to the project without building it. Can be run from anywhere."
|
echo "environment. For all of the functionality of this command to be available, you must first run the"
|
||||||
echo "j, jar | Apply all patches and build the project, paperclip.jar will be output. Can be run from anywhere."
|
echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup."
|
||||||
echo "r, root | Change directory to the root of the project."
|
echo ""
|
||||||
echo "api | Move to the Paper-API directory."
|
echo " Normal commands:"
|
||||||
echo "serv, server | Move to the Paper-Server directory."
|
echo " * rbp, rebuild | Rebuild patches, can be called from anywhere."
|
||||||
echo "e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\""
|
echo " * p, patch | Apply all patches to the project without building it. Can be run from anywhere."
|
||||||
echo " | respectively to edit the correct project. Use the argument \"continue\" after"
|
echo " * j, jar | Apply all patches and build the project, paperclip.jar will be output. Can be run from anywhere."
|
||||||
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 " These commands require the setup command before use:"
|
||||||
echo " | . ./paper setup"
|
echo " * r, root | Change directory to the root of the project."
|
||||||
echo " | After you run this command you'll be able to just run 'paper' from anywhere."
|
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
|
esac
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=$(realpath "$1")
|
basedir=$(realpath "$1")
|
||||||
workdir="$basedir/work"
|
workdir="$basedir/work"
|
||||||
|
@ -67,4 +69,4 @@ cd "$basedir"
|
||||||
echo "Failed to apply Paper Patches"
|
echo "Failed to apply Paper Patches"
|
||||||
exit 1
|
exit 1
|
||||||
) || exit 1
|
) || exit 1
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
basedir=$(realpath "$1")
|
basedir=$(realpath "$1")
|
||||||
|
|
||||||
(git submodule update --init && ./scripts/remap.sh "$basedir" && ./scripts/decompile.sh "$basedir" && ./scripts/init.sh "$basedir" && ./scripts/applyPatches.sh "$basedir") || (
|
(git submodule update --init && ./scripts/remap.sh "$basedir" && ./scripts/decompile.sh "$basedir" && ./scripts/init.sh "$basedir" && ./scripts/applyPatches.sh "$basedir") || (
|
||||||
|
@ -7,5 +9,6 @@ basedir=$(realpath "$1")
|
||||||
exit 1
|
exit 1
|
||||||
) || exit 1
|
) || exit 1
|
||||||
if [ "$2" == "--jar" ]; then
|
if [ "$2" == "--jar" ]; then
|
||||||
(mvn clean install && ./scripts/paperclip.sh "$basedir") || exit 1
|
mvn clean install && ./scripts/paperclip.sh "$basedir"
|
||||||
fi
|
fi
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=$(realpath "$1")
|
basedir=$(realpath "$1")
|
||||||
workdir="$basedir/work"
|
workdir="$basedir/work"
|
||||||
|
@ -28,3 +30,4 @@ if [ ! -d "$decompiledir/net/minecraft/server" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
nms="net/minecraft/server"
|
nms="net/minecraft/server"
|
||||||
export MODLOG=""
|
export MODLOG=""
|
||||||
PS1="$"
|
PS1="$"
|
||||||
|
@ -59,8 +61,7 @@ import PathfinderGoalFloat
|
||||||
import PersistentVillage
|
import PersistentVillage
|
||||||
import TileEntityEnderChest
|
import TileEntityEnderChest
|
||||||
|
|
||||||
(
|
cd "$workdir/Spigot/Spigot-Server/"
|
||||||
cd "$workdir/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 -
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=$(realpath "$1")
|
basedir=$(realpath "$1")
|
||||||
workdir="$basedir/work"
|
workdir="$basedir/work"
|
||||||
|
@ -24,12 +26,15 @@ do
|
||||||
file="$(echo "$file" | cut -d. -f1).java"
|
file="$(echo "$file" | cut -d. -f1).java"
|
||||||
|
|
||||||
echo "Patching $file < $patchFile"
|
echo "Patching $file < $patchFile"
|
||||||
|
set +e
|
||||||
sed -i 's/\r//' "$nms/$file" > /dev/null
|
sed -i 's/\r//' "$nms/$file" > /dev/null
|
||||||
|
set -e
|
||||||
|
|
||||||
cp "$nms/$file" "$cb/$file"
|
cp "$nms/$file" "$cb/$file"
|
||||||
"$patch" -s -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"
|
"$patch" -s -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"
|
||||||
done
|
done
|
||||||
|
|
||||||
git add src >/dev/null 2>&1 || exit 1
|
git add src >/dev/null 2>&1
|
||||||
git commit -m "CraftBukkit $ $(date)" >/dev/null 2>&1 || exit 1
|
git commit -m "CraftBukkit $ $(date)" >/dev/null 2>&1
|
||||||
git checkout -f HEAD^ >/dev/null 2>&1 || exit 1
|
git checkout -f HEAD^ >/dev/null 2>&1
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
|
|
||||||
basedir=$(realpath "$1")
|
basedir=$(realpath "$1")
|
||||||
|
@ -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";
|
||||||
|
)
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
basedir=$(realpath "$1")
|
basedir=$(realpath "$1")
|
||||||
workdir="$basedir/work"
|
workdir="$basedir/work"
|
||||||
mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
||||||
|
@ -7,7 +10,7 @@ vanillajar="../$mcver/$mcver.jar"
|
||||||
|
|
||||||
(
|
(
|
||||||
cd "$workdir/Paperclip"
|
cd "$workdir/Paperclip"
|
||||||
mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$paperjar" "-Dvanillajar=$vanillajar" || exit 1
|
mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$paperjar" "-Dvanillajar=$vanillajar"
|
||||||
)
|
)
|
||||||
cp "$workdir/Paperclip/target/paperclip-${mcver}.jar" "$basedir/paperclip.jar"
|
cp "$workdir/Paperclip/target/paperclip-${mcver}.jar" "$basedir/paperclip.jar"
|
||||||
|
|
||||||
|
@ -16,3 +19,4 @@ echo ""
|
||||||
echo ""
|
echo ""
|
||||||
echo "Build success!"
|
echo "Build success!"
|
||||||
echo "Copied final jar to "$(realpath "$basedir/paperclip.jar")
|
echo "Copied final jar to "$(realpath "$basedir/paperclip.jar")
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=$(realpath "$1")
|
basedir=$(realpath "$1")
|
||||||
workdir="$basedir/work"
|
workdir="$basedir/work"
|
||||||
|
@ -15,7 +17,9 @@ function cleanupPatches {
|
||||||
|
|
||||||
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
|
||||||
|
@ -45,3 +49,4 @@ function savePatches {
|
||||||
|
|
||||||
savePatches "$workdir/Spigot/Spigot-API" "Paper-API"
|
savePatches "$workdir/Spigot/Spigot-API" "Paper-API"
|
||||||
savePatches "$workdir/Spigot/Spigot-Server" "Paper-Server"
|
savePatches "$workdir/Spigot/Spigot-Server" "Paper-Server"
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=$(realpath "$1")
|
basedir=$(realpath "$1")
|
||||||
workdir="$basedir/work"
|
workdir="$basedir/work"
|
||||||
|
@ -68,3 +70,4 @@ if [ "$?" != "0" ]; then
|
||||||
echo "Failed to install remapped jar."
|
echo "Failed to install remapped jar."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
(
|
||||||
|
set -e
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir=$(realpath "$1")
|
basedir=$(realpath "$1")
|
||||||
workdir="$basedir/work"
|
workdir="$basedir/work"
|
||||||
|
@ -14,3 +16,4 @@ function update {
|
||||||
update Bukkit
|
update Bukkit
|
||||||
update CraftBukkit
|
update CraftBukkit
|
||||||
update Spigot
|
update Spigot
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue