From e538e8911633170bac6053c26c91bca6f00e1b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Sat, 11 Apr 2020 12:37:04 +0800 Subject: [PATCH] partially fix scripts --- akarin | 8 ++++---- current-paper | 2 +- scripts/functions.sh | 14 ++++---------- scripts/generateImports.sh | 6 +++--- scripts/importmcdev.sh | 2 +- scripts/upstream.sh | 12 ++++++------ 6 files changed, 19 insertions(+), 25 deletions(-) diff --git a/akarin b/akarin index dd9e57b5b..83a37bbf0 100755 --- a/akarin +++ b/akarin @@ -3,6 +3,7 @@ # exit immediately if a command exits with a non-zero status set -e +basedir=$(cd "$(dirname "$0")" && pwd -P) source "./scripts/functions.sh" failed=0 @@ -35,10 +36,9 @@ case "$1" in ;; "jar" | "paperclip") ( - basedir cd "$basedir" if [ "$2" != "fast" ]; then - scripts/upstream.sh + scripts/upstream.sh "$basedir" fi ./scripts/apply.sh "$basedir" cd "$basedir" @@ -51,7 +51,7 @@ case "$1" in ;; "d" | "de" | "deploy") ( - basedir + cd "$basedir" mvn -N install cd ${FORK_NAME}-API mvn clean deploy && cd ../${FORK_NAME}-Server && mvn clean install @@ -175,4 +175,4 @@ if [[ "$failed" == "1" ]]; then else unset failed true -fi \ No newline at end of file +fi diff --git a/current-paper b/current-paper index 0e094ac24..6ad363af9 100644 --- a/current-paper +++ b/current-paper @@ -1 +1 @@ -1.15.2--23ee0a8a889f352889907369b58c361a1b19f7ac +1.15.2--- diff --git a/scripts/functions.sh b/scripts/functions.sh index 10e2c6169..cd689eb7c 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -14,25 +14,15 @@ gitcmd="git -c commit.gpgsign=false" case "$(echo "$SHELL" | sed -E 's|/usr(/local)?||g')" in "/bin/zsh") RCPATH="$HOME/.zshrc" - SOURCE="${BASH_SOURCE[0]:-${(%):-%N}}" ;; *) RCPATH="$HOME/.bashrc" if [[ -f "$HOME/.bash_aliases" ]]; then RCPATH="$HOME/.bash_aliases" fi - SOURCE="${BASH_SOURCE[0]}" ;; esac -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done -SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}") -basedir=$(dirname "$SOURCE") - function basedir { cd "$basedir" } @@ -41,6 +31,10 @@ function paperdir { cd "$basedir/Paper" } +gitcmd() { + $gitcmd "$@" +} + # COLOUR functions color() { if [ $2 ]; then diff --git a/scripts/generateImports.sh b/scripts/generateImports.sh index b3d96ab3e..3014fd025 100755 --- a/scripts/generateImports.sh +++ b/scripts/generateImports.sh @@ -18,7 +18,7 @@ cd mc-dev # prepare to push if [ ! -d ".git" ]; then - gitcmd init + $gitcmd init fi # reset dev files to spigot @@ -39,6 +39,6 @@ done # push the dev project cd $basedir/mc-dev gitcmd add . -A -gitcmd commit . -m "$paperVer" +gitcmd commit --allow-empty . -m "$paperVer" gitcmd tag -a "$paperVer" -m "$paperVer" 2>/dev/null -push . $MCDEV_REPO $paperVer +gitpush . $MCDEV_REPO $paperVer diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 9fd9be224..05ef554b5 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -102,6 +102,6 @@ importLibrary com.mojang datafixerupper com/mojang/datafixers/util Either.java cd Paper/Paper-Server/ rm -rf nms-patches git add src -A - echo -e "Akarin extra mc-dev Imports\n\n$MODLOG" | git commit src -F - + echo -e "Akarin extra mc-dev Imports\n\n$MODLOG" | git commit --allow-empty src -F - exit 0 ) diff --git a/scripts/upstream.sh b/scripts/upstream.sh index 96b319143..efde09d5c 100755 --- a/scripts/upstream.sh +++ b/scripts/upstream.sh @@ -37,8 +37,8 @@ echo "$tag" > "$basedir"/current-paper paperdir function tag { - cd $2 - if [ "$3" == "1" ]; then + cd $1 + if [ "$2" == "1" ]; then git tag -d "$tag" 2>/dev/null fi echo -e "$(date)\n\n$version" | git tag -a "$tag" -F - 2>/dev/null @@ -52,8 +52,8 @@ if [ "$(cat "$basedir"/current-paper)" != "$tag" ]; then forcetag=1 fi -tag Paper-API $forcetag -tag Paper-Server $forcetag +tag "$basedir"/Paper/Paper-API $forcetag +tag "$basedir"/Paper/Paper-Server $forcetag -push Paper-API $PAPER_API_REPO $tag -push Paper-Server $PAPER_SERVER_REPO $tag \ No newline at end of file +gitpush "$basedir"/Paper/Paper-API $PAPER_API_REPO $tag +gitpush "$basedir"/Paper/Paper-Server $PAPER_SERVER_REPO $tag