diff options
author | DemonWav <[email protected]> | 2016-04-03 02:23:19 -0500 |
---|---|---|
committer | DemonWav <[email protected]> | 2016-04-03 03:43:30 -0500 |
commit | 0394633734e7ec8bffe9cf7d042105c016a19e1b (patch) | |
tree | 5aae5ce22c9ad93d1034d862ba9da42ed5943cf7 /paper | |
parent | 7effde04b101e875c050904b4852816d3c44f10a (diff) | |
download | Paper-0394633734e7ec8bffe9cf7d042105c016a19e1b.tar.gz Paper-0394633734e7ec8bffe9cf7d042105c016a19e1b.zip |
Use `set -e` to handle errors better in the build scripts
Diffstat (limited to 'paper')
-rwxr-xr-x | paper | 114 |
1 files changed, 76 insertions, 38 deletions
@@ -22,59 +22,81 @@ paperunstash() { case "$1" in "rbp" | "rebuild") - ( + ( + set -e cd "$basedir" scripts/rebuildPatches.sh "$basedir" - ) + ) ;; - "a" | "apply") - ( + "p" | "patch") + ( + set -e cd "$basedir" scripts/build.sh "$basedir" - ) + ) ;; "j" | "jar") - ( - cd "$basedir" + ( + 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" ;; - "api") + "a" | "api") cd "$basedir/Paper-API" ;; - "serv" | "server") + "s" | "server") cd "$basedir" ;; "e" | "edit") case "$2" in - "server") - cd "$basedir/Paper-Server" - export LAST_EDIT=$(pwd) + "s" | "server") + export LAST_EDIT="$basedir/Paper-Server" + cd "$basedir/Paper-Server" + ( + set -e paperstash git rebase -i upstream/upstream paperunstash + ) ;; - "api") - cd "$basedir/Paper-API" - export LAST_EDIT=$(pwd) + "a" | "api") + export LAST_EDIT="$basedir/Paper-API" + cd "$basedir/Paper-API" + ( + set -e paperstash git rebase -i upstream/upstream paperunstash + ) ;; - "continue") - cd "$LAST_EDIT" + "c" | "continue") + cd "$LAST_EDIT" + unset LAST_EDIT + ( + set -e + git add . + git commit --amend git rebase --continue - unset LAST_EDIT - ( - cd "$basedir" - scripts/rebuildPatches.sh "$basedir" - ) + + cd "$basedir" + scripts/rebuildPatches.sh "$basedir" + ) ;; *) echo "You must edit either the api or server." @@ -83,24 +105,40 @@ case "$1" in ;; "setup") 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) - alias paper=". $SOURCE" - echo "You can now just type 'paper' at any time to access the paper tool." + 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 "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 "r, root | Change directory to the root of the project." - echo "api | Move to the Paper-API directory." - echo "serv, 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 "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 "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 |