Skip to content

Migrate the Windows installer to WiX v4 #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 32 additions & 31 deletions platforms/Windows/devtools-amd64.wxs
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Language="1033" Manufacturer="swift.org" Name="Swift Developer Tools for Windows x86_64" UpgradeCode="5778fa7a-f1a6-4133-b4e0-fc0d9caf4544" Version="$(var.ProductVersion)">
<Package Comments="Copyright (c) 2021-2022 Swift Open Source Project" Compressed="yes" Description="Swift Developer Tools for Windows x86_64" InstallScope="perMachine" Manufacturer="swift.org" />
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package
Language="1033"
Manufacturer="swift.org"
Name="Swift Developer Tools for Windows x86_64"
UpgradeCode="5778fa7a-f1a6-4133-b4e0-fc0d9caf4544"
Version="$(var.ProductVersion)"
Scope="perMachine">
<SummaryInformation Description="Swift Developer Tools for Windows x86_64" />

<Media Id="1" Cabinet="devtools.cab" EmbedCab="yes" />
<?ifdef INCLUDE_DEBUG_INFO ?>
<Media Id="2" Cabinet="PDBs.cab" EmbedCab="yes" />
<?endif?>

<!-- Directory Structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLDIR">
<Directory Id="Developer" Name="Developer">
<Directory Id="Toolchains" Name="Toolchains">
<Directory Id="xctoolchain" Name="unknown-Asserts-development.xctoolchain">
<Directory Id="_usr" Name="usr">
<Directory Id="_usr_bin" Name="bin">
</Directory>
<Directory Id="_usr_lib" Name="lib">
<!-- FIXME(compnerd) should we include the SPM import libraries? -->
<Directory Id="_usr_lib_swift" Name="swift">
<Directory Id="_usr_lib_swift_pm" Name="pm">
<Directory Id="_usr_lib_swift_pm_ManifestAPI" Name="ManifestAPI">
</Directory>
<Directory Id="_usr_lib_swift_pm_PluginAPI" Name="PluginAPI">
</Directory>
<Directory Id="INSTALLDIR">
<Directory Id="Developer" Name="Developer">
<Directory Id="Toolchains" Name="Toolchains">
<Directory Id="xctoolchain" Name="unknown-Asserts-development.xctoolchain">
<Directory Id="_usr" Name="usr">
<Directory Id="_usr_bin" Name="bin">
</Directory>
<Directory Id="_usr_lib" Name="lib">
<!-- FIXME(compnerd) should we include the SPM import libraries? -->
<Directory Id="_usr_lib_swift" Name="swift">
<Directory Id="_usr_lib_swift_pm" Name="pm">
<Directory Id="_usr_lib_swift_pm_ManifestAPI" Name="ManifestAPI">
</Directory>
<Directory Id="_usr_lib_swift_pm_PluginAPI" Name="PluginAPI">
</Directory>
</Directory>
</Directory>
Expand All @@ -35,9 +38,7 @@
</Directory>
</Directory>

<SetDirectory Id="INSTALLDIR" Value="[WindowsVolume]Library">
NOT INSTALLDIR
</SetDirectory>
<SetDirectory Id="INSTALLDIR" Value="[WindowsVolume]Library" Condition="NOT INSTALLDIR" />

<!-- Components -->
<ComponentGroup Id="SwiftCollections">
Expand Down Expand Up @@ -222,15 +223,15 @@
</ComponentGroup>
<?endif?>

<Feature Id="DeveloperTools" Absent="disallow" AllowAdvertise="yes" ConfigurableDirectory="INSTALLDIR" Description="Swift Developer Tools for Windows x86_64" Level="1" Title="Swift Developer Tools (Windows x86_64)">
<Feature Id="DeveloperTools" AllowAbsent="no" AllowAdvertise="yes" ConfigurableDirectory="INSTALLDIR" Description="Swift Developer Tools for Windows x86_64" Level="1" Title="Swift Developer Tools (Windows x86_64)">
<ComponentGroupRef Id="SwiftCollections" />
<ComponentGroupRef Id="SwiftSystem" />
<ComponentGroupRef Id="SwiftPackageManager" />
<ComponentGroupRef Id="SourceKitLSP" />

<?ifdef INCLUDE_DEBUG_INFO ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sidebar: I wonder if we should re-consider this. The debug information would bloat the installer download to ~4G (from ~400M), and the install from ~4G to ~25G. @shahmishal I figure that you might have some thoughts on this as well. The general recommendations for this seem to be "don't do it" and to prefer to use a Symbol Server instead.

