diff --git a/scripts/build/build.ps1 b/scripts/build/build.ps1 index 9247f0fe0..e579f586c 100644 --- a/scripts/build/build.ps1 +++ b/scripts/build/build.ps1 @@ -5,7 +5,8 @@ param( [string]$Configuration="Debug", - [switch]$Offline) + [switch]$Offline, + [switch]$NoCache) $ErrorActionPreference="Stop" @@ -25,8 +26,8 @@ if ($Offline){ } else { _ "$RepoRoot\scripts\obtain\install-tools.ps1" - - _ "$RepoRoot\scripts\build\restore-packages.ps1" + + _ "$RepoRoot\scripts\build\restore-packages.ps1" @("$NoCache") } header "Compiling" diff --git a/scripts/build/process-args.sh b/scripts/build/process-args.sh index 24e7edc25..3be6d2d7a 100755 --- a/scripts/build/process-args.sh +++ b/scripts/build/process-args.sh @@ -20,6 +20,9 @@ do nopackage) export NOPACKAGE=true ;; + nocache) + export NOCACHE=--No-Cache + ;; *) esac done \ No newline at end of file diff --git a/scripts/build/restore-packages.ps1 b/scripts/build/restore-packages.ps1 index 92dda0d07..f2f7fba60 100644 --- a/scripts/build/restore-packages.ps1 +++ b/scripts/build/restore-packages.ps1 @@ -3,16 +3,27 @@ # Licensed under the MIT license. See LICENSE file in the project root for full license information. # +param( + [string]$NoCache="") + . $PSScriptRoot\..\common\_common.ps1 +if ($NoCache -eq "True") { + $NoCacheArg = "--no-cache" + info "Bypassing NuGet Cache" +} +else { + $NoCacheArg = "" +} + # Restore packages header "Restoring packages" -& "$DnxRoot\dnu" restore "$RepoRoot\src" --quiet --runtime "$Rid" --no-cache --parallel -& "$DnxRoot\dnu" restore "$RepoRoot\test" --quiet --runtime "$Rid" --no-cache --parallel -& "$DnxRoot\dnu" restore "$RepoRoot\tools" --quiet --runtime "$Rid" --no-cache --parallel +& "$DnxRoot\dnu" restore "$RepoRoot\src" --runtime "$Rid" "$NoCacheArg" --parallel +& "$DnxRoot\dnu" restore "$RepoRoot\test" --quiet --runtime "$Rid" "$NoCacheArg" --parallel +& "$DnxRoot\dnu" restore "$RepoRoot\tools" --quiet --runtime "$Rid" "$NoCacheArg" --parallel $oldErrorAction=$ErrorActionPreference $ErrorActionPreference="SilentlyContinue" -& "$DnxRoot\dnu" restore "$RepoRoot\testapp" --quiet --runtime "$Rid" --no-cache --parallel 2>&1 | Out-Null +& "$DnxRoot\dnu" restore "$RepoRoot\testapp" --quiet --runtime "$Rid" "$NoCacheArg" --parallel 2>&1 | Out-Null $ErrorActionPreference=$oldErrorAction diff --git a/scripts/build/restore-packages.sh b/scripts/build/restore-packages.sh index fc2356932..1a1125f30 100755 --- a/scripts/build/restore-packages.sh +++ b/scripts/build/restore-packages.sh @@ -17,9 +17,9 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" source "$DIR/../common/_common.sh" header "Restoring packages" -$DNX_ROOT/dnu restore "$REPOROOT/src" --quiet --runtime "$RID" --no-cache --parallel -$DNX_ROOT/dnu restore "$REPOROOT/test" --quiet --runtime "$RID" --no-cache --parallel -$DNX_ROOT/dnu restore "$REPOROOT/tools" --quiet --runtime "$RID" --no-cache --parallel +$DNX_ROOT/dnu restore "$REPOROOT/src" --quiet --runtime "$RID" "$NOCACHE" --parallel +$DNX_ROOT/dnu restore "$REPOROOT/test" --quiet --runtime "$RID" "$NOCACHE" --parallel +$DNX_ROOT/dnu restore "$REPOROOT/tools" --quiet --runtime "$RID" "$NOCACHE" --parallel set +e -$DNX_ROOT/dnu restore "$REPOROOT/testapp" --quiet --runtime "$RID" --no-cache --parallel >/dev/null 2>&1 +$DNX_ROOT/dnu restore "$REPOROOT/testapp" --quiet --runtime "$RID" "$NOCACHE" --parallel >/dev/null 2>&1 set -e diff --git a/scripts/ci_build.cmd b/scripts/ci_build.cmd index 029e1f655..bf7c82d2d 100644 --- a/scripts/ci_build.cmd +++ b/scripts/ci_build.cmd @@ -3,6 +3,6 @@ REM Copyright (c) .NET Foundation and contributors. All rights reserved. REM Licensed under the MIT license. See LICENSE file in the project root for full license information. -CALL %~dp0..\build.cmd %* +CALL %~dp0..\build.cmd -NoCache %* exit /b %errorlevel% diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh index d0e3a01ef..d8a249c09 100755 --- a/scripts/ci_build.sh +++ b/scripts/ci_build.sh @@ -41,6 +41,7 @@ if [[ "$OSNAME" == "ubuntu" ]]; then export DOTNET_BUILD_CONTAINER_NAME="$container_name" export PACKAGE_IN_DOCKER="true" + export NOCACHE="--no-cache" unset BUILD_IN_DOCKER $SCRIPT_DIR/../build.sh $@ diff --git a/scripts/common/_common.sh b/scripts/common/_common.sh index edc0c52cb..1db69b4aa 100644 --- a/scripts/common/_common.sh +++ b/scripts/common/_common.sh @@ -28,7 +28,8 @@ export HOST_DIR=$OUTPUT_ROOT/corehost [ -z "$DOTNET_INSTALL_DIR" ] && export DOTNET_INSTALL_DIR=$REPOROOT/.dotnet_stage0/$RID [ -z "$DOTNET_BUILD_VERSION" ] && export DOTNET_BUILD_VERSION=0.1.0.0 [ -z "$DOTNET_HOME" ] && export DOTNET_HOME=$STAGE2_DIR && export PATH=$STAGE2_DIR/bin:$PATH -[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug +[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug +[ -z "$NOCACHE" ] && export $NOCACHE="" unset COMMONSOURCE unset COMMONDIR diff --git a/scripts/compile/compile.ps1 b/scripts/compile/compile.ps1 index 30a96ce5c..3adb21563 100644 --- a/scripts/compile/compile.ps1 +++ b/scripts/compile/compile.ps1 @@ -3,8 +3,7 @@ # Licensed under the MIT license. See LICENSE file in the project root for full license information. # -param([string]$Configuration = "Debug", - [switch]$Offline) +param([string]$Configuration = "Debug") $ErrorActionPreference="Stop"