From f47cb20a9a440b9945c6676293f40df439957275 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Thu, 7 Jun 2018 18:26:02 +0200 Subject: [PATCH 1/6] win, build: generate .sln only when necessary 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. --- .gitignore | 2 ++ vcbuild.bat | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 27e22ef6183f61..0abda6cf46252a 100644 --- a/.gitignore +++ b/.gitignore @@ -67,6 +67,8 @@ ipch/ /deps/v8/src/debug/obj /*.exe +used_configure_flags + /config.mk /config.gypi /config_fips.gypi diff --git a/vcbuild.bat b/vcbuild.bat index 49ff50f60e4a36..4ccef17b5bd146 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -17,6 +17,7 @@ set target=Build set target_arch=x64 set target_env= set noprojgen= +set forceprojgen= set nobuild= set sign= set nosnapshot= @@ -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 if /i "%1"=="nobuild" set nobuild=1&goto arg-ok if /i "%1"=="nosign" set "sign="&echo Note: vcbuild no longer signs by default. "nosign" is redundant.&goto arg-ok if /i "%1"=="sign" set sign=1&goto arg-ok @@ -252,10 +254,24 @@ goto build-doc :project-gen @rem Skip project generation if requested. -if defined noprojgen goto msbuild +SETLOCAL EnableDelayedExpansion +if defined noprojgen goto skip-configure +if defined forceprojgen goto run-configure +if not exist node.sln goto run-configure +if not exist used_configure_flags goto run-configure +set /p prev_configure_flags= used_configure_flags python configure %configure_flags% if errorlevel 1 goto create-msvs-files-failed if not exist node.sln goto create-msvs-files-failed @@ -626,10 +642,11 @@ goto exit :create-msvs-files-failed echo Failed to create vc project files. +del used_configure_flags goto exit :help -echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-gc/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm] +echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-gc/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [forceprojgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm] echo Examples: echo vcbuild.bat : builds release build echo vcbuild.bat debug : builds debug build From db9dc0994bf029b3c839f27ebe63a835f2a96305 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Wed, 13 Jun 2018 18:16:49 +0200 Subject: [PATCH 2/6] fixups --- .gitignore | 2 -- vcbuild.bat | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 0abda6cf46252a..27e22ef6183f61 100644 --- a/.gitignore +++ b/.gitignore @@ -67,8 +67,6 @@ ipch/ /deps/v8/src/debug/obj /*.exe -used_configure_flags - /config.mk /config.gypi /config_fips.gypi diff --git a/vcbuild.bat b/vcbuild.bat index 4ccef17b5bd146..b3898cd93ae6d2 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -17,7 +17,7 @@ set target=Build set target_arch=x64 set target_env= set noprojgen= -set forceprojgen= +set projgen= set nobuild= set sign= set nosnapshot= @@ -68,7 +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 +if /i "%1"=="projgen" set projgen=1&goto arg-ok if /i "%1"=="nobuild" set nobuild=1&goto arg-ok if /i "%1"=="nosign" set "sign="&echo Note: vcbuild no longer signs by default. "nosign" is redundant.&goto arg-ok if /i "%1"=="sign" set sign=1&goto arg-ok @@ -149,6 +149,7 @@ if defined build_release ( set licensertf=1 set download_arg="--download=all" set i18n_arg=small-icu + set projgen=1 ) :: assign path to node_exe @@ -254,24 +255,22 @@ goto build-doc :project-gen @rem Skip project generation if requested. -SETLOCAL EnableDelayedExpansion if defined noprojgen goto skip-configure if defined forceprojgen goto run-configure if not exist node.sln goto run-configure -if not exist used_configure_flags goto run-configure -set /p prev_configure_flags= used_configure_flags +echo %configure_flags%> .used_configure_flags python configure %configure_flags% if errorlevel 1 goto create-msvs-files-failed if not exist node.sln goto create-msvs-files-failed @@ -642,11 +641,11 @@ goto exit :create-msvs-files-failed echo Failed to create vc project files. -del used_configure_flags +del .used_configure_flags goto exit :help -echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-gc/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [forceprojgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm] +echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-gc/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm] echo Examples: echo vcbuild.bat : builds release build echo vcbuild.bat debug : builds debug build From 1838d2beda4be400770b97e779289ad5c48f2957 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Wed, 13 Jun 2018 18:19:34 +0200 Subject: [PATCH 3/6] fixup --- vcbuild.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcbuild.bat b/vcbuild.bat index b3898cd93ae6d2..16681a273a67b0 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -256,7 +256,7 @@ goto build-doc :project-gen @rem Skip project generation if requested. if defined noprojgen goto skip-configure -if defined forceprojgen goto run-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 From 7e1f3eba3b6f634cf82643fa978cdb3739b0bd63 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Wed, 13 Jun 2018 18:39:31 +0200 Subject: [PATCH 4/6] fixup --- vcbuild.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/vcbuild.bat b/vcbuild.bat index 16681a273a67b0..717950bee962ae 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -262,6 +262,7 @@ 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 :skip-configure echo Reusing solution generated with %prev_configure_flags% From 88ab8e8a55439a97d82b0e12caa72f694a80dd7f Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Thu, 14 Jun 2018 11:06:08 +0200 Subject: [PATCH 5/6] Add warning message after compilation fails --- vcbuild.bat | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vcbuild.bat b/vcbuild.bat index 717950bee962ae..0bf6da90d9c13a 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -253,6 +253,7 @@ goto build-doc :msbuild-found +set project_generated= :project-gen @rem Skip project generation if requested. if defined noprojgen goto skip-configure @@ -275,6 +276,7 @@ echo %configure_flags%> .used_configure_flags python configure %configure_flags% if errorlevel 1 goto create-msvs-files-failed if not exist node.sln goto create-msvs-files-failed +set project_generated=1 echo Project files generated. :msbuild @@ -288,7 +290,10 @@ set "msbplatform=Win32" if "%target_arch%"=="x64" set "msbplatform=x64" if "%target%"=="Build" if defined no_cctest set target=node msbuild node.sln %msbcpu% /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo -if errorlevel 1 goto exit +if errorlevel 1 ( + if not defined project_generated echo Building Node with reused solution failed. To regenerate project files use "vcbuild projgen" + goto exit +) if "%target%" == "Clean" goto exit :sign From 6ec5edea3cece9990f4ccd49de25a649a1a4581e Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Thu, 21 Jun 2018 10:28:30 +0200 Subject: [PATCH 6/6] Rebuild project files if gyp files where modified --- vcbuild.bat | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/vcbuild.bat b/vcbuild.bat index 0bf6da90d9c13a..8f1c565c00cbf6 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -256,20 +256,23 @@ goto build-doc set project_generated= :project-gen @rem Skip project generation if requested. -if defined noprojgen goto skip-configure +if defined noprojgen goto msbuild 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 +echo %configure_flags% > .tmp_gyp_configure_stamp +where /R . /T *.gyp? >> .tmp_gyp_configure_stamp +fc .gyp_configure_stamp .tmp_gyp_configure_stamp >NUL 2>&1 +if errorlevel 1 goto run-configure :skip-configure -echo Reusing solution generated with %prev_configure_flags% +del .tmp_gyp_configure_stamp +echo Reusing solution generated with %configure_flags% goto msbuild :run-configure +del .tmp_gyp_configure_stamp +del .gyp_configure_stamp @rem Generate the VS project. echo configure %configure_flags% echo %configure_flags%> .used_configure_flags @@ -278,6 +281,8 @@ if errorlevel 1 goto create-msvs-files-failed if not exist node.sln goto create-msvs-files-failed set project_generated=1 echo Project files generated. +echo %configure_flags% > .gyp_configure_stamp +where /R . /T *.gyp? >> .gyp_configure_stamp :msbuild @rem Skip build if requested.