@@ -13,15 +13,14 @@ set PROJECT_JSON_PATH=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION%
13
13
set PROJECT_JSON_FILE = %PROJECT_JSON_PATH% \project.json
14
14
set PROJECT_JSON_CONTENTS = { " dependencies" : { " Microsoft.DotNet.BuildTools" : " %BUILDTOOLS_VERSION% " , " Microsoft.DotNet.BuildTools.Coreclr" : " 1.0.4-prerelease" }, " frameworks" : { " dnxcore50" : { } } }
15
15
set BUILD_TOOLS_SEMAPHORE = %PROJECT_JSON_PATH% \init-tools.completed
16
- set TOOLS_INIT_RETURN_CODE = 0
17
16
18
17
:: if force option is specified then clean the tool runtime and build tools package directory to force it to get recreated
19
18
if [%1 ]== [force] (
20
19
if exist " %TOOLRUNTIME_DIR% " rmdir /S /Q " %TOOLRUNTIME_DIR% "
21
20
if exist " %PACKAGES_DIR% Microsoft.DotNet.BuildTools" rmdir /S /Q " %PACKAGES_DIR% Microsoft.DotNet.BuildTools"
22
21
)
23
22
24
- :: If sempahore exists do nothing
23
+ :: If semaphore exists do nothing
25
24
if exist " %BUILD_TOOLS_SEMAPHORE% " (
26
25
echo Tools are already initialized.
27
26
goto :DONE
@@ -50,9 +49,8 @@ set DOTNET_LOCAL_PATH=%DOTNET_PATH%%DOTNET_ZIP_NAME%
50
49
echo Installing '%DOTNET_REMOTE_PATH% ' to '%DOTNET_LOCAL_PATH% ' >> " %INIT_TOOLS_LOG% "
51
50
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% "
52
51
if NOT exist " %DOTNET_LOCAL_PATH% " (
53
- echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG% ' for more details.
54
- set TOOLS_INIT_RETURN_CODE = 1
55
- goto :DONE
52
+ echo ERROR: Could not install dotnet cli correctly. 1 >& 2
53
+ goto :error
56
54
)
57
55
58
56
:afterdotnetrestore
@@ -62,9 +60,8 @@ echo Restoring BuildTools version %BUILDTOOLS_VERSION%...
62
60
echo Running: " %DOTNET_CMD% " restore " %PROJECT_JSON_FILE% " --packages " %PACKAGES_DIR% " --source " %BUILDTOOLS_SOURCE% " >> " %INIT_TOOLS_LOG% "
63
61
call " %DOTNET_CMD% " restore " %PROJECT_JSON_FILE% " --packages " %PACKAGES_DIR% " --source " %BUILDTOOLS_SOURCE% " >> " %INIT_TOOLS_LOG% "
64
62
if NOT exist " %BUILD_TOOLS_PATH% init-tools.cmd" (
65
- echo ERROR: Could not restore build tools correctly. See '%INIT_TOOLS_LOG% ' for more details.
66
- set TOOLS_INIT_RETURN_CODE = 1
67
- goto :DONE
63
+ echo ERROR: Could not restore build tools correctly. 1 >& 2
64
+ goto :error
68
65
)
69
66
70
67
:afterbuildtoolsrestore
@@ -73,10 +70,13 @@ echo Initializing BuildTools ...
73
70
echo Running: " %BUILD_TOOLS_PATH% init-tools.cmd" " %~dp0 " " %DOTNET_CMD% " " %TOOLRUNTIME_DIR% " >> " %INIT_TOOLS_LOG% "
74
71
call " %BUILD_TOOLS_PATH% init-tools.cmd" " %~dp0 " " %DOTNET_CMD% " " %TOOLRUNTIME_DIR% " >> " %INIT_TOOLS_LOG% "
75
72
76
- :: Create sempahore file
73
+ :: Create semaphore file
74
+ :DONE
77
75
echo Done initializing tools.
78
76
echo Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > " %BUILD_TOOLS_SEMAPHORE% "
77
+ exit /b 0
79
78
80
- :DONE
81
-
82
- exit /b %TOOLS_INIT_RETURN_CODE%
79
+ :error
80
+ echo Please check the detailed log that follows. 1 >& 2
81
+ type " %INIT_TOOLS_LOG% " 1 >& 2
82
+ exit /b 1
0 commit comments