1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <Wix xmlns =" http://schemas.microsoft.com/wix/2006/wi" >
3
+ <!-- TODO: Change paths and names accordingly -->
4
+ <?define TargetPath =" ..\..\..\target\$(var.TARGET)\release" ?>
5
+ <?define RustupCustomActionDll =" $(var.TargetPath)\rustup_msi.dll" ?>
6
+ <?define RustupExe =" $(var.TargetPath)\rustup-init.exe" ?>
7
+
8
+ <Product Id =" *" Name =" rustup" Language =" 1033" Version =" $(env.CFG_VER_MAJOR).$(env.CFG_VER_MINOR).$(env.CFG_VER_PATCH).0" Manufacturer =" The Rust Project Developers" UpgradeCode =" 09acbb1c-7123-44ac-b2a9-4a04b28ced11" >
9
+ <Package InstallerVersion =" 200" Compressed =" yes" InstallScope =" perUser" />
10
+
11
+ <!-- TODO: How to configure updates? `AllowDowngrades` automatically removes previously installed versions, no matter what version they have -->
12
+ <MajorUpgrade AllowDowngrades =" yes" />
13
+
14
+ <!-- Specifies a single cab file to be embedded in the installer's .msi. -->
15
+ <MediaTemplate EmbedCab =" yes" CompressionLevel =" high" />
16
+
17
+ <Feature Id =" ProductFeature" Title =" rustup" Level =" 1" >
18
+ <ComponentRef Id =" CompleteInstallation" />
19
+ </Feature >
20
+
21
+ <!-- Set some metadata that will appear in the "Installed Programs" list -->
22
+ <Property Id =" ARPCONTACT" Value =" rustup" />
23
+ <Property Id =" ARPCOMMENTS" Value =" rustup – The Rust Toolchain Installer" />
24
+ <Property Id =" ARPURLINFOABOUT" Value =" http://www.rustup.rs" />
25
+ <!-- <Property Id="ARPHELPLINK" Value="http://www.rustup.rs" />-->
26
+ <Property Id =" ARPPRODUCTICON" Value =" rust.ico" />
27
+
28
+ <!-- Disable Modify and Repair options (our custom actions based install model does not support repairing) -->
29
+ <Property Id =" ARPNOMODIFY" Value =" 1" />
30
+ <Property Id =" ARPNOREPAIR" Value =" 1" />
31
+
32
+ <Icon Id =" rust.ico" SourceFile =" rust-logo.ico" />
33
+
34
+ <!-- Reference the UI defined in ui.wxs -->
35
+ <UIRef Id =" CustomUI" />
36
+ <WixVariable Id =" WixUIDialogBmp" Value =" dialogbg.bmp" />
37
+ <WixVariable Id =" WixUIBannerBmp" Value =" banner.bmp" />
38
+ <!-- TODO: Include/generate license file -->
39
+ <!-- <WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" />-->
40
+
41
+ <Directory Id =" TARGETDIR" Name =" SourceDir" >
42
+ <!-- `INSTALLLOCATION` will be set by custom action -->
43
+ <Directory Id =" INSTALLLOCATION" >
44
+ <Directory Id =" INSTALLLOCATION_BINARY" Name =" bin" />
45
+ </Directory >
46
+ </Directory >
47
+
48
+ <DirectoryRef Id =" INSTALLLOCATION_BINARY" >
49
+ <Component Id =" CompleteInstallation" Guid =" df2ab9f7-7888-465c-98dd-bb58cbca68f7" >
50
+ <!-- Write the product code to the registry, so we can use it to run the uninstaller -->
51
+ <RegistryKey Root =" HKCU" Key =" Software\rustup" >
52
+ <RegistryValue Name =" InstalledProductCode" Type =" string" Value =" [ProductCode]" KeyPath =" yes" />
53
+ </RegistryKey >
54
+ <!-- Install the main rustup.exe binary -->
55
+ <File Source =" $(var.RustupExe)" Name =" rustup.exe" />
56
+ <!-- Append to PATH environment variable -->
57
+ <Environment Id =" PATH" Name =" PATH" Value =" [INSTALLLOCATION_BINARY]" Permanent =" no" Part =" first" Action =" set" System =" no" />
58
+ </Component >
59
+ </DirectoryRef >
60
+
61
+ <!-- Register the DLL containing the custom actions as an embedded binary -->
62
+ <Binary Id =" RustupCustomActionDll" SourceFile =" $(var.RustupCustomActionDll)" />
63
+ <!-- Use a type 51 custom action to send options to deferred custom action `RustupInstall`
64
+ (can use arbitrary value that encodes all necessary properties and will be parsed from Rust) -->
65
+ <CustomAction Id =" SetInstallOptions" Property =" RustupInstall" Value =" ... we can pass arbitrary options here ..." />
66
+ <CustomAction Id =" RustupSetInstallLocation" BinaryKey =" RustupCustomActionDll" DllEntry =" RustupSetInstallLocation" Execute =" immediate" Return =" check" Impersonate =" yes" />
67
+ <!-- Propagate the value of `RustupInstallLocation` (set by custom action) to `INSTALLLOCATION` -->
68
+ <CustomAction Id =" AssignInstallLocation" Directory =" INSTALLLOCATION" Value =" [RustupInstallLocation]" />
69
+ <CustomAction Id =" RustupInstall" BinaryKey =" RustupCustomActionDll" DllEntry =" RustupInstall" Execute =" deferred" Return =" check" Impersonate =" yes" />
70
+ <CustomAction Id =" RustupUninstall" BinaryKey =" RustupCustomActionDll" DllEntry =" RustupUninstall" Execute =" deferred" Return =" check" Impersonate =" yes" />
71
+
72
+ <InstallExecuteSequence >
73
+ <DisableRollback Before =" InstallInitialize" />
74
+ <Custom Action =" RustupSetInstallLocation" After =" CostFinalize" />
75
+ <Custom Action =" AssignInstallLocation" After =" RustupSetInstallLocation" />
76
+ <Custom Action =" SetInstallOptions" Before =" InstallInitialize" >NOT Installed</Custom >
77
+ <Custom Action =" RustupInstall" After =" InstallFiles" >NOT Installed</Custom >
78
+ <!-- Run RustupUninstall only on true uninstall, not on upgrade -->
79
+ <Custom Action =" RustupUninstall" After =" RemoveFiles" >Installed AND (NOT UPGRADINGPRODUCTCODE)</Custom >
80
+ </InstallExecuteSequence >
81
+
82
+ <!-- Send a WM_SETTINGCHANGE message to tell processes like explorer to update their
83
+ environments so any new command prompts get the updated %PATH% -->
84
+ <CustomActionRef Id =" WixBroadcastEnvironmentChange" />
85
+ </Product >
86
+ </Wix >
0 commit comments