diff options
author | Jacek Blaszczynski <biosciencenow@outlook.com> | 2017-10-24 02:04:05 +0200 |
---|---|---|
committer | Jacek Blaszczynski <biosciencenow@outlook.com> | 2017-10-24 02:04:05 +0200 |
commit | 811761c22da85b7bbc6861756ee20be906a04057 (patch) | |
tree | 78a79440e0abaa7c3eb5a3b7f81561a5ce4caa11 | |
parent | 83a3a7ddf9a399d1c065a6480b1c95d218a175dc (diff) | |
download | coreclr-811761c22da85b7bbc6861756ee20be906a04057.tar.gz coreclr-811761c22da85b7bbc6861756ee20be906a04057.tar.bz2 coreclr-811761c22da85b7bbc6861756ee20be906a04057.zip |
Cleanup VsDevCmd.bat usage and improve build system messages to ease diagnostics
-rw-r--r-- | build-test.cmd | 19 | ||||
-rw-r--r-- | build.cmd | 34 | ||||
-rw-r--r-- | clr.nativebuild.props | 2 | ||||
-rw-r--r-- | init-tools.cmd | 16 | ||||
-rw-r--r-- | run.cmd | 5 | ||||
-rw-r--r-- | tests/runtest.cmd | 39 |
6 files changed, 62 insertions, 53 deletions
diff --git a/build-test.cmd b/build-test.cmd index b247090604..56527bd397 100644 --- a/build-test.cmd +++ b/build-test.cmd @@ -7,6 +7,10 @@ set __VCBuildArch=x86_amd64 set __BuildType=Debug set __BuildOS=Windows_NT +:: Define a prefix for most output progress messages that come from this script. That makes +:: it easier to see where these are coming from. Note that there is a trailing space here. +set __MsgPrefix=BUILDTEST: + :: Default to highest Visual Studio version available :: :: For VS2015 (and prior), only a single instance is allowed to be installed on a box @@ -22,7 +26,10 @@ set __BuildOS=Windows_NT :: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015 :: toolset if it is installed. Finally, we will fail the script if no supported VS instance :: can be found. -if defined VisualStudioVersion goto :Run +if defined VisualStudioVersion ( + if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment + goto Run +) set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if exist %_VSWHERE% ( @@ -30,7 +37,7 @@ if exist %_VSWHERE% ( ) if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS% if not exist "%_VSCOMNTOOLS%" ( - echo Error: Visual Studio 2015 or 2017 required. + echo %__MsgPrefix%Error: Visual Studio 2015 or 2017 required. echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions. exit /b 1 ) @@ -49,10 +56,6 @@ if defined VS150COMNTOOLS ( set __VSVersion=vs2015 ) -:: Define a prefix for most output progress messages that come from this script. That makes -:: it easier to see where these are coming from. Note that there is a trailing space here. -set __MsgPrefix=BUILDTEST: - set "__ProjectDir=%~dp0" :: remove trailing slash if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%" @@ -120,8 +123,8 @@ if defined __BuildAgainstPackagesArg ( ) ) -echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat" -call "%__VSToolsRoot%\VsDevCmd.bat" +:: echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat" +:: call "%__VSToolsRoot%\VsDevCmd.bat" @if defined _echo @echo on set __RunArgs=-BuildOS=%__BuildOS% -BuildType=%__BuildType% -BuildArch=%__BuildArch% @@ -1,7 +1,11 @@ @if not defined _echo @echo off setlocal EnableDelayedExpansion EnableExtensions -echo Starting Build at %TIME% +:: Define a prefix for most output progress messages that come from this script. That makes +:: it easier to see where these are coming from. Note that there is a trailing space here. +set "__MsgPrefix=BUILD: " + +echo %__MsgPrefix%Starting Build at %TIME% set __ThisScriptFull="%~f0" set __ThisScriptDir="%~dp0" @@ -21,21 +25,24 @@ set __ThisScriptDir="%~dp0" :: toolset if it is installed. Finally, we will fail the script if no supported VS instance :: can be found. -if defined VisualStudioVersion goto :Run +if defined VisualStudioVersion ( + if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment + goto :Run +) +echo %__MsgPrefix%"Searching for Visual Studio 2017 or 2015 installation" set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if exist %_VSWHERE% ( - for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools +for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools ) if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS% if not exist "%_VSCOMNTOOLS%" ( - echo Error: Visual Studio 2015 or 2017 required. - echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions. - exit /b 1 + echo %__MsgPrefix%Error: Visual Studio 2015 or 2017 required. + echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions. + exit /b 1 ) call "%_VSCOMNTOOLS%\VsDevCmd.bat" -pushd %__ThisScriptDir% :Run @@ -69,10 +76,6 @@ set __BuildArch=x64 set __BuildType=Debug set __BuildOS=Windows_NT -:: Define a prefix for most output progress messages that come from this script. That makes -:: it easier to see where these are coming from. Note that there is a trailing space here. -set "__MsgPrefix=BUILD: " - :: Set the various build properties here so that CMake and MSBuild can pick them up set "__ProjectDir=%~dp0" :: remove trailing slash @@ -309,13 +312,13 @@ for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__ REM NumberOfEnabledCore is an WMI property providing number of enabled cores on machine REM processor(s) and later is used to set optimal level of CL parallelism during native build step -if not defined NumberOfEnabledCore ( +if not defined NumberOfCores ( REM Determine number of physical processor cores available on machine for /f "tokens=*" %%I in ( - 'wmic cpu get NumberOfEnabledCore /value ^| find "=" 2^>NUL' + 'wmic cpu get NumberOfCores /value ^| find "=" 2^>NUL' ) do set %%I ) -echo %__MsgPrefix%Number of available CPU cores %NumberOfEnabledCore% +echo %__MsgPrefix%Number of processor cores %NumberOfCores% REM ========================================================================================= REM === @@ -323,10 +326,7 @@ REM === Start the build steps REM === REM ========================================================================================= -echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat" -call "%__VSToolsRoot%\VsDevCmd.bat" @if defined _echo @echo on -pushd %__ThisScriptDir% @call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\build.proj -generateHeaderWindows -NativeVersionHeaderFile="%__RootBinDir%\obj\_version.h" %__RunArgs% %__UnprocessedBuildArgs% diff --git a/clr.nativebuild.props b/clr.nativebuild.props index cba6636fef..3efd9a363c 100644 --- a/clr.nativebuild.props +++ b/clr.nativebuild.props @@ -1,5 +1,5 @@ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> - <CL_MPCount>$(NumberOfEnabledCore)</CL_MPCount> + <CL_MPCount>$(NumberOfCores)</CL_MPCount> </PropertyGroup> </Project> diff --git a/init-tools.cmd b/init-tools.cmd index 235f64532e..4793df0e79 100644 --- a/init-tools.cmd +++ b/init-tools.cmd @@ -21,7 +21,7 @@ if [%1]==[force] ( :: If semaphore exists do nothing if exist "%BUILD_TOOLS_SEMAPHORE%" ( - echo Tools are already initialized. + echo %__MsgPrefix%Tools are already initialized. goto :EOF ) @@ -38,7 +38,7 @@ echo Running %0 > "%INIT_TOOLS_LOG%" set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.txt" if exist "%DOTNET_CMD%" goto :afterdotnetrestore -echo Installing dotnet cli... +echo %__MsgPrefix%Installing dotnet cli... if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%" set DOTNET_ZIP_NAME=dotnet-sdk-%DOTNET_VERSION%-win-x64.zip set DOTNET_REMOTE_PATH=https://dotnetcli.blob.core.windows.net/dotnet/Sdk/%DOTNET_VERSION%/%DOTNET_ZIP_NAME% @@ -53,8 +53,8 @@ if NOT exist "%DOTNET_LOCAL_PATH%" ( :afterdotnetrestore if exist "%BUILD_TOOLS_PATH%" goto :afterbuildtoolsrestore -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% /p:ToolsDir=%TOOLRUNTIME_DIR% >> "%INIT_TOOLS_LOG%" +echo %__MsgPrefix%Restoring BuildTools version %BUILDTOOLS_VERSION%... +echo %__MsgPrefix%Running: "%DOTNET_CMD%" restore "%INIT_TOOLS_RESTORE_PROJECT%" --no-cache --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" /p:BuildToolsPackageVersion=%BUILDTOOLS_VERSION% /p:ToolsDir=%TOOLRUNTIME_DIR% >> "%INIT_TOOLS_LOG%" call "%DOTNET_CMD%" restore "%INIT_TOOLS_RESTORE_PROJECT%" --no-cache --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" /p:BuildToolsPackageVersion=%BUILDTOOLS_VERSION% /p:ToolsDir=%TOOLRUNTIME_DIR% >> "%INIT_TOOLS_LOG%" if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" ( echo ERROR: Could not restore build tools correctly. 1>&2 @@ -63,8 +63,8 @@ if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" ( :afterbuildtoolsrestore -echo Initializing BuildTools... -echo Running: "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> "%INIT_TOOLS_LOG%" +echo %__MsgPrefix%Initializing BuildTools... +echo %__MsgPrefix%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%" set INIT_TOOLS_ERRORLEVEL=%ERRORLEVEL% if not [%INIT_TOOLS_ERRORLEVEL%]==[0] ( @@ -73,11 +73,11 @@ if not [%INIT_TOOLS_ERRORLEVEL%]==[0] ( ) :: Create semaphore file -echo Done initializing tools. +echo %__MsgPrefix%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%" +echo %__MsgPrefix%Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > "%BUILD_TOOLS_SEMAPHORE%" exit /b 0 :error @@ -16,7 +16,10 @@ setlocal :: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015 :: toolset if it is installed. Finally, we will fail the script if no supported VS instance :: can be found. -if defined VisualStudioVersion goto :Run +if defined VisualStudioVersion ( + if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment + goto :Run +) set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if exist %_VSWHERE% ( diff --git a/tests/runtest.cmd b/tests/runtest.cmd index eb1894599f..c5aadfea76 100644 --- a/tests/runtest.cmd +++ b/tests/runtest.cmd @@ -7,6 +7,10 @@ set __BuildType=Debug set __BuildOS=Windows_NT set __MSBuildBuildArch=x64 +:: Define a prefix for most output progress messages that come from this script. That makes +:: it easier to see where these are coming from. Note that there is a trailing space here. +set "__MsgPrefix=RUNTEST: " + :: Default to highest Visual Studio version available :: :: For VS2015 (and prior), only a single instance is allowed to be installed on a box @@ -22,7 +26,10 @@ set __MSBuildBuildArch=x64 :: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015 :: toolset if it is installed. Finally, we will fail the script if no supported VS instance :: can be found. -if defined VisualStudioVersion goto :Run +if defined VisualStudioVersion ( + if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment + goto Run +) set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if exist %_VSWHERE% ( @@ -30,7 +37,7 @@ if exist %_VSWHERE% ( ) if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS% if not exist "%_VSCOMNTOOLS%" ( - echo Error: Visual Studio 2015 or 2017 required. + echo %__MsgPrefix%Error: Visual Studio 2015 or 2017 required. echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions. exit /b 1 ) @@ -44,10 +51,6 @@ set __VSVersion=vs2017 if defined VS140COMNTOOLS set __VSVersion=vs2015 if defined VS150COMNTOOLS set __VSVersion=vs2017 -:: Define a prefix for most output progress messages that come from this script. That makes -:: it easier to see where these are coming from. Note that there is a trailing space here. -set __MsgPrefix=RUNTEST: - set __ProjectDir=%~dp0 :: remove trailing slash if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%" @@ -154,11 +157,11 @@ if not exist "%__VCToolsRoot%\vcvarsall.bat" goto NoVS if not exist "%__VSToolsRoot%\VsDevCmd.bat" goto NoVS :: Does MSBuild really exist? -if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. && exit /b 1 +if not exist %_msbuildexe% echo %__MsgPrefix%Error: Could not find MSBuild.exe. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. && exit /b 1 :: Set the environment for the build- VS cmd prompt -echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat" -call "%__VSToolsRoot%\VsDevCmd.bat" +:: echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat" +:: call "%__VSToolsRoot%\VsDevCmd.bat" if not defined VSINSTALLDIR ( echo %__MsgPrefix%Error: runtest.cmd should be run from a Visual Studio Command Prompt. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. @@ -280,11 +283,11 @@ echo %__MsgPrefix%CORE_ROOT that will be used is: %CORE_ROOT% echo %__MsgPrefix%Starting the test run ... set __BuildLogRootName=PerfTestRunResults -echo Running perf tests +echo %__MsgPrefix%Running perf tests call :msbuild "%__ProjectFilesDir%\runtest.proj" /t:RunPerfTests /clp:showcommandline if errorlevel 1 ( - echo Test Run failed. Refer to the following: + echo %__MsgPrefix%Test Run failed. Refer to the following: echo Html report: %__TestRunHtmlLog% ) @@ -349,7 +352,7 @@ if %__exitCode% neq 0 ( exit /b 0 ) -echo Successfully precompiled and generated dasm for %2 +echo %__MsgPrefix%Successfully precompiled and generated dasm for %2 exit /b 0 :PrecompileFX @@ -407,7 +410,7 @@ if "%CORE_ROOT%" == "" ( :: they often bump up against the default 10 minute timeout. :: 20 minutes is more than enough time for a test to complete successfully. if defined __LongGCTests ( - echo Running Long GC tests, extending timeout to 20 minutes + echo %__MsgPrefix%Running Long GC tests, extending timeout to 20 minutes set __TestTimeout=1200000 set RunningLongGCTests=1 ) @@ -415,30 +418,30 @@ if defined __LongGCTests ( :: GCSimulator tests can take up to an hour to complete. They are run twice a week in the :: CI, so it's fine if they take a long time. if defined __GCSimulatorTests ( - echo Running GCSimulator tests, extending timeout to one hour + echo %__MsgPrefix%Running GCSimulator tests, extending timeout to one hour set __TestTimeout=3600000 set RunningGCSimulatorTests=1 ) if defined __JitDisasm ( if defined __DoCrossgen ( - echo Running jit disasm on framework and test assemblies + echo %__MsgPrefix%Running jit disasm on framework and test assemblies ) if not defined __DoCrossgen ( - echo Running jit disasm on test assemblies only + echo %__MsgPrefix%Running jit disasm on test assemblies only ) set RunningJitDisasm=1 ) if defined __IlasmRoundTrip ( - echo Running Ilasm round trip + echo %__MsgPrefix%Running Ilasm round trip set RunningIlasmRoundTrip=1 ) set __BuildLogRootName=Tests_GenerateRuntimeLayout call :msbuild "%__ProjectFilesDir%\runtest.proj" /p:GenerateRuntimeLayout=true if errorlevel 1 ( - echo Test Dependency Resolution Failed + echo %__MsgPrefix%Test Dependency Resolution Failed exit /b 1 ) echo %__MsgPrefix%Created the runtime layout with all dependencies in %CORE_ROOT% |