From: jashook Date: Mon, 5 Mar 2018 21:35:19 +0000 (-0800) Subject: Remove vs2015 build dependencies X-Git-Tag: accepted/tizen/unified/20190422.045933~2737^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00b9df366d9d0407fb8acb323713287920526b66;p=platform%2Fupstream%2Fcoreclr.git Remove vs2015 build dependencies --- diff --git a/build-test.cmd b/build-test.cmd index 2aa9f4e..bd03d6f 100644 --- a/build-test.cmd +++ b/build-test.cmd @@ -7,44 +7,16 @@ set __VCBuildArch=x86_amd64 set __BuildType=Debug set __BuildOS=Windows_NT +set "__ProjectDir=%~dp0" + :: 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 -:: and VS140COMNTOOLS is set as a global environment variable by the installer. This -:: allows users to locate where the instance of VS2015 is installed. -:: -:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS -:: is no longer set as a global environment variable and is instead only set if the user -:: has launched the VS2017 Developer Command Prompt. -:: -:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is -:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and -:: 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 ( - 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% ( - 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 %__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 "%__ProjectDir%"\setup_vs_tools.cmd -call "%_VSCOMNTOOLS%\VsDevCmd.bat" - -:Run +REM setup_vs_tools.cmd will correctly echo error message. +if NOT '%ERRORLEVEL%' == '0' exit /b 1 if defined VS150COMNTOOLS ( set "__VSToolsRoot=%VS150COMNTOOLS%" @@ -56,7 +28,6 @@ if defined VS150COMNTOOLS ( set __VSVersion=vs2015 ) -set "__ProjectDir=%~dp0" :: remove trailing slash if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%" set "__TestDir=%__ProjectDir%\tests" diff --git a/build.cmd b/build.cmd index c9c1420..889a196 100644 --- a/build.cmd +++ b/build.cmd @@ -9,42 +9,8 @@ echo %__MsgPrefix%Starting Build at %TIME% set __ThisScriptFull="%~f0" set __ThisScriptDir="%~dp0" -:: Default to highest Visual Studio version available -:: -:: For VS2015 (and prior), only a single instance is allowed to be installed on a box -:: and VS140COMNTOOLS is set as a global environment variable by the installer. This -:: allows users to locate where the instance of VS2015 is installed. -:: -:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS -:: is no longer set as a global environment variable and is instead only set if the user -:: has launched the VS2017 Developer Command Prompt. -:: -:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is -:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and -:: 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 ( - 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 -) -if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS% -if not exist "%_VSCOMNTOOLS%" ( - 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" - -:Run +call "%__ThisScriptDir%"\setup_vs_tools.cmd +if NOT '%ERRORLEVEL%' == '0' exit /b 1 REM Make the work-around to a bug in the microsoft.dotnet.buildtools.coreclr package until it is fixed. reg query HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3BFCEA48-620F-4B6B-81F7-B9AF75454C7D}\InprocServer32 > NUL: 2>&1 diff --git a/buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json b/buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json index 461bd5b..2fe5caa 100644 --- a/buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json +++ b/buildpipeline/DotNet-CoreClr-Trusted-Windows-x86.json @@ -26,7 +26,7 @@ "enabled": true, "continueOnError": false, "alwaysRun": false, - "displayName": "Run script $(VS140COMNTOOLS)\\VsDevCmd.bat", + "displayName": "Setup vs dev env", "timeoutInMinutes": 0, "refName": "Task2", "task": { @@ -35,7 +35,7 @@ "definitionType": "task" }, "inputs": { - "filename": "$(VS140COMNTOOLS)\\VsDevCmd.bat", + "filename": "setup_vs_tools.cmd", "arguments": "", "modifyEnvironment": "true", "workingFolder": "", diff --git a/buildpipeline/DotNet-CoreClr-Trusted-Windows.json b/buildpipeline/DotNet-CoreClr-Trusted-Windows.json index bfbef14..099a187 100644 --- a/buildpipeline/DotNet-CoreClr-Trusted-Windows.json +++ b/buildpipeline/DotNet-CoreClr-Trusted-Windows.json @@ -26,7 +26,7 @@ "enabled": true, "continueOnError": false, "alwaysRun": false, - "displayName": "Run script $(VS140COMNTOOLS)\\VsDevCmd.bat", + "displayName": "Setup vs dev env", "timeoutInMinutes": 0, "refName": "Task2", "task": { @@ -35,7 +35,7 @@ "definitionType": "task" }, "inputs": { - "filename": "$(VS140COMNTOOLS)\\VsDevCmd.bat", + "filename": "setup_vs_tools.cmd", "arguments": "", "modifyEnvironment": "true", "workingFolder": "", diff --git a/buildpipeline/DotNet-Trusted-Publish.json b/buildpipeline/DotNet-Trusted-Publish.json index 803b490..9bf3520 100644 --- a/buildpipeline/DotNet-Trusted-Publish.json +++ b/buildpipeline/DotNet-Trusted-Publish.json @@ -5,7 +5,7 @@ "enabled": true, "continueOnError": false, "alwaysRun": false, - "displayName": "Run script $(VS140COMNTOOLS)\\VsDevCmd.bat", + "displayName": "Setup vs dev env", "timeoutInMinutes": 0, "refName": "Task1", "task": { @@ -14,7 +14,7 @@ "definitionType": "task" }, "inputs": { - "filename": "$(VS140COMNTOOLS)\\VsDevCmd.bat", + "filename": "setup_vs_tools.cmd", "arguments": "", "modifyEnvironment": "true", "workingFolder": "", diff --git a/buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json b/buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json index ab5628d..ec6ea50 100644 --- a/buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json +++ b/buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json @@ -5,7 +5,7 @@ "enabled": true, "continueOnError": false, "alwaysRun": false, - "displayName": "Run script $(VS140COMNTOOLS)\\VsDevCmd.bat", + "displayName": "Setup vs dev env", "timeoutInMinutes": 0, "condition": "ne(variables['PB_SkipTests'], 'true')", "refName": "Task1", @@ -15,7 +15,7 @@ "definitionType": "task" }, "inputs": { - "filename": "$(VS140COMNTOOLS)\\VsDevCmd.bat", + "filename": "setup_vs_tools.cmd", "arguments": "", "modifyEnvironment": "true", "workingFolder": "", diff --git a/buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json b/buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json index 6edbc87..06aa02e 100644 --- a/buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json +++ b/buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json @@ -5,7 +5,7 @@ "enabled": true, "continueOnError": false, "alwaysRun": false, - "displayName": "Run script $(VS140COMNTOOLS)\\VsDevCmd.bat", + "displayName": "Setup vs dev env", "timeoutInMinutes": 0, "condition": "ne(variables['PB_SkipTests'], 'true')", "refName": "Task1", @@ -15,7 +15,7 @@ "definitionType": "task" }, "inputs": { - "filename": "$(VS140COMNTOOLS)\\VsDevCmd.bat", + "filename": "setup_vs_tools.cmd", "arguments": "", "modifyEnvironment": "true", "workingFolder": "", diff --git a/run.cmd b/run.cmd index 295604b..bba6586 100644 --- a/run.cmd +++ b/run.cmd @@ -1,43 +1,17 @@ @if not defined _echo @echo off setlocal -:: Default to highest Visual Studio version available -:: -:: For VS2015 (and prior), only a single instance is allowed to be installed on a box -:: and VS140COMNTOOLS is set as a global environment variable by the installer. This -:: allows users to locate where the instance of VS2015 is installed. -:: -:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS -:: is no longer set as a global environment variable and is instead only set if the user -:: has launched the VS2017 Developer Command Prompt. -:: -:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is -:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and -:: 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 ( - if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment - goto :Run -) +set "__ProjectDir=%~dp0" -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 -) -if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS% -if not exist "%_VSCOMNTOOLS%" ( - 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 "%__ProjectDir%"\setup_vs_tools.cmd -call "%_VSCOMNTOOLS%\VsDevCmd.bat" +REM setup_vs_tools.cmd will correctly echo error message. +if NOT '%ERRORLEVEL%' == '0' exit /b 1 -:Run :: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and :: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69). set Platform= +set __ProjectDir= :: Restore the Tools directory call %~dp0init-tools.cmd diff --git a/setup_vs_tools.cmd b/setup_vs_tools.cmd new file mode 100644 index 0000000..9af06e5 --- /dev/null +++ b/setup_vs_tools.cmd @@ -0,0 +1,48 @@ +@if not defined _echo @echo off + +REM This script is responsible for setting up either the vs2015 or vs2017 env +REM All passed arguments are ignored +REM Script will return with 0 if pass, 1 if there is a failure to find either +REM vs2015 or vs2017 + +:: Default to highest Visual Studio version available +:: +:: For VS2015 (and prior), only a single instance is allowed to be installed on a box +:: and VS140COMNTOOLS is set as a global environment variable by the installer. This +:: allows users to locate where the instance of VS2015 is installed. +:: +:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS +:: is no longer set as a global environment variable and is instead only set if the user +:: has launched the VS2017 Developer Command Prompt. +:: +:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is +:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and +:: 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 ( + if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment + goto skip_setup +) + +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 + goto call_vs +) +if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS% +echo VS2017 not found, using VS2015 +:call_vs +if not exist "%_VSCOMNTOOLS%" ( + echo %__MsgPrefix%Error: Visual Studio 2015 or 2017 required. + echo Please see https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md for build instructions. + exit /b 1 +) +echo %__MsgPrefix%"%_VSCOMNTOOLS%\VsDevCmd.bat" +call "%_VSCOMNTOOLS%\VsDevCmd.bat" + +:skip_setup + +exit /b 0 \ No newline at end of file diff --git a/tests/runtest.cmd b/tests/runtest.cmd index 8682aad..1533402 100644 --- a/tests/runtest.cmd +++ b/tests/runtest.cmd @@ -7,51 +7,22 @@ set __BuildType=Debug set __BuildOS=Windows_NT set __MSBuildBuildArch=x64 +set "__ProjectDir=%~dp0" + :: 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 -:: and VS140COMNTOOLS is set as a global environment variable by the installer. This -:: allows users to locate where the instance of VS2015 is installed. -:: -:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS -:: is no longer set as a global environment variable and is instead only set if the user -:: has launched the VS2017 Developer Command Prompt. -:: -:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is -:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and -:: 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 ( - 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% ( - 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 %__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" +call "%__ProjectDir%"\..\setup_vs_tools.cmd -:Run +REM setup_vs_tools.cmd will correctly echo error message. +if NOT '%ERRORLEVEL%' == '0' exit /b 1 set __VSVersion=vs2017 if defined VS140COMNTOOLS set __VSVersion=vs2015 if defined VS150COMNTOOLS set __VSVersion=vs2017 -set __ProjectDir=%~dp0 :: remove trailing slash if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%" set "__ProjectFilesDir=%__ProjectDir%"