diff options
author | Andy Ayers <andya@microsoft.com> | 2016-04-15 14:03:46 -0700 |
---|---|---|
committer | Andy Ayers <andya@microsoft.com> | 2016-04-15 17:58:57 -0700 |
commit | c5be17651cdbe0c60833b2953bae828acb1a0e60 (patch) | |
tree | 129d504d378a961a6aaf781cea91ddf0b3279e47 /init-tools.cmd | |
parent | 02d18c9eceeb3c4e80c5c59dbc8103294adc86af (diff) | |
download | coreclr-c5be17651cdbe0c60833b2953bae828acb1a0e60.tar.gz coreclr-c5be17651cdbe0c60833b2953bae828acb1a0e60.tar.bz2 coreclr-c5be17651cdbe0c60833b2953bae828acb1a0e60.zip |
Detect if powershell version is suitable for restoring build tools
Powershell v3 or higher is required to decompress the build tools
bundle. Windows 7 typically has v2 installed.
Detect earlier versions and fail with a pointer to the
build prerequisites and a download link for an updated version.
Also propagate failures out of init-tools.cmd. The last step
of this is unchecked since the build tool init script can return
nonzero status even on success.
See #3510.
Diffstat (limited to 'init-tools.cmd')
-rw-r--r-- | init-tools.cmd | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/init-tools.cmd b/init-tools.cmd index 387ede7a1d..f95f56e57e 100644 --- a/init-tools.cmd +++ b/init-tools.cmd @@ -13,6 +13,7 @@ set PROJECT_JSON_PATH=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION% set PROJECT_JSON_FILE=%PROJECT_JSON_PATH%\project.json set PROJECT_JSON_CONTENTS={ "dependencies": { "Microsoft.DotNet.BuildTools": "%BUILDTOOLS_VERSION%" , "Microsoft.DotNet.BuildTools.Coreclr": "1.0.4-prerelease"}, "frameworks": { "dnxcore50": { } } } set BUILD_TOOLS_SEMAPHORE=%PROJECT_JSON_PATH%\init-tools.completed +set TOOLS_INIT_RETURN_CODE=0 :: if force option is specified then clean the tool runtime and build tools package directory to force it to get recreated if [%1]==[force] ( @@ -23,7 +24,7 @@ if [%1]==[force] ( :: If sempahore exists do nothing if exist "%BUILD_TOOLS_SEMAPHORE%" ( echo Tools are already initialized. - goto :EOF + goto :DONE ) if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%" @@ -50,7 +51,8 @@ echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> %INIT_TOOLS_L powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors; if ($AddTypeErrors.Count -eq 0) { [System.IO.Compression.ZipFile]::ExtractToDirectory('%DOTNET_LOCAL_PATH%', '%DOTNET_PATH%') } else { (New-Object -com shell.application).namespace('%DOTNET_PATH%').CopyHere((new-object -com shell.application).namespace('%DOTNET_LOCAL_PATH%').Items(),16) }" >> %INIT_TOOLS_LOG% if NOT exist "%DOTNET_LOCAL_PATH%" ( echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG%' for more details. - goto :EOF + set TOOLS_INIT_RETURN_CODE=1 + goto :DONE ) :afterdotnetrestore @@ -61,7 +63,8 @@ echo Running: "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_ call "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> %INIT_TOOLS_LOG% if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" ( echo ERROR: Could not restore build tools correctly. See '%INIT_TOOLS_LOG%' for more details. - goto :EOF + set TOOLS_INIT_RETURN_CODE=1 + goto :DONE ) :afterbuildtoolsrestore @@ -72,4 +75,8 @@ call "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR :: Create sempahore file echo Done initializing tools. -echo Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > "%BUILD_TOOLS_SEMAPHORE%"
\ No newline at end of file +echo Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > "%BUILD_TOOLS_SEMAPHORE%" + +:DONE + +exit /b %TOOLS_INIT_RETURN_CODE% |