From 39937938d705413ea438c9d4695953b5164557ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Wed, 29 Aug 2018 23:22:51 +0100 Subject: [PATCH] win,msi: install tools for native modules Add a dialog during installation with information about native modules that can optionally run a Boxstarter script at the end of the installation. This script can also be run from Start menu. Fixes: https://github.com/nodejs/node/issues/22311 PR-URL: https://github.com/nodejs/node/pull/22645 Reviewed-By: Richard Lau --- tools/msvs/install_tools/install_tools.bat | 25 +++++++++++++ tools/msvs/install_tools/install_tools.txt | 3 ++ tools/msvs/msi/i18n/en-us.wxl | 8 ++++ tools/msvs/msi/product.wxs | 43 +++++++++++++++++++++- 4 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 tools/msvs/install_tools/install_tools.bat create mode 100644 tools/msvs/install_tools/install_tools.txt diff --git a/tools/msvs/install_tools/install_tools.bat b/tools/msvs/install_tools/install_tools.bat new file mode 100644 index 00000000000000..6bef8ca5b64258 --- /dev/null +++ b/tools/msvs/install_tools/install_tools.bat @@ -0,0 +1,25 @@ +@echo off + +echo ==================================================== +echo Tools for Node.js Native Modules Installation Script +echo ==================================================== +echo. +echo This Boxstarter script will install Python and the Visual Studio Build Tools, +echo necessary to compile Node.js native modules. All necessary Windows updates +echo will also be installed. +echo. +echo This will require about 3 Gb of free disk space, plus any space necessary to +echo install Windows updates. +echo. +echo This will take a while to run. Your computer may reboot during the +echo installation, and will resume automatically. +echo. +echo Please close all open programs for the duration of the installation. +echo. +echo You can close this window to stop now. This script can be invoked from the +echo Start menu. Detailed instructions to install these tools manually are +echo available at https://github.com/nodejs/node-gyp#on-windows +echo. +pause + +"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1')); get-boxstarter -Force; Install-BoxstarterPackage -PackageName '%~dp0\install_tools.txt'" diff --git a/tools/msvs/install_tools/install_tools.txt b/tools/msvs/install_tools/install_tools.txt new file mode 100644 index 00000000000000..baf530a774759b --- /dev/null +++ b/tools/msvs/install_tools/install_tools.txt @@ -0,0 +1,3 @@ +choco upgrade -y python2 +choco upgrade -y visualstudio2017buildtools +choco upgrade -y visualstudio2017-workload-vctools diff --git a/tools/msvs/msi/i18n/en-us.wxl b/tools/msvs/msi/i18n/en-us.wxl index 86da6ecc40ecaf..71c17014911033 100644 --- a/tools/msvs/msi/i18n/en-us.wxl +++ b/tools/msvs/msi/i18n/en-us.wxl @@ -8,6 +8,14 @@ A later version of [ProductName] is already installed. Setup will now exit. + [ProductName] Setup + {\WixUI_Font_Title}Tools for Native Modules + Optionally install the tools necessary to compile native modules. + WixUI_Bmp_Banner + Some npm modules need to be compiled from C/C++ when installing. If you want to be able to install such modules, some tools (Python 2 and Visual Studio Build Tools) need to be installed. + Automatically install the necessary tools. The script will pop-up in a new window after the installation completes. + Alternatively, follow the instructions at https://github.com/nodejs/node-gyp#on-windows]]> to install the dependencies yourself. + Node.js runtime Install the core [ProductName] runtime (node.exe). diff --git a/tools/msvs/msi/product.wxs b/tools/msvs/msi/product.wxs index e9e4e33751d254..ad48fedafd9ea0 100755 --- a/tools/msvs/msi/product.wxs +++ b/tools/msvs/msi/product.wxs @@ -72,6 +72,8 @@ + + + + + + + + + + @@ -195,6 +205,12 @@ Arguments='/k "[INSTALLDIR]nodevars.bat"' Show="normal" WorkingDirectory="INSTALLDIR"/> + + + + @@ -340,6 +359,23 @@ + + + + + + + + + + + + + + + 1 + + NOT Installed Installed AND PATCH @@ -350,7 +386,6 @@ 1 1 1 - 1 NOT Installed OR WixUI_InstallMode = "Change" Installed AND NOT PATCH Installed AND PATCH @@ -361,7 +396,11 @@ 1 Installed NOT Installed - 1 + 1 + 1 + 1 + NATIVETOOLSCHECKBOX = 1 + 1