Skip to content

Commit ebf36cd

Browse files
joaocgreistargos
authored andcommitted
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: #22311 PR-URL: #22645 Reviewed-By: Richard Lau <[email protected]>
1 parent 7639390 commit ebf36cd

File tree

4 files changed

+77
-2
lines changed

4 files changed

+77
-2
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@echooff
2+
3+
echo ====================================================
4+
echo Tools for Node.js Native Modules Installation Script
5+
echo ====================================================
6+
echo.
7+
echo This Boxstarter script will install Python and the Visual Studio Build Tools,
8+
echo necessary to compile Node.js native modules. All necessary Windows updates
9+
echo will also be installed.
10+
echo.
11+
echo This will require about 3 Gb of free disk space, plus any space necessary to
12+
echo install Windows updates.
13+
echo.
14+
echo This will take a while to run. Your computer may reboot during the
15+
echo installation, and will resume automatically.
16+
echo.
17+
echo Please close all open programs for the duration of the installation.
18+
echo.
19+
echo You can close this window to stop now. This script can be invoked from the
20+
echo Start menu. Detailed instructions to install these tools manually are
21+
echo available at https://github.com/nodejs/node-gyp#on-windows
22+
echo.
23+
pause
24+
25+
"%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'"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
choco upgrade -y python2
2+
choco upgrade -y visualstudio2017buildtools
3+
choco upgrade -y visualstudio2017-workload-vctools

‎tools/msvs/msi/i18n/en-us.wxl‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99
<StringId="MajorUpgrade_DowngradeErrorMessage">A later version of [ProductName] is already installed. Setup will now exit.</String>
1010

11+
<StringId="NativeToolsDlg_Title">[ProductName] Setup</String>
12+
<StringId="NativeToolsDlgTitle">{\WixUI_Font_Title}Tools for Native Modules</String>
13+
<StringId="NativeToolsDlgDescription">Optionally install the tools necessary to compile native modules.</String>
14+
<StringId="NativeToolsDlgBannerBitmap">WixUI_Bmp_Banner</String>
15+
<StringId="NativeToolsDlgIntro">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.</String>
16+
<StringId="NativeToolsDlgInstallCheckbox">Automatically install the necessary tools. The script will pop-up in a new window after the installation completes.</String>
17+
<StringId="NativeToolsDlgManualDetails">Alternatively, follow the instructions at <![CDATA[<a href="https://github.com/nodejs/node-gyp#on-windows">https://github.com/nodejs/node-gyp#on-windows</a>]]> to install the dependencies yourself.</String>
18+
1119
<!-- References like [ProductName] or $(var.ProductName) don't seem to work in Title attributes -->
1220
<StringId="NodeRuntime_Title">Node.js runtime</String>
1321
<StringId="NodeRuntime_Description">Install the core [ProductName] runtime (node.exe).</String>

‎tools/msvs/msi/product.wxs‎

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
<ComponentRefId="NodeVarsScript"/>
7373
<ComponentRefId="NodeStartMenu"/>
7474
<ComponentRefId="AppData" />
75+
<ComponentRefId="InstallToolsBat" />
76+
<ComponentRefId="InstallToolsTxt" />
7577
<ComponentGroupRefId="Product.Generated"/>
7678

7779
<FeatureId="NodePerfCtrSupport"
@@ -162,6 +164,14 @@
162164
<FileId="nodevars.bat"KeyPath="yes"Source="$(var.RepoDir)\tools\msvs\nodevars.bat"/>
163165
</Component>
164166

167+
<ComponentId="InstallToolsBat">
168+
<FileId="InstallToolsBat"KeyPath="yes"Source="$(var.RepoDir)\tools\msvs\install_tools\install_tools.bat"/>
169+
</Component>
170+
171+
<ComponentId="InstallToolsTxt">
172+
<FileId="InstallToolsTxt"Source="$(var.RepoDir)\tools\msvs\install_tools\install_tools.txt"/>
173+
</Component>
174+
165175
<?if $(var.NoPerfCtr) != 1 ?>
166176
<ComponentId="NodePerfCtrSupport">
167177
<FileId="node_perfctr_provider_man"Name="node_perfctr_provider.man"Source="$(var.RepoDir)\src\res\node_perfctr_provider.man">
@@ -195,6 +205,12 @@
195205
Arguments='/k "[INSTALLDIR]nodevars.bat"'
196206
Show="normal"
197207
WorkingDirectory="INSTALLDIR"/>
208+
<ShortcutId="InstallToolsShortcut"
209+
Name="Install Additional Tools for Node.js"
210+
Target="[%ComSpec]"
211+
Arguments='/d /c "[INSTALLDIR]install_tools.bat"'
212+
Show="normal"
213+
WorkingDirectory="INSTALLDIR"/>
198214
<ShortcutId="NodeExecutableShortcut"
199215
Name="Node.js"
200216
Target="[INSTALLDIR]node.exe"
@@ -310,6 +326,9 @@
310326
Execute="immediate"
311327
Return="check" />
312328

329+
<PropertyId="WixShellExecTarget"Value="[#InstallToolsBat]" />
330+
<CustomActionId="LaunchApplication"BinaryKey="WixCA"DllEntry="WixShellExec" />
331+
313332
<InstallUISequence>
314333
<CustomAction='SetInstallScope'Before='FindRelatedProducts'/>
315334
</InstallUISequence>
@@ -340,6 +359,23 @@
340359
<DialogRefId="InstallDirDlg"/>
341360
<DialogRefId="BrowseDlg"/>
342361
<DialogRefId="InvalidDirDlg"/>
362+
<DialogId="NativeToolsDlg"Width="370"Height="270"Title="!(loc.NativeToolsDlg_Title)">
363+
<ControlId="BannerBitmap"Type="Bitmap"X="0"Y="0"Width="370"Height="44"TabSkip="no"Text="!(loc.NativeToolsDlgBannerBitmap)" />
364+
<ControlId="Title"Type="Text"X="15"Y="6"Width="200"Height="15"Transparent="yes"NoPrefix="yes"Text="!(loc.NativeToolsDlgTitle)" />
365+
<ControlId="Description"Type="Text"X="25"Y="23"Width="280"Height="15"Transparent="yes"NoPrefix="yes"Text="!(loc.NativeToolsDlgDescription)" />
366+
<ControlId="BannerLine"Type="Line"X="0"Y="44"Width="370"Height="0" />
367+
368+
<ControlId="Intro"Type="Text"X="20"Y="65"Width="330"Height="30"NoPrefix="yes"Text="!(loc.NativeToolsDlgIntro)" />
369+
<ControlId="InstallCheckbox"Type="CheckBox"X="20"Y="105"Width="330"Height="30"Property="NATIVETOOLSCHECKBOX"CheckBoxValue="1"Text="!(loc.NativeToolsDlgInstallCheckbox)" />
370+
<ControlId="ManualDetails"Type="Hyperlink"X="20"Y="140"Width="330"Height="30"Text="!(loc.NativeToolsDlgManualDetails)" />
371+
372+
<ControlId="BottomLine"Type="Line"X="0"Y="234"Width="370"Height="0" />
373+
<ControlId="Next"Type="PushButton"X="236"Y="243"Width="56"Height="17"Default="yes"Text="!(loc.WixUINext)" />
374+
<ControlId="Back"Type="PushButton"X="180"Y="243"Width="56"Height="17"Text="!(loc.WixUIBack)" />
375+
<ControlId="Cancel"Type="PushButton"X="304"Y="243"Width="56"Height="17"Cancel="yes"Text="!(loc.WixUICancel)">
376+
<PublishEvent="SpawnDialog"Value="CancelDlg">1</Publish>
377+
</Control>
378+
</Dialog>
343379

344380
<PublishDialog="WelcomeDlg"Control="Next"Event="NewDialog"Value="LicenseAgreementDlg">NOT Installed</Publish>
345381
<PublishDialog="WelcomeDlg"Control="Next"Event="NewDialog"Value="VerifyReadyDlg">Installed AND PATCH</Publish>
@@ -350,7 +386,6 @@
350386
<PublishDialog="InstallDirDlg"Control="Next"Event="SetTargetPath"Value="[WIXUI_INSTALLDIR]"Order="10">1</Publish>
351387
<PublishDialog="InstallDirDlg"Control="ChangeFolder"Property="_BrowseProperty"Value="[WIXUI_INSTALLDIR]"Order="10">1</Publish>
352388
<PublishDialog="InstallDirDlg"Control="ChangeFolder"Event="SpawnDialog"Value="BrowseDlg"Order="20">1</Publish>
353-
<PublishDialog="ExitDialog"Control="Finish"Event="EndDialog"Value="Return"Order="999">1</Publish>
354389
<PublishDialog="VerifyReadyDlg"Control="Back"Event="NewDialog"Value="CustomizeDlg"Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
355390
<PublishDialog="VerifyReadyDlg"Control="Back"Event="NewDialog"Value="MaintenanceTypeDlg"Order="2">Installed AND NOT PATCH</Publish>
356391
<PublishDialog="VerifyReadyDlg"Control="Back"Event="NewDialog"Value="WelcomeDlg"Order="3">Installed AND PATCH</Publish>
@@ -361,7 +396,11 @@
361396
<PublishDialog="MaintenanceTypeDlg"Control="Back"Event="NewDialog"Value="MaintenanceWelcomeDlg">1</Publish>
362397
<PublishDialog="CustomizeDlg"Control="Back"Event="NewDialog"Value="MaintenanceTypeDlg"Order="1">Installed</Publish>
363398
<PublishDialog="CustomizeDlg"Control="Back"Event="NewDialog"Value="InstallDirDlg"Order="2">NOT Installed</Publish>
364-
<PublishDialog="CustomizeDlg"Control="Next"Event="NewDialog"Value="VerifyReadyDlg">1</Publish>
399+
<PublishDialog="CustomizeDlg"Control="Next"Event="NewDialog"Value="NativeToolsDlg">1</Publish>
400+
<PublishDialog="NativeToolsDlg"Control="Back"Event="NewDialog"Value="CustomizeDlg">1</Publish>
401+
<PublishDialog="NativeToolsDlg"Control="Next"Event="NewDialog"Value="VerifyReadyDlg">1</Publish>
402+
<PublishDialog="ExitDialog"Control="Finish"Event="DoAction"Value="LaunchApplication">NATIVETOOLSCHECKBOX = 1</Publish>
403+
<PublishDialog="ExitDialog"Control="Finish"Event="EndDialog"Value="Return"Order="999">1</Publish>
365404

366405
<PropertyId="WIXUI_EXITDIALOGOPTIONALTEXT"Value="!(loc.WIXUI_EXITDIALOGOPTIONALTEXT)"/>
367406
</UI>

0 commit comments

Comments
(0)