-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
win, build: generate .sln only when necessary #21284
Conversation
When generating sln, store flags passed to configure. Next time, if node.sln exists and configure flags match those stored, skip building .sln files. Adds forceprojgen vcbuild option to force .sln regeneration.
@bzoz sadly an error occured when I tried to trigger a build :( |
vcbuild.bat
Outdated
@@ -67,6 +68,7 @@ if /i "%1"=="x86" set target_arch=x86&goto arg-ok | |||
if /i "%1"=="x64" set target_arch=x64&goto arg-ok | |||
if /i "%1"=="vs2017" set target_env=vs2017&goto arg-ok | |||
if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok | |||
if /i "%1"=="forceprojgen" set forceprojgen=1&goto arg-ok |
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.
maybe projgen
? so it goes as a pair projgen
/noprojgen
vcbuild.bat
Outdated
@@ -252,10 +254,24 @@ goto build-doc | |||
|
|||
:project-gen | |||
@rem Skip project generation if requested. | |||
if defined noprojgen goto msbuild | |||
SETLOCAL EnableDelayedExpansion |
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 this is only needed for L262 & L263, could this be moved there? Otherwise I can see this giving someone a headache in the future.
SETLOCAL EnableDelayedExpansion
set /p prev_configure_flags=<used_configure_flags
if NOT !prev_configure_flags! == !configure_flags! ENDLOCAL & goto run-configure
vcbuild.bat
Outdated
@rem Generate the VS project. | ||
echo configure %configure_flags% | ||
echo %configure_flags%> used_configure_flags |
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 rename the tmp file .used_configure_flags
. I know this is not *nix, but git will exclude it by default, and Windows will at least group it together with the rest of the settings/temporary files.
Great idea! /CC @nodejs/build-files @nodejs/platform-windows @zcbenz |
What's the cost of always regenerating .sln files? |
From my POV:
|
@refack: updated with your comments, PTAL Also, project files will always be generated for |
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'm thinking as a follow up PR to move this logic to |
I'd much prefer this. With this PR as it stands if you tweak a |
Time.... Also
Don't! |
A very rough sketch: diff --git a/vcbuild.bat b/vcbuild.bat
index 717950bee9..a9ff3a423a 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -258,20 +258,22 @@ goto build-doc
if defined noprojgen goto skip-configure
if defined projgen goto run-configure
if not exist node.sln goto run-configure
-if not exist .used_configure_flags goto run-configure
-SETLOCAL EnableDelayedExpansion
-set /p prev_configure_flags=<.used_configure_flags
-if NOT !prev_configure_flags! == !configure_flags! ENDLOCAL && goto run-configure
-ENDLOCAL
+if not exist .gyp_configure_stamp goto run-configure
+where /R . /T *.gyp? > .tmp_gyp_configure
+echo %configure_flags% >> .tmp_gyp_configure
+fc .gyp_configure_stamp .tmp_gyp_configure > NUL
+if ERRORLEVEL 1 goto run-configure
:skip-configure
-echo Reusing solution generated with %prev_configure_flags%
+del .tmp_gyp_configure
+echo Reusing solution generated with '%prev_configure_flags%'
goto msbuild
:run-configure
@rem Generate the VS project.
echo configure %configure_flags%
-echo %configure_flags%> .used_configure_flags
+where /R . /T *.gyp? > .gyp_configure_stamp
+echo %configure_flags% >> .gyp_configure_stamp
python configure %configure_flags%
if errorlevel 1 goto create-msvs-files-failed
if not exist node.sln goto create-msvs-files-failed Unfortunately I can't test this ATM |
Added a warning message that is displayed after build fails with reused solution files: Building Node with reused solution failed. To regenerate project files use "vcbuild projgen" |
Is this ready to land? |
@refack idea worked out great, added it to the PR. PTAL. |
landed in 4dece04 |
When generating sln, store flags passed to configure. Next time, if node.sln exists and configure flags match those stored, skip building .sln files. Adds projgen vcbuild option to force .sln regeneration. PR-URL: #21284 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]>
When generating sln, store flags passed to configure. Next time, if node.sln exists and configure flags match those stored, skip building .sln files. Adds projgen vcbuild option to force .sln regeneration. PR-URL: #21284 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]>
When generating project files, store flags passed to
configure
. Next time, ifnode.sln
exists and configure flags match those stored, skip building.sln
files.Adds
forceprojgen
vcbuild option to force project files regeneration.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes