diff options
author | Ravi Eda <raeda@microsoft.com> | 2017-07-13 13:45:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-13 13:45:52 -0500 |
commit | 474d2e590d8d16089386444fd7ea9782364bd7cf (patch) | |
tree | a42096029f5f908d0818df764f4d73b3c23ee19a | |
parent | d24212f68ed2c7f11b9a257c120311bdfe95cc31 (diff) | |
download | coreclr-474d2e590d8d16089386444fd7ea9782364bd7cf.tar.gz coreclr-474d2e590d8d16089386444fd7ea9782364bd7cf.tar.bz2 coreclr-474d2e590d8d16089386444fd7ea9782364bd7cf.zip |
[CoreCLR] Display the contents of init-tools.log (#12795)
* Update attribute-value in security build definition.
* Display init-tools log.
* Ensure execute permission is available.
-rw-r--r-- | init-tools.cmd | 21 | ||||
-rwxr-xr-x | init-tools.sh | 17 |
2 files changed, 26 insertions, 12 deletions
diff --git a/init-tools.cmd b/init-tools.cmd index ef675ddc8d..b91ecb7805 100644 --- a/init-tools.cmd +++ b/init-tools.cmd @@ -19,7 +19,7 @@ if [%1]==[force] ( if exist "%PACKAGES_DIR%Microsoft.DotNet.BuildTools" rmdir /S /Q "%PACKAGES_DIR%Microsoft.DotNet.BuildTools" ) -:: If sempahore exists do nothing +:: If semaphore exists do nothing if exist "%BUILD_TOOLS_SEMAPHORE%" ( echo Tools are already initialized. goto :EOF @@ -46,8 +46,8 @@ 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 -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. 1>&2 - exit /b 1 + echo ERROR: Could not install dotnet cli correctly. 1>&2 + goto :error ) :afterdotnetrestore @@ -57,8 +57,8 @@ echo Restoring BuildTools version %BUILDTOOLS_VERSION%... 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. 1>&2 - exit /b 1 + echo ERROR: Could not restore build tools correctly. 1>&2 + goto :error ) :afterbuildtoolsrestore @@ -68,14 +68,19 @@ echo Running: "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRU call "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> "%INIT_TOOLS_LOG%" 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% + echo ERROR: An error occured when trying to initialize the tools. 1>&2 + goto :error ) -:: Create sempahore file +:: Create semaphore file echo Done initializing tools. if NOT exist "%BUILD_TOOLS_SEMAPHORE_DIR%" ( mkdir "%BUILD_TOOLS_SEMAPHORE_DIR%" ) echo Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > "%BUILD_TOOLS_SEMAPHORE%" exit /b 0 + +:error +echo Please check the detailed log that follows. 1>&2 +type "%INIT_TOOLS_LOG%" 1>&2 +exit /b 1 diff --git a/init-tools.sh b/init-tools.sh index c076212ab5..4fc52d0107 100755 --- a/init-tools.sh +++ b/init-tools.sh @@ -40,6 +40,12 @@ OSName=$(uname -s) esac fi +display_error_message() +{ + echo "Please check the detailed log that follows." 1>&2 + cat "$__init_tools_log" 1>&2 +} + if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then __PATCH_CLI_NUGET_FRAMEWORKS=0 @@ -76,7 +82,6 @@ if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then fi fi - if [ -n "$BUILD_TOOLS_TOOLSET_DIR" ] && [ -d "$BUILD_TOOLS_TOOLSET_DIR/$__BUILD_TOOLS_PACKAGE_VERSION" ]; then echo "Copying $BUILD_TOOLS_TOOLSET_DIR/$__BUILD_TOOLS_PACKAGE_VERSION to $__TOOLRUNTIME_DIR" >> $__init_tools_log cp -r $BUILD_TOOLS_TOOLSET_DIR/$__BUILD_TOOLS_PACKAGE_VERSION/* $__TOOLRUNTIME_DIR @@ -88,7 +93,10 @@ if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then echo "Restoring BuildTools version $__BUILD_TOOLS_PACKAGE_VERSION..." echo "Running: $__DOTNET_CMD restore \"$__INIT_TOOLS_RESTORE_PROJECT\" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE /p:BuildToolsPackageVersion=$__BUILD_TOOLS_PACKAGE_VERSION" >> $__init_tools_log $__DOTNET_CMD restore "$__INIT_TOOLS_RESTORE_PROJECT" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE /p:BuildToolsPackageVersion=$__BUILD_TOOLS_PACKAGE_VERSION >> $__init_tools_log - if [ ! -e "$__BUILD_TOOLS_PATH/init-tools.sh" ]; then echo "ERROR: Could not restore build tools correctly. See '$__init_tools_log' for more details."1>&2; fi + if [ ! -e "$__BUILD_TOOLS_PATH/init-tools.sh" ]; then + echo "ERROR: Could not restore build tools correctly." 1>&2 + display_error_message + fi fi echo "Initializing BuildTools..." @@ -98,7 +106,8 @@ if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then chmod +x $__BUILD_TOOLS_PATH/init-tools.sh $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR >> $__init_tools_log if [ "$?" != "0" ]; then - echo "ERROR: An error occured when trying to initialize the tools. Please check '$__init_tools_log' for more details."1>&2 + echo "ERROR: An error occurred when trying to initialize the tools." 1>&2 + display_error_message exit 1 fi fi @@ -115,4 +124,4 @@ if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then echo "Done initializing tools." else echo "Tools are already initialized" -fi
\ No newline at end of file +fi |