Use set -e to handle errors better in the build scripts

This commit is contained in:
DemonWav 2016-04-03 02:23:19 -05:00
parent 7effde04b1
commit 0394633734
11 changed files with 118 additions and 48 deletions

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
(
set -e
PS1="$"
basedir=$(realpath "$1")
workdir="$basedir/work"
@ -67,4 +69,4 @@ cd "$basedir"
echo "Failed to apply Paper Patches"
exit 1
) || exit 1
)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
(
set -e
basedir=$(realpath "$1")
(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
if [ "$2" == "--jar" ]; then
(mvn clean install && ./scripts/paperclip.sh "$basedir") || exit 1
mvn clean install && ./scripts/paperclip.sh "$basedir"
fi
)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
(
set -e
PS1="$"
basedir=$(realpath "$1")
workdir="$basedir/work"
@ -28,3 +30,4 @@ if [ ! -d "$decompiledir/net/minecraft/server" ]; then
exit 1
fi
fi
)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
(
set -e
nms="net/minecraft/server"
export MODLOG=""
PS1="$"
@ -59,8 +61,7 @@ import PathfinderGoalFloat
import PersistentVillage
import TileEntityEnderChest
(
cd "$workdir/Spigot/Spigot-Server/"
git add src -A
echo -e "mc-dev Imports\n\n$MODLOG" | git commit src -F -
cd "$workdir/Spigot/Spigot-Server/"
git add src -A
echo -e "mc-dev Imports\n\n$MODLOG" | git commit src -F -
)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
(
set -e
PS1="$"
basedir=$(realpath "$1")
workdir="$basedir/work"
@ -24,12 +26,15 @@ do
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 || exit 1
git commit -m "CraftBukkit $ $(date)" >/dev/null 2>&1 || exit 1
git checkout -f HEAD^ >/dev/null 2>&1 || exit 1
git add src >/dev/null 2>&1
git commit -m "CraftBukkit $ $(date)" >/dev/null 2>&1
git checkout -f HEAD^ >/dev/null 2>&1
)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
(
set -e
PS1="$"
basedir=$(realpath "$1")
@ -23,3 +25,4 @@ do
fi
done
echo "Built $decompiledir/src to be included in your project for src access";
)

View file

@ -1,4 +1,7 @@
#!/usr/bin/env bash
(
set -e
basedir=$(realpath "$1")
workdir="$basedir/work"
mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
@ -7,7 +10,7 @@ vanillajar="../$mcver/$mcver.jar"
(
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"
@ -16,3 +19,4 @@ echo ""
echo ""
echo "Build success!"
echo "Copied final jar to "$(realpath "$basedir/paperclip.jar")
)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
(
set -e
PS1="$"
basedir=$(realpath "$1")
workdir="$basedir/work"
@ -15,7 +17,9 @@ function cleanupPatches {
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
if [ "x$testver" != "x" ]; then
set +e
diffs=$(echo "$diffs" | sed 'N;$!P;$!D;$d')
set -e
fi
if [ "x$diffs" == "x" ] ; then
@ -45,3 +49,4 @@ function savePatches {
savePatches "$workdir/Spigot/Spigot-API" "Paper-API"
savePatches "$workdir/Spigot/Spigot-Server" "Paper-Server"
)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
(
set -e
PS1="$"
basedir=$(realpath "$1")
workdir="$basedir/work"
@ -68,3 +70,4 @@ if [ "$?" != "0" ]; then
echo "Failed to install remapped jar."
exit 1
fi
)

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash
(
set -e
PS1="$"
basedir=$(realpath "$1")
workdir="$basedir/work"
@ -14,3 +16,4 @@ function update {
update Bukkit
update CraftBukkit
update Spigot
)