<Feature Id="DebugInfo" Absent="allow" AllowAdvertise="yes" Description="Debug Information for Swift Developer Tools for Windows x86_64" Level="0" Title="Debug Info">
<Condition Level="1">INSTALL_DEBUGINFO</Condition>
<Feature Id="DebugInfo" AllowAbsent="yes" AllowAdvertise="yes" Description="Debug Information for Swift Developer Tools for Windows x86_64" Level="0" Title="Debug Info">
<Level Value="1" Condition="INSTALL_DEBUGINFO" />
<ComponentGroupRef Id="SwiftCollectionsDebugInfo" />
<ComponentGroupRef Id="SwiftSystemDebugInfo" />
<ComponentGroupRef Id="SwiftPackageManagerDebugInfo" />
Expand All @@ -240,13 +241,13 @@
</Feature>

<UI>
<UIRef Id="WixUI_InstallDir" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
<ui:WixUI Id="WixUI_InstallDir" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2" />
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" />
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" ></Property>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
<WixVariable Id="WixUIDialogBmp" Value="Resources\swift_dialog.png" />
<WixVariable Id="WixUIBannerBmp" Value="Resources\swift_banner.png" />

</Product>
</Package>
</Wix>
63 changes: 32 additions & 31 deletions platforms/Windows/devtools-arm64.wxs
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Language="1033" Manufacturer="swift.org" Name="Swift Developer Tools for Windows aarch64" UpgradeCode="" Version="$(var.ProductVersion)">
<Package Comments="Copyright (c) 2021-2022 Swift Open Source Project" Compressed="yes" Description="Swift Developer Tools for Windows aarch64" InstallScope="perMachine" Manufacturer="swift.org" />
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package
Language="1033"
Manufacturer="swift.org"
Name="Swift Developer Tools for Windows aarch64"
UpgradeCode=""
Version="$(var.ProductVersion)"
Scope="perMachine">
<SummaryInformation Description="Swift Developer Tools for Windows aarch64" />

<Media Id="1" Cabinet="devtools.cab" EmbedCab="yes" />
<?ifdef INCLUDE_DEBUG_INFO ?>
<Media Id="2" Cabinet="PDBs.cab" EmbedCab="yes" />
<?endif?>

<!-- Directory Structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLDIR">
<Directory Id="Developer" Name="Developer">
<Directory Id="Toolchains" Name="Toolchains">
<Directory Id="xctoolchain" Name="unknown-Asserts-development.xctoolchain">
<Directory Id="_usr" Name="usr">
<Directory Id="_usr_bin" Name="bin">
</Directory>
<Directory Id="_usr_lib" Name="lib">
<!-- FIXME(compnerd) should we include the SPM import libraries? -->
<Directory Id="_usr_lib_swift" Name="swift">
<Directory Id="_usr_lib_swift_pm" Name="pm">
<Directory Id="_usr_lib_swift_pm_ManifestAPI" Name="ManifestAPI">
</Directory>
<Directory Id="_usr_lib_swift_pm_PluginAPI" Name="PluginAPI">
</Directory>
<Directory Id="INSTALLDIR">
<Directory Id="Developer" Name="Developer">
<Directory Id="Toolchains" Name="Toolchains">
<Directory Id="xctoolchain" Name="unknown-Asserts-development.xctoolchain">
<Directory Id="_usr" Name="usr">
<Directory Id="_usr_bin" Name="bin">
</Directory>
<Directory Id="_usr_lib" Name="lib">
<!-- FIXME(compnerd) should we include the SPM import libraries? -->
<Directory Id="_usr_lib_swift" Name="swift">
<Directory Id="_usr_lib_swift_pm" Name="pm">
<Directory Id="_usr_lib_swift_pm_ManifestAPI" Name="ManifestAPI">
</Directory>
<Directory Id="_usr_lib_swift_pm_PluginAPI" Name="PluginAPI">
</Directory>
</Directory>
</Directory>
Expand All @@ -35,9 +38,7 @@
</Directory>
</Directory>

<SetDirectory Id="INSTALLDIR" Value="[WindowsVolume]Library">
NOT INSTALLDIR
</SetDirectory>
<SetDirectory Id="INSTALLDIR" Value="[WindowsVolume]Library" Condition="NOT INSTALLDIR" />

<!-- Components -->
<ComponentGroup Id="SwiftCollections">
Expand Down Expand Up @@ -222,15 +223,15 @@
</ComponentGroup>
<?endif?>

<Feature Id="DeveloperTools" Absent="disallow" AllowAdvertise="yes" ConfigurableDirectory="INSTALLDIR" Description="Swift Developer Tools for Windows aarch64" Level="1" Title="Swift Developer Tools (Windows aarch64)">
<Feature Id="DeveloperTools" AllowAbsent="no" AllowAdvertise="yes" ConfigurableDirectory="INSTALLDIR" Description="Swift Developer Tools for Windows aarch64" Level="1" Title="Swift Developer Tools (Windows aarch64)">
<ComponentGroupRef Id="SwiftCollections" />
<ComponentGroupRef Id="SwiftSystem" />
<ComponentGroupRef Id="SwiftPackageManager" />
<ComponentGroupRef Id="SourceKitLSP" />

<?ifdef INCLUDE_DEBUG_INFO ?>
<Feature Id="DebugInfo" Absent="allow" AllowAdvertise="yes" Description="Debug Information for Swift Developer Tools for Windows aarch64" Level="0" Title="Debug Info">
<Condition Level="1">INSTALL_DEBUGINFO</Condition>
<Feature Id="DebugInfo" AllowAbsent="yes" AllowAdvertise="yes" Description="Debug Information for Swift Developer Tools for Windows aarch64" Level="0" Title="Debug Info">
<Level Value="1" Condition="INSTALL_DEBUGINFO" />
<ComponentGroupRef Id="SwiftCollectionsDebugInfo" />
<ComponentGroupRef Id="SwiftSystemDebugInfo" />
<ComponentGroupRef Id="SwiftPackageManagerDebugInfo" />
Expand All @@ -240,13 +241,13 @@
</Feature>

<UI>
<UIRef Id="WixUI_InstallDir" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
<ui:WixUI Id="WixUI_InstallDir" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2" />
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" />
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" ></Property>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
<WixVariable Id="WixUIDialogBmp" Value="Resources\swift_dialog.png" />
<WixVariable Id="WixUIBannerBmp" Value="Resources\swift_banner.png" />

</Product>
</Package>
</Wix>
24 changes: 5 additions & 19 deletions platforms/Windows/devtools.wixproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTarget="Build">
<Project Sdk="WixToolset.Sdk/4.0.0-rc.4">
<PropertyGroup>
<OutputName>devtools</OutputName>
<OutputType>Package</OutputType>
<ProjectGuid>0a266072-af7c-43f2-b192-dd86995c2e82</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -18,15 +14,8 @@
<PropertyGroup>
<OutputPath>build\</OutputPath>
<IntermediateOutputPath>build\obj\</IntermediateOutputPath>
<DefineSolutionProperties>false</DefineSolutionProperties>
</PropertyGroup>

<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWiXToolsetInstalled" Condition="">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see https://wixtoolset.org/releases/." />
</Target>

<Import Project="WiXCodeSigning.targets" />

<PropertyGroup>
Expand All @@ -41,13 +30,10 @@
</PropertyGroup>

<ItemGroup>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.0-rc.4" />
</ItemGroup>

<ItemGroup>
<Compile Include="devtools-$(ProductArchitecture).wxs" />
</ItemGroup>
</Project>
</Project>
19 changes: 3 additions & 16 deletions platforms/Windows/installer.wixproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Project Sdk="WixToolset.Sdk/4.0.0-rc.4">
<PropertyGroup>
<OutputName>installer</OutputName>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<OutputType>Bundle</OutputType>
<ProjectGuid>8ae3ad4d-2df4-42b7-890e-decdd5cead0b</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -21,26 +18,16 @@
<PropertyGroup>
<OutputPath>build\</OutputPath>
<IntermediateOutputPath>build\obj\</IntermediateOutputPath>
<DefineSolutionProperties>false</DefineSolutionProperties>
</PropertyGroup>

<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWiXToolsetInstalled" Condition="">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see https://wixtoolset.org/releases/." />
</Target>

<Import Project="WiXCodeSigning.targets" />

<PropertyGroup>
<DefineConstants>ProductVersion=$(ProductVersion);RequiredChain=$(RequiredChain);OptionalChain=$(OptionalChain);MSI_LOCATION=$(MSI_LOCATION);</DefineConstants>
</PropertyGroup>

<ItemGroup>
<WixExtension Include="WixBalExtension">
<HintPath>$(WixExtDir)\WixBalExtension.dll</HintPath>
<Name>WixBalExtension</Name>
</WixExtension>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.0-rc.4" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 4 additions & 5 deletions platforms/Windows/installer.wxs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<Bundle Name="Swift Developer Package for Windows x86_64" Version="$(var.ProductVersion)" Manufacturer="swift.org" UpgradeCode="8c75f32a-7bdf-4c61-abf6-c7e1c4b8fbf6">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication LicenseUrl="" LogoFile="Resources/swift.png" SuppressOptionsUI="yes" SuppressRepair="no" />
</BootstrapperApplicationRef>
<BootstrapperApplication>
<bal:WixStandardBootstrapperApplication LicenseUrl="" LogoFile="Resources/swift.png" SuppressOptionsUI="yes" SuppressRepair="no" Theme="hyperlinkLicense" />
</BootstrapperApplication>

<Chain>
<?if $(var.RequiredChain) != "" ?>
Expand Down
Loading