From d56975633f84fe9866599eefd85e0061047867ad Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Mon, 8 Apr 2024 12:30:37 +0400 Subject: [PATCH] Keep cloned repos to keep build cache and save time --- build.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index 4475842..3dba315 100755 --- a/build.sh +++ b/build.sh @@ -25,6 +25,19 @@ cd_and_exec () { cd "$old" || exit 3 } +update_repo () { + if [ -e "$1" ] + then + echo "$1 exists, updating" + cd "$1" || return 3 + git stash && git stash drop + git pull + else + echo "$1 not found, cloning" + clone "$2" "$1" + fi +} + try_exec () { "$@" return 0 @@ -50,9 +63,9 @@ dep java dep cargo dep 7z -title 'Cloning repositories...' -[ -e backend ] || clone https://github.com/TeamPiped/Piped-Backend backend -[ -e reqwest4j ] || clone https://github.com/TeamPiped/reqwest4j reqwest4j +title 'Updating repositories...' +update_repo backend https://github.com/TeamPiped/Piped-Backend +update_repo reqwest4j https://github.com/TeamPiped/reqwest4j title 'Applying patches...' source patcher.sh @@ -143,9 +156,6 @@ cd_and_exec backend/build/libs \ title 'Copying config and version...' cd_and_exec backend cp config.properties VERSION "$WORKDIR" -title 'Cleaning up...' -rm -rf backend reqwest4j - # --- echo