-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added checks for main dependencies on runtime's build scripts #39052
Changes from 3 commits
724cb29
2cc29b2
a2fc0bc
4f9a919
2ae488e
4c622d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
@echo off | ||
setlocal | ||
|
||
call "%~dp0eng\vs_tools_check.cmd" | ||
|
||
set _args=%* | ||
if "%~1"=="-?" set _args=-help | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,21 @@ showSubsetHelp() | |
"$scriptroot/common/build.sh" "-restore" "-build" "/p:Subset=help" "/clp:nosummary" | ||
} | ||
|
||
assertInstalledDependency() | ||
{ | ||
dependency="$(echo "$1" | awk '{print tolower($0)}')" | ||
location="$(command -v $dependency)" | ||
|
||
if [ -z "$location" ]; then | ||
echo "$dependency is required to build this repo. Make sure to install it and try again." | ||
echo "For a full list of requirements, see https://github.com/dotnet/runtime/blob/master/docs/workflow/requirements/linux-requirements.md" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The message refers to linux-requirements.md, but the current OS can be OSX. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch. I will add a check and point to OSX when it's such case. |
||
exit 1 | ||
fi | ||
} | ||
|
||
assertInstalledDependency 'CMake' | ||
assertInstalledDependency 'Git' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Git isn't a dependency. Sourcebuild needs to work without git. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, it is. The build uses it to extract it the commit hash that we embed into the binaries. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it done unconditionally, or can this behavior be suppressed by configuration? I believe that there are configuration options to suppress this behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, I've tried to uninstall git and the build completed ok, just no version info got embedded into the binaries. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we just check for CMake then? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
|
||
arguments='' | ||
cmakeargs='' | ||
extraargs='' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@if not defined _echo @echo off | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better to add an argument to the existing string instead of duplicating the whole existing script except the one line that calls VsDevCmd.bat ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I hadn't seen this before Jan. Yes, I think this is a good idea to try. I also wasn't very comfortable with duplicating the code but wasn't able to think of another approach. Will try this. |
||
|
||
REM This script checks and ensures there is a working Visual Studio installation | ||
REM alongside its dev tools. This is a requirement to build the runtime repo. | ||
REM All passed arguments are ignored | ||
REM Script will return 0 if a VS installation is found, and 1 if any problems | ||
REM cause it to fail. | ||
|
||
:: Default to highest Visual Studio version available | ||
|
||
:: For VS2017 and later, multiple instances can be installed on the same box. | ||
:: SxS and VS1*0COMNTOOLS are no longer set as global environment variables and | ||
:: are instead only set if the user has launched the Visual Studio Developer | ||
:: Command Prompt. | ||
|
||
:: Following this logic, we will default to the Visual Studio toolset associated | ||
:: with the active Developer Command Prompt. Otherwise, we will query VSWhere to | ||
:: locate the later version of Visual Studio available on the machine. Finally, | ||
:: we will fail the script if not supported instance can be found. | ||
|
||
if defined VisualStudioVersion ( | ||
goto skip_setup | ||
) | ||
|
||
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 | ||
) | ||
|
||
:call_vs | ||
if not exist "%_VSCOMNTOOLS%" ( | ||
echo %__MsgPrefix%Error: Visual Studio 2019 is required to build this repo. Make sure to install it and try again. | ||
echo For a full list of requirements, see https://github.com/dotnet/runtime/blob/master/docs/workflow/requirements/windows-requirements.md | ||
exit /b 1 | ||
) | ||
|
||
:skip_setup | ||
|
||
exit /b 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git isn't a dependency. The repo should be buildable without any source control provider. #47298 tracks protecting this scenario in CI.