summaryrefslogtreecommitdiff
path: root/init-tools.cmd
diff options
context:
space:
mode:
authorwtgodbe <wigodbe@microsoft.com>2017-05-02 16:33:41 -0700
committerwtgodbe <wigodbe@microsoft.com>2017-05-16 16:37:21 -0700
commit798387ee90d7536d5a620af8482100ba76f6061a (patch)
treec11eea885b05e7424f103cd671d227ff173a3083 /init-tools.cmd
parent36e988ee6593351f1e962118a99154df5eae0254 (diff)
downloadcoreclr-798387ee90d7536d5a620af8482100ba76f6061a.tar.gz
coreclr-798387ee90d7536d5a620af8482100ba76f6061a.tar.bz2
coreclr-798387ee90d7536d5a620af8482100ba76f6061a.zip
Update Coreclr to 2.0.0 buildtools
Diffstat (limited to 'init-tools.cmd')
-rw-r--r--init-tools.cmd57
1 files changed, 21 insertions, 36 deletions
diff --git a/init-tools.cmd b/init-tools.cmd
index 8efc2f400d..b69239bfe6 100644
--- a/init-tools.cmd
+++ b/init-tools.cmd
@@ -2,20 +2,15 @@
setlocal
set INIT_TOOLS_LOG=%~dp0init-tools.log
-set PACKAGES_DIR=%~dp0packages\
-set TOOLRUNTIME_DIR=%~dp0Tools
-:: This is an isolated script that handles the download of dotnet binaries and shall be removed after bootstrap.ps1/sh refactor (dotnet/corefx#15427)
-set DOTNET_DOWNLOAD_PATH=%~dp0dotnet-download.ps1
+if [%PACKAGES_DIR%]==[] set PACKAGES_DIR=%~dp0packages\
+if [%TOOLRUNTIME_DIR%]==[] set TOOLRUNTIME_DIR=%~dp0Tools
set DOTNET_PATH=%TOOLRUNTIME_DIR%\dotnetcli\
-set DOTNET_CMD=%DOTNET_PATH%dotnet.exe
+if [%DOTNET_CMD%]==[] set DOTNET_CMD=%DOTNET_PATH%dotnet.exe
if [%BUILDTOOLS_SOURCE%]==[] set BUILDTOOLS_SOURCE=https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json
set /P BUILDTOOLS_VERSION=< "%~dp0BuildToolsVersion.txt"
set BUILD_TOOLS_PATH=%PACKAGES_DIR%Microsoft.DotNet.BuildTools\%BUILDTOOLS_VERSION%\lib\
-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.completed0
-set TOOLS_INIT_RETURN_CODE=0
+set INIT_TOOLS_RESTORE_PROJECT=%~dp0init-tools.msbuild
+set BUILD_TOOLS_SEMAPHORE=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION%\init-tools.completed
:: if force option is specified then clean the tool runtime and build tools package directory to force it to get recreated
if [%1]==[force] (
@@ -26,7 +21,7 @@ if [%1]==[force] (
:: If sempahore exists do nothing
if exist "%BUILD_TOOLS_SEMAPHORE%" (
echo Tools are already initialized.
- goto :DONE
+ goto :EOF
)
if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%"
@@ -37,8 +32,6 @@ if NOT exist "%PACKAGES_DIR%NuGet.exe" (
powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadFile('https://www.nuget.org/nuget.exe', '%PACKAGES_DIR%NuGet.exe')
)
-if NOT exist "%PROJECT_JSON_PATH%" mkdir "%PROJECT_JSON_PATH%"
-echo %PROJECT_JSON_CONTENTS% > "%PROJECT_JSON_FILE%"
echo Running %0 > "%INIT_TOOLS_LOG%"
set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.txt"
@@ -46,47 +39,39 @@ if exist "%DOTNET_CMD%" goto :afterdotnetrestore
echo Installing dotnet cli...
if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%"
-if [%PROCESSOR_ARCHITECTURE%]==[x86] (set DOTNET_ZIP_NAME=dotnet-dev-win-x86.%DOTNET_VERSION%.zip) else (set DOTNET_ZIP_NAME=dotnet-dev-win-x64.%DOTNET_VERSION%.zip)
-set DOTNET_REMOTE_PATH=https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/%DOTNET_VERSION%/%DOTNET_ZIP_NAME%
+set DOTNET_ZIP_NAME=dotnet-dev-win-x64.%DOTNET_VERSION%.zip
+set DOTNET_REMOTE_PATH=https://dotnetcli.blob.core.windows.net/dotnet/Sdk/%DOTNET_VERSION%/%DOTNET_ZIP_NAME%
set DOTNET_LOCAL_PATH=%DOTNET_PATH%%DOTNET_ZIP_NAME%
echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> "%INIT_TOOLS_LOG%"
-powershell -NoProfile -ExecutionPolicy unrestricted -File %DOTNET_DOWNLOAD_PATH% -DotnetRemotePath %DOTNET_REMOTE_PATH% -DotnetLocalPath %DOTNET_LOCAL_PATH% -DotnetPath %DOTNET_PATH% >> "%INIT_TOOLS_LOG%"
+powershell -NoProfile -ExecutionPolicy unrestricted -Command "$retryCount = 0; $success = $false; do { try { (New-Object Net.WebClient).DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); $success = $true; } catch { if ($retryCount -ge 6) { throw; } else { $retryCount++; Start-Sleep -Seconds (5 * $retryCount); } } } while ($success -eq $false); 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.
- set TOOLS_INIT_RETURN_CODE=1
- goto :DONE
+ echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG%' for more details. 1>&2
+ exit /b 1
)
:afterdotnetrestore
if exist "%BUILD_TOOLS_PATH%" goto :afterbuildtoolsrestore
echo Restoring BuildTools version %BUILDTOOLS_VERSION%...
-echo Running: "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages "%PACKAGES_DIR% " --source "%BUILDTOOLS_SOURCE%" >> "%INIT_TOOLS_LOG%"
-call "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages "%PACKAGES_DIR% " --source "%BUILDTOOLS_SOURCE%" >> "%INIT_TOOLS_LOG%"
+echo Running: "%DOTNET_CMD%" restore "%INIT_TOOLS_RESTORE_PROJECT%" --no-cache --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" /p:BuildToolsPackageVersion=%BUILDTOOLS_VERSION% >> "%INIT_TOOLS_LOG%"
+call "%DOTNET_CMD%" restore "%INIT_TOOLS_RESTORE_PROJECT%" --no-cache --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" /p:BuildToolsPackageVersion=%BUILDTOOLS_VERSION% >> "%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.
- set TOOLS_INIT_RETURN_CODE=1
- goto :DONE
+ echo ERROR: Could not restore build tools correctly. See '%INIT_TOOLS_LOG%' for more details. 1>&2
+ exit /b 1
)
:afterbuildtoolsrestore
-echo Initializing BuildTools ...
+echo Initializing BuildTools...
echo Running: "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> "%INIT_TOOLS_LOG%"
call "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> "%INIT_TOOLS_LOG%"
-
-echo Updating CLI NuGet Frameworks map...
-robocopy "%TOOLRUNTIME_DIR%" "%TOOLRUNTIME_DIR%\dotnetcli\sdk\%DOTNET_VERSION%" NuGet.Frameworks.dll /XO >> "%INIT_TOOLS_LOG%"
-set UPDATE_CLI_ERRORLEVEL=%ERRORLEVEL%
-if %UPDATE_CLI_ERRORLEVEL% GTR 1 (
- echo ERROR: Failed to update Nuget for CLI {Error level %UPDATE_CLI_ERRORLEVEL%}. Please check '%INIT_TOOLS_LOG%' for more details. 1>&2
- exit /b %UPDATE_CLI_ERRORLEVEL%
+set INIT_TOOLS_ERRORLEVEL=%ERRORLEVEL%
+if not [%INIT_TOOLS_ERRORLEVEL%]==[0] (
+ echo ERROR: An error occured when trying to initialize the tools. Please check '%INIT_TOOLS_LOG%' for more details. 1>&2
+ exit /b %INIT_TOOLS_ERRORLEVEL%
)
:: Create sempahore file
echo Done initializing tools.
echo Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > "%BUILD_TOOLS_SEMAPHORE%"
-
-:DONE
-
-exit /b %TOOLS_INIT_RETURN_CODE%
+exit /b 0 \ No newline at end of file