From ac15a78f8e00efbee48fdcf4226faac436244a84 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 5 Feb 2020 13:09:46 -0800 Subject: [PATCH] Let's try this --- build.ps1 | 5 +++++ build.sh | 2 ++ eng/common/tools.ps1 | 3 ++- eng/common/tools.sh | 13 +++++++------ global.json | 4 ++-- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/build.ps1 b/build.ps1 index c515a84af5..6ffa1ad971 100644 --- a/build.ps1 +++ b/build.ps1 @@ -362,6 +362,11 @@ try { $toolsetBuildProj = InitializeToolset + $sdkPath = [IO.Path]::Combine($env:DOTNET_INSTALL_DIR, 'sdk', '3.1.102') + if (!(Test-Path $sdkPath)) { + InstallDotNetSdk $dotnetRoot '3.1.102-servicing-014873' -skipNonVersionedFiles $true + } + $restore = $tmpRestore if ($ci) { diff --git a/build.sh b/build.sh index 05e1628368..de95cda110 100755 --- a/build.sh +++ b/build.sh @@ -316,6 +316,8 @@ restore=true InitializeToolset +InstallDotNetSdk "$DOTNET_INSTALL_DIR" "3.1.102-servicing-014873" + restore=$_tmp_restore= if [ "$build_repo_tasks" = true ]; then diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 2c1fe1446f..617db167ce 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -139,6 +139,7 @@ function InitializeDotNetCli([bool]$install) { InstallDotNetSdk $dotnetRoot $dotnetSdkVersion } else { Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Unable to find dotnet with SDK version '$dotnetSdkVersion'" + ExitWithExitCode 1 } } @@ -183,7 +184,7 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $arc InstallDotNet $dotnetRoot $version $architecture } -function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $architecture = "", [string] $runtime = "", [bool] $skipNonVersionedFiles = $true) { +function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $architecture = "", [string] $runtime = "", [bool] $skipNonVersionedFiles = $false) { $installScript = GetDotNetInstallScript $dotnetRoot $installParameters = @{ Version = $version diff --git a/eng/common/tools.sh b/eng/common/tools.sh index bf5a88d0c3..757d5b9ea4 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -41,7 +41,7 @@ fi # Configures warning treatment in msbuild. warn_as_error=${warn_as_error:-true} -# True to attempt using .NET Core already that meets requirements specified in global.json +# True to attempt using .NET Core already that meets requirements specified in global.json # installed on the machine instead of downloading one. use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} @@ -143,6 +143,7 @@ function InitializeDotNetCli { InstallDotNetSdk "$dotnet_root" "$dotnet_sdk_version" else Write-PipelineTelemetryError -category 'InitializeToolset' "Unable to find dotnet with SDK version '$dotnet_sdk_version'" + ExitWithExitCode 1 fi fi fi @@ -180,7 +181,7 @@ function InstallDotNetSdk { function InstallDotNet { local root=$1 local version=$2 - + GetDotNetInstallScript "$root" local install_script=$_GetDotNetInstallScript @@ -221,7 +222,7 @@ function GetDotNetInstallScript { Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." ExitWithExitCode $exit_code } - else + else wget -q -O "$install_script" "$install_script_url" || { local exit_code=$? Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." @@ -237,11 +238,11 @@ function InitializeBuildTool { if [[ -n "${_InitializeBuildTool:-}" ]]; then return fi - + InitializeDotNetCli $restore # return values - _InitializeBuildTool="$_InitializeDotNetCli/dotnet" + _InitializeBuildTool="$_InitializeDotNetCli/dotnet" _InitializeBuildToolCommand="msbuild" _InitializeBuildToolFramework="netcoreapp2.1" } @@ -302,7 +303,7 @@ function InitializeToolset { if [[ "$binary_log" == true ]]; then bl="/bl:$log_dir/ToolsetRestore.binlog" fi - + echo '' > "$proj" MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file" diff --git a/global.json b/global.json index 324a0158be..073bbbd70c 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "3.1.102-servicing-014873" + "version": "3.1.101" }, "tools": { - "dotnet": "3.1.102-servicing-014873", + "dotnet": "3.1.101", "runtimes": { "dotnet/x64": [ "$(MicrosoftNETCoreAppInternalPackageVersion)"