-
Notifications
You must be signed in to change notification settings - Fork 30k
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
build, win: vcbuild improvements #17015
Conversation
/cc @nodejs/build @nodejs/platform-windows |
Will it still be relevant once #16969 is merged? |
Yes |
@@ -28,5 +28,4 @@ for /f "usebackq tokens=*" %%i in (`vswhere %VSWHERE_ARGS%`) do ( | |||
|
|||
:no-vswhere | |||
endlocal | |||
echo could not find "vswhere" |
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.
Can we keep this. Or upstream to https://github.com/node4good/msvs-com-helper
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.
This removes that message, making output look nicer for VS2015 compilation.
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.
we just dropped "official" VS2015 support 🤷♂️
If you still want to keep output clean, I'd rather you change the call in vcbuild
Line 199 in d217b28
call tools\msvs\vswhere_usability_wrapper.cmd |
if defined DEBUG_HELPER (call tools\msvs\vswhere_usability_wrapper.cmd)
else (call tools\msvs\vswhere_usability_wrapper.cmd > nul)
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.
If you still want to keep output clean, I'd rather you change the call in vcbuild
I'd prefer to keep vcbuild clean too.
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.
Even without 2015, if no VS2017 is found, it will look like this:
Looking for Visual Studio 2017
could not find "vswhere"
Failed to find a suitable Visual Studio installation.
Try to run in a "Developer Command Prompt" or consult
https://github.com/nodejs/node/blob/master/BUILDING.md#windows-1
I don't think it looks good, and the could not find "vswhere"
is only helpful if you know vcbuild internals. We can use DEBUG_HELPER
to debug vcbuild if needed.
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.
Ok, I'll move it upstream.
@@ -1,4 +1,4 @@ | |||
@echo off | |||
@if not defined DEBUG_HELPER @ECHO OFF |
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.
YAASS! (I have this floating in all my workspaces, and I keep forgetting to upstream it)
vcbuild.bat
Outdated
echo Looking for Python 2.x | ||
call :run-python --version > nul 2> nul | ||
if errorlevel 1 echo Could not find Python 2.x installation && exit /b 1 | ||
|
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.
:run-python
will echoCould not find python2
so IMHO no need to echo again. (L561)- should end subroutine with either
exit /b
orgoto :EOF
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.
Agree, let's not duplicate the validation.
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.
:run-python
is very verbose, especially if no Python is found (see #16864). Stdout and stderr is redirected to nul
, to keep it clean.
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.
Then maybe :run-python
should be fixed. I was planning to do it myself, I think it's a simple error in the code.
Updated, PTAL |
vcbuild.bat
Outdated
@@ -577,6 +577,7 @@ set TAG= | |||
set FULLVERSION= | |||
:: Call as subroutine for validation of python | |||
call :run-python tools\getnodeversion.py > nul | |||
if errorlevel 1 exit /b 1 |
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.
This is ugly. Basically, we run tools\getnodeversion.py
, ignore the output, exit if it failed, then run it again, this time directly using a variable that's supposed to be internal to find_python.cmd
.
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.
could change the fake call to call :run-python --version
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.
It would still be a hacky workaround for the limitation of run-python
.
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.
No argument here. This file has a lot of cmd
ism hacks, mainly because you can't redirect stdout into a variable.
I'll check if there's a way to use call
as the for
command.
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.
I've checked before, there isn't. So a subroutine doesn't work as a replacement for the python
command.
An alternative would be to replace run-python
with find-python
that would just populate a variable to be used instead of python
. But then one would have to make sure that find-python
is run before the first usage of Python and that it's not run if Python isn't needed, whenever a significant change is introduced into vcbuild.bat
.
Honestly, I'd prefer to just revert 614dbbd since it introduces a lot of complexity in order to support an edge case that has never affected anyone to my knowledge. IMO it was landed prematurely (only one approval and not thoroughly tested).
Updated, PTAL. |
ping? |
Unfortunately, my comment in #17298 (comment) applies here as well, so I cannot approve this. |
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.
Not the resident domain expert but LGTM, FWIW.
@seishun it does not fix all issues, but at least makes |
If nobody oposes, I will land this tomorrow |
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.
Removes extra erroor messages when Python is not installed. Removes "vswhere not found" message when no VS2017 installation is found. Adds support for DEBUG_HELPER to vcbuild.bat. Fixes: nodejs#16864
141e517
to
766aa49
Compare
vcbuild.bat
Outdated
call tools\msvs\find_python.cmd | ||
if errorlevel 1 echo Could not find python2 & goto :exit | ||
echo Looking for Python 2.x | ||
call tools\msvs\find_python.cmd > NUL 2> NUL |
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.
Can the noise not be fixed inside find_python.cmd
itself?
vcbuild.bat
Outdated
if errorlevel 1 echo Could not find python2 & goto :exit | ||
echo Looking for Python 2.x | ||
call tools\msvs\find_python.cmd > NUL 2> NUL | ||
if errorlevel 1 echo Could not find Python installation & goto :exit |
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.
I'd drop "installation".
Updated, PTAL. |
I've moved error messages to |
CI after update: https://ci.nodejs.org/job/node-test-pull-request/13300/ Can I get +1? |
I don't really see the point in separating error messages for "No Python found at all" and "Python 2.x specifically not found". Isn't the action to be taken by the user the same in both cases? |
Its mostly for the new people, like in Code + Learn, etc. If they have Python 3 installed, |
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.
Generally LGTM, but would be good to get another review from @nodejs/platform-windows
I'd say "No Python 2.x" is sufficient for both cases. Mentioning a Python 3.x installation seems excessive, it's just a different product (i.e. you can have both installed). |
Sure, saying "you don't have python2.x" is sufficient. But saying "you have wrong python version" is more helpful. |
It's also misleading because it suggests it should be replaced with python 2.x. |
In that case wouldn't the answer be to be more specific rather than less, i.e. something like:
? |
It will say Again, this is to help out new people on the project, like in Code + Learn. The more info we provide the better. And easier for people running such workshops to get everyone started with developing Node. I would like to land this, @seishun are you -1 on this? |
I can't imagine a situation where this extra info would help new people. If anything, it's confusing because they might think they should uninstall Python 3.x. I'm -0 on this. |
I'm gonna land this then. |
Landed in 887a2ba |
Removes extra erroor messages when Python is not installed. Removes "vswhere not found" message when no VS2017 installation is found. Adds support for DEBUG_HELPER to vcbuild.bat. Fixes: #16864 PR-URL: #17015 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
Removes extra erroor messages when Python is not installed. Removes "vswhere not found" message when no VS2017 installation is found. Adds support for DEBUG_HELPER to vcbuild.bat. Fixes: nodejs#16864 PR-URL: nodejs#17015 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
Removes extra erroor messages when Python is not installed. Removes "vswhere not found" message when no VS2017 installation is found. Adds support for DEBUG_HELPER to vcbuild.bat. Fixes: #16864 PR-URL: #17015 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
Removes extra erroor messages when Python is not installed. Removes "vswhere not found" message when no VS2017 installation is found. Adds support for DEBUG_HELPER to vcbuild.bat. Fixes: nodejs#16864 PR-URL: nodejs#17015 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
Should this be backported to |
Adds extra a check for proper Python version. If it is not found,
vcbuild
will exit early.If no VS2017 installation is found,
vswhere_usability_wrapper.cmd
would printcould not find "vswhere"
. This removes that message, making output look nicer for VS2015 compilation.Finally, this adds support for
DEBUG_HELPER
tovcbuild.bat
. Similar tovswhere_usability_wrapper.cmd
andfind_python.cmd
, ifDEBUG_HELPER
environment variable is set,echo off
will not be called, making debugging easier.Fixes: #16864
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
build