From: j-h.choi Date: Wed, 14 Dec 2022 02:50:08 +0000 (+0900) Subject: Add restore option in dotnet-wrapper X-Git-Tag: accepted/tizen/unified/20221216.024044~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b1a293311b175fff2c4893d8531040bd3093626;p=platform%2Fcore%2Fdotnet%2Fbuild-tools.git Add restore option in dotnet-wrapper Change-Id: I93df540435a4eadbee65d777d618ed30d7a27bf0 --- diff --git a/tools/dotnet-wrapper.sh b/tools/dotnet-wrapper.sh index 34aeab64..d632fadd 100755 --- a/tools/dotnet-wrapper.sh +++ b/tools/dotnet-wrapper.sh @@ -23,7 +23,22 @@ fi # This is a workaround for the relative path issue in dotnet-cli. # https://github.com/NuGet/Home/issues/9406 CMD=$1; shift -ARGS=("$@") +if [ "$CMD" == "restore" ]; then + while [[ $# -gt 0 ]]; do + x="$1" + if [ "$x" == "-s" -o "$x" == "--source" ]; then + ARGS+=($x $(readlink -m $2)) + shift + elif [[ "$x" =~ --source=(.+) ]]; then + ARGS+=(--source=$(readlink -m $(eval echo ${BASH_REMATCH[1]}))) + else + ARGS+=("$x") + fi + shift + done +else + ARGS=("$@") +fi if [ "$CMD" == "msbuild" -o "$CMD" == "build" -o "$CMD" == "restore" ] ; then @@ -31,7 +46,7 @@ if [ "$CMD" == "msbuild" -o "$CMD" == "build" -o "$CMD" == "restore" ] ; then # Clear nuget cache for each project build. if [ ! -f ".nuget_cache_cleared" ]; then - $DOTNET_CLI_PATH nuget locals all --clear + rm -rf $HOME/.nuget/packages/* touch .nuget_cache_cleared 2>/dev/null || true fi fi