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
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@echo off
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'"
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

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

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

11+
<String Id="NativeToolsDlg_Title">[ProductName] Setup</String>
12+
<String Id="NativeToolsDlgTitle">{\WixUI_Font_Title}Tools for Native Modules</String>
13+
<String Id="NativeToolsDlgDescription">Optionally install the tools necessary to compile native modules.</String>
14+
<String Id="NativeToolsDlgBannerBitmap">WixUI_Bmp_Banner</String>
15+
<String Id="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+
<String Id="NativeToolsDlgInstallCheckbox">Automatically install the necessary tools. The script will pop-up in a new window after the installation completes.</String>
17+
<String Id="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
<String Id="NodeRuntime_Title">Node.js runtime</String>
1321
<String Id="NodeRuntime_Description">Install the core [ProductName] runtime (node.exe).</String>

tools/msvs/msi/product.wxs

+41-2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
<ComponentRef Id="NodeVarsScript"/>
7373
<ComponentRef Id="NodeStartMenu"/>
7474
<ComponentRef Id="AppData" />
75+
<ComponentRef Id="InstallToolsBat" />
76+
<ComponentRef Id="InstallToolsTxt" />
7577
<ComponentGroupRef Id="Product.Generated"/>
7678

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

167+
<Component Id="InstallToolsBat">
168+
<File Id="InstallToolsBat" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\install_tools\install_tools.bat"/>
169+
</Component>
170+
171+
<Component Id="InstallToolsTxt">
172+
<File Id="InstallToolsTxt" Source="$(var.RepoDir)\tools\msvs\install_tools\install_tools.txt"/>
173+
</Component>
174+
165175
<?if $(var.NoPerfCtr) != 1 ?>
166176
<Component Id="NodePerfCtrSupport">
167177
<File Id="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+
<Shortcut Id="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
<Shortcut Id="NodeExecutableShortcut"
199215
Name="Node.js"
200216
Target="[INSTALLDIR]node.exe"
@@ -310,6 +326,9 @@
310326
Execute="immediate"
311327
Return="check" />
312328

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

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

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

0 commit comments

Comments
 (0)