Skip to content

Per user bundle and side-by-side upgrade support #224

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 26 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
72901be
Rename Runtime to Rtl and hierarchicalize.
barnson Aug 9, 2023
b77fbcd
Per-user packages
barnson Aug 10, 2023
39fa868
Implement new per-user bundle:
barnson Aug 10, 2023
0986850
Fix references and arch-specific ids...
barnson Aug 11, 2023
c8b4684
Simplify side-by-side support authoring.
barnson Aug 14, 2023
a025a71
Move merge modules and remove test authoring.
barnson Aug 15, 2023
5742969
More cleanup and test scripts.
barnson Aug 15, 2023
6327281
WiX: adjust some product description strings (NFC)
compnerd Aug 17, 2023
f6e716f
Rename Runtime to Rtl and hierarchicalize.
barnson Aug 9, 2023
0c5cf66
Per-user packages
barnson Aug 10, 2023
088abce
Implement new per-user bundle:
barnson Aug 10, 2023
fa7d18b
Fix references and arch-specific ids...
barnson Aug 11, 2023
e21f4fd
Simplify side-by-side support authoring.
barnson Aug 14, 2023
886a459
Move merge modules and remove test authoring.
barnson Aug 15, 2023
9cefd5e
More cleanup and test scripts.
barnson Aug 15, 2023
c2a0501
Merge branch 'PerUserBundle' of https://github.com/barnson/swift-inst…
barnson Aug 18, 2023
540d909
Requested changes:
barnson Aug 18, 2023
1bcde72
Build three host-architecture SDK packages.
barnson Aug 19, 2023
d00ef2b
For consistency, use loc string for Manufacturer.
barnson Aug 21, 2023
e4008ae
Use ProductArchitecture to get product names.
barnson Aug 21, 2023
968f96c
Move versioned "root" under the Top Five.
barnson Aug 18, 2023
d8dbe7b
Remove old directory tree.
barnson Aug 21, 2023
5e07902
Improve side-by-side versioned directory behavior.
barnson Aug 22, 2023
4052b27
Clean up and add test collateral.
barnson Aug 22, 2023
38aa892
Disable Arm64 for now.
barnson Aug 22, 2023
ed7dcf7
Conditionalize x86 and Arm64 SDKs.
barnson Aug 22, 2023
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
69 changes: 58 additions & 11 deletions platforms/Windows/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
<Project>
<PropertyGroup>
<ProductArchitecture Condition=" '$(ProductArchitecture)' == '' ">amd64</ProductArchitecture>
<ProductArchitecture>$(ProductArchitecture)</ProductArchitecture>

<ProductVersion Condition=" '$(ProductVersion)' == '' ">0.0.0</ProductVersion>
<ProductVersion>$(ProductVersion)</ProductVersion>
</PropertyGroup>

<PropertyGroup>
<NonSemVerProductVersion>$([System.Text.RegularExpressions.Regex]::Replace($(ProductVersion), `[-+].*`, ``))</NonSemVerProductVersion>
<MajorMinorProductVersion>$([System.Text.RegularExpressions.Regex]::Match($(NonSemVerProductVersion), `\d+\.\d+`))</MajorMinorProductVersion>
<MajorMinorProductVersion Condition="'$(MajorMinorProductVersion)' == ''">$(NonSemVerProductVersion)</MajorMinorProductVersion>
</PropertyGroup>

<Import Project="SideBySideUpgradeStrategy.props" />

<PropertyGroup Condition=" '$(ProductArchitecture)' == 'amd64' ">
<Platform>x64</Platform>
</PropertyGroup>
Expand All @@ -24,34 +29,76 @@
<PropertyGroup>
<RootBuildFolder>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)build\))</RootBuildFolder>
<BaseOutputPath>$(RootBuildFolder)</BaseOutputPath>
<BaseOutputPath Condition="!HasTrailingSlash('$(BaseOutputPath)')">$(BaseOutputPath)\</BaseOutputPath>
<BaseIntermediateOutputPath>$(BaseOutputPath)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<OutputPath>$(BaseOutputPath)$(Configuration)\$(ProductArchitecture)\</OutputPath>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)' == ''">$(BaseIntermediateOutputPath)$(ProductArchitecture)\$(Configuration)\</IntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)' == ''">$(BaseOutputPath)$(Configuration)\$(ProductArchitecture)\</OutputPath>

<DefaultCompressionLevel Condition="'$(DefaultCompressionLevel)' == ''">high</DefaultCompressionLevel>
<BundleFlavor Condition="'$(BundleFlavor)' == ''">online</BundleFlavor>
</PropertyGroup>

<PropertyGroup>
<PackageScope>perMachine</PackageScope>
<!--
ICE38 is about mixing per-user and per-machine resources (not a thing for us).
ICE61 is a warning about allowing "same-version" major upgrades, something we want.
ICE64 is documented as not being an issue when packages are always per-user.
ICE91 is about "roaming scenarios," which doesn't apply to our use of LocalAppDataFolder.
-->
<SuppressIces>ICE38;ICE61;ICE64;ICE91</SuppressIces>
<PackageScope>perUser</PackageScope>
</PropertyGroup>

<!-- High package and high bundle compression results in the smallest bundle, at the cost of build time. -->
<PropertyGroup Condition="'$(BundleFlavor)' == 'offline'">
<PackageCompressionLevel>high</PackageCompressionLevel>
<ArePackageCabsEmbedded>false</ArePackageCabsEmbedded>

<IsBundleCompressed>true</IsBundleCompressed>
<BundleCompressionLevel>high</BundleCompressionLevel>
</PropertyGroup>

<PropertyGroup Condition="'$(BundleFlavor)' == 'online'">
<PackageCompressionLevel>high</PackageCompressionLevel>
<ArePackageCabsEmbedded>false</ArePackageCabsEmbedded>

<IsBundleCompressed>false</IsBundleCompressed>
<BundleCompressionLevel>high</BundleCompressionLevel>
</PropertyGroup>

<Import Project="$(USERNAME).props" Condition="Exists('$(USERNAME).props')" />

<PropertyGroup Condition=" '$(ProductArchitecture)' == 'x86' ">
<PLATFORM_ROOT>$(PLATFORM_ROOT_X86)</PLATFORM_ROOT>
<SDK_ROOT>$(SDK_ROOT_X86)</SDK_ROOT>
</PropertyGroup>

<PropertyGroup Condition=" '$(ProductArchitecture)' == 'amd64' ">
<PLATFORM_ROOT>$(PLATFORM_ROOT_AMD64)</PLATFORM_ROOT>
<SDK_ROOT>$(SDK_ROOT_AMD64)</SDK_ROOT>
</PropertyGroup>

<PropertyGroup Condition=" '$(ProductArchitecture)' == 'arm64' ">
<PLATFORM_ROOT>$(PLATFORM_ROOT_ARM64)</PLATFORM_ROOT>
<SDK_ROOT>$(SDK_ROOT_ARM64)</SDK_ROOT>
</PropertyGroup>

<PropertyGroup>
<DefaultCompressionLevel Condition="'$(DefaultCompressionLevel)' == ''">$(PackageCompressionLevel)</DefaultCompressionLevel>

<DefineConstants>
$(DefineConstants);
ProductArchitecture=$(ProductArchitecture);
ProductVersion=$(ProductVersion);
MajorMinorProductVersion=$(MajorMinorProductVersion);
PackageScope=$(PackageScope);
IsBundleCompressed=$(IsBundleCompressed);
ArePackageCabsEmbedded=$(ArePackageCabsEmbedded);
BaseReleaseDownloadUrl=$(BaseReleaseDownloadUrl);
SDK_ROOT=$(SDK_ROOT);
PLATFORM_ROOT=$(PLATFORM_ROOT);
</DefineConstants>
</PropertyGroup>

<PropertyGroup >
<PackageScope>perMachine</PackageScope>
<IsBundleCompressed>true</IsBundleCompressed>
</PropertyGroup>

<PropertyGroup>
<HarvestNoLogo>true</HarvestNoLogo>
<HarvestAutogenerateGuids>true</HarvestAutogenerateGuids>
Expand Down
6 changes: 5 additions & 1 deletion platforms/Windows/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ItemGroup Condition="'$(MSBuildProjectName)' != 'shared' AND '$(MSBuildProjectName)' != 'runtimelib'">
<ItemGroup Condition="'$(MSBuildProjectName)' != 'shared' AND '$(MSBuildProjectName)' != 'sdk' AND '$(MSBuildProjectName)' != 'rtllib' AND '$(MSBuildProjectName)' != 'rtlmsm'">
<ProjectReference Include="$(MSBuildThisFileDirectory)shared\shared.wixproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.1" />
</ItemGroup>

<Import Project="WiXCodeSigning.targets" />
</Project>
50 changes: 50 additions & 0 deletions platforms/Windows/SideBySideUpgradeStrategy.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!--
Note that these GUIDs are substituted at bind time so they skip the normal
validation and cleanup that the compiler does and therefore must be
"proper" GUIDs:
- Uppercase
- Surrounded by curly braces
Packages keep the same upgrade codes "forever" because MSI lets you specify
version ranges for upgrades, which you can find in shared/shared.wxs.
Bundles don't support upgrade version ranges, so the bundle upgrade code
must change for every minor version _and_ stay the same for the entire
lifetime of that minor version (e.g., v5.10.0 thropugh v5.10.9999).
-->

<PropertyGroup>
<BldUpgradeCode>{7E95DC06-7F84-4E8E-A038-8304AF0468FB}</BldUpgradeCode>
<CliUpgradeCode>{87019842-3F3E-4227-B5C5-23A8EF72AD89}</CliUpgradeCode>
<DbgUpgradeCode>{91D382AF-1E92-44DC-A4AD-AEE91C1B5160}</DbgUpgradeCode>
<IdeUpgradeCode>{8DD91C86-D13D-490B-B06B-9522A9CF504C}</IdeUpgradeCode>
<RtlUpgradeCode>{BEA8C6DC-F73E-445B-9486-2333D1CF2886}</RtlUpgradeCode>
<SdkUpgradeCode Condition=" '$(ProductArchitecture)' == 'x86' ">{443F4D7F-38F3-47C8-9BEE-37FEB01D13C8}</SdkUpgradeCode>
<SdkUpgradeCode Condition=" '$(ProductArchitecture)' == 'amd64' ">{762D10FE-EBE5-4554-BB78-FB13A4A487E3}</SdkUpgradeCode>
<SdkUpgradeCode Condition=" '$(ProductArchitecture)' == 'arm64' ">{9749D9E6-E860-4FF6-9E8A-525270F471A3}</SdkUpgradeCode>
</PropertyGroup>

<PropertyGroup Condition="'$(MajorMinorProductVersion)' == '0.0'">
<BundleUpgradeCode>{963BE094-A046-47B3-83B2-BEBE92859D39}</BundleUpgradeCode>
</PropertyGroup>

<PropertyGroup Condition="'$(MajorMinorProductVersion)' == '5.9'">
<BundleUpgradeCode>{710F1827-DA4A-4BF4-BDCE-D5F2D7C0DEF2}</BundleUpgradeCode>
</PropertyGroup>

<PropertyGroup>
<DefineConstants>
$(DefineConstants);
BundleUpgradeCode=$(BundleUpgradeCode);
BldUpgradeCode=$(BldUpgradeCode);
CliUpgradeCode=$(CliUpgradeCode);
DbgUpgradeCode=$(DbgUpgradeCode);
IdeUpgradeCode=$(IdeUpgradeCode);
RtlUpgradeCode=$(RtlUpgradeCode);
SdkUpgradeCode=$(SdkUpgradeCode);
</DefineConstants>
</PropertyGroup>
</Project>
18 changes: 9 additions & 9 deletions platforms/Windows/bld/bld.wxs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package
Language="1033"
Manufacturer="swift.org"
Manufacturer="!(loc.ManufacturerName)"
Name="!(loc.Bld_ProductName)"
UpgradeCode="7e95dc06-7f84-4e8e-a038-8304af0468fb"
UpgradeCode="$(BldUpgradeCode)"
Version="$(ProductVersion)"
Scope="$(PackageScope)">

<Media Id="1" Cabinet="bld.cab" EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
<Media Id="1" Cabinet="bld.cab" EmbedCab="$(ArePackageCabsEmbedded)" />

<WixVariable Id="SideBySidePackageUpgradeCode" Value="$(BldUpgradeCode)" />
<FeatureGroupRef Id="SideBySideUpgradeStrategy" />

<DirectoryRef Id="_usr_include">
<Directory Id="_usr_include_llvm_c" Name="llvm-c" />
Expand Down Expand Up @@ -324,11 +326,8 @@
</ComponentGroup>

<ComponentGroup Id="EnvironmentVariables">
<Component Id="SystemEnvironmentVariables" Condition="ALLUSERS=1" Directory="INSTALLDIR" Guid="d01ea5b8-0f8a-4388-9b61-1186efddfc39">
<Environment Id="SystemPath" Action="set" Name="Path" Part="last" Permanent="no" System="yes" Value="[_usr_bin]" />
</Component>
<Component Id="UserEnvironmentVariables" Condition="NOT ALLUSERS=1" Directory="INSTALLDIR" Guid="ab52b870-23ee-42e8-9581-3fcbdfb9228c">
<Environment Id="UserPath" Action="set" Name="Path" Part="last" Permanent="no" System="no" Value="[_usr_bin]" />
<Component Id="UserPathVariable" Condition="NOT ALLUSERS=1" Directory="_usr_bin" Guid="ab52b870-23ee-42e8-9581-3fcbdfb9228c">
<Environment Action="set" Name="Path" Part="last" Permanent="no" System="no" Value="[_usr_bin]" />
</Component>
</ComponentGroup>

Expand All @@ -347,6 +346,7 @@
<ComponentGroupRef Id="ClangResources" />

<ComponentGroupRef Id="EnvironmentVariables" />
<ComponentGroupRef Id="VersionedDirectoryCleanup" />
</Feature>
</Package>
</Wix>
24 changes: 23 additions & 1 deletion platforms/Windows/bundle/installer.wixproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
<Project Sdk="WixToolset.Sdk/4.0.1">
<PropertyGroup>
<OutputType>Bundle</OutputType>
<DefineConstants>$(DefineConstants);MSI_LOCATION=$(MSI_LOCATION);</DefineConstants>
<DefaultCompressionLevel>$(BundleCompressionLevel)</DefaultCompressionLevel>
<DefineConstants>
$(DefineConstants);
INCLUDE_X86_SDK=$(INCLUDE_X86_SDK);
INCLUDE_ARM64_SDK=$(INCLUDE_ARM64_SDK);
</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\bld\bld.wixproj" BindName="bld" />
<ProjectReference Include="..\cli\cli.wixproj" BindName="cli" />
<ProjectReference Include="..\dbg\dbg.wixproj" BindName="dbg" />
<ProjectReference Include="..\ide\ide.wixproj" BindName="ide" />
<ProjectReference Include="..\rtl\msi\rtlmsi.wixproj" BindName="rtl" />
<ProjectReference Include="..\sdk\sdk.wixproj" Properties="ProductArchitecture=amd64;Platform=x86" BindName="sdk_amd64" />
</ItemGroup>

<ItemGroup Condition=" '$(INCLUDE_X86_SDK)' != '' ">
<ProjectReference Include="..\sdk\sdk.wixproj" Properties="ProductArchitecture=x86;Platform=x86" BindName="sdk_x86" />
</ItemGroup>

<ItemGroup Condition=" '$(INCLUDE_ARM64_SDK)' != '' ">
<ProjectReference Include="..\sdk\sdk.wixproj" Properties="ProductArchitecture=arm64;Platform=x86" BindName="sdk_arm64" />
</ItemGroup>
</Project>
121 changes: 104 additions & 17 deletions platforms/Windows/bundle/installer.wxs
Original file line number Diff line number Diff line change
@@ -1,31 +1,118 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<Bundle
Name="!(loc.BundleName)"
Name="!(loc.BundleName) $(ProductVersion)"
Version="$(ProductVersion)"
Manufacturer="swift.org"
Manufacturer="!(loc.ManufacturerName)"
Compressed="$(IsBundleCompressed)"
UpgradeCode="710F1827-DA4A-4BF4-BDCE-D5F2D7C0DEF2">
UpgradeCode="$(BundleUpgradeCode)">

<!-- This bundle should also upgrade the "old" bundles. -->
<RelatedBundle Id="8c75f32a-7bdf-4c61-abf6-c7e1c4b8fbf6" Action="upgrade" />
<RelatedBundle Id="151d42d9-8877-4b72-ac62-4695243a35c1" Action="upgrade" />
<!-- Avoid spaces in log file names, for ease of log spelunking. -->
<Log Prefix="SwiftToolKit_$(ProductVersion)" />

<BootstrapperApplication>
<bal:WixStandardBootstrapperApplication
LicenseUrl="https://www.swift.org/LICENSE.txt"
LogoFile="swift.png"
SuppressOptionsUI="yes"
SuppressRepair="no"
Theme="hyperlinkLicense" />
Theme="hyperlinkSidebarLicense"
LocalizationFile="..\shared\swift.en-us.wxl"
ThemeFile="theme.xml" />
<Payload SourceFile="swift_side.png" />
</BootstrapperApplication>

<!--
Keep `InstallRoot` in sync with the INSTALLROOT definition in shared.wxs.
The bundle variable here will overwrite the default authored in the MSI
packages, but avoid the confusion if the default directory should change.
-->
<Variable Name="InstallRoot" bal:Overridable="yes" Type="formatted" Persisted="yes"
Value="[LocalAppDataFolder]Programs\Swift" />
<Variable Name="OptionsInstallBld" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallCli" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallDbg" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallIde" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallRtl" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallSdkX86" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallSdkAMD64" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallSdkArm64" bal:Overridable="yes" Persisted="yes" Value="1" />

<!--
For the online bundle, we need to provide a download URL for each package and its .cabs.
(The SourceFile attribute is also required, both for the offline bundle and for Burn
to get the hash of the packages. Note that the packages and .cabs available for
download must exactly match the ones used when building the bundle. Burn validates
downloads by their hashes.)

`BaseReleaseDownloadUrl` is a preprocessor variable that provides the URL to the
directory containing the packages for that bundle. So, for example, for the bundle at:

https://download.swift.org/swift-5.8.1-release/windows10/swift-5.8.1-RELEASE/swift-5.8.1-RELEASE-windows10.exe

`BaseReleaseDownloadUrl` would be `https://download.swift.org/swift-5.8.1-release/windows10/swift-5.8.1-RELEASE`.

`{2}` is the file name of the payload.

Schema doc is at https://wixtoolset.org/docs/schema/wxs/msipackage/.
-->

<Chain>
<MsiPackage SourceFile="$(MSI_LOCATION)\runtime.msi" />
<MsiPackage SourceFile="$(MSI_LOCATION)\bld.msi" />
<MsiPackage SourceFile="$(MSI_LOCATION)\cli.msi" />
<MsiPackage SourceFile="$(MSI_LOCATION)\dbg.msi" />
<MsiPackage SourceFile="$(MSI_LOCATION)\ide.msi" />
<MsiPackage SourceFile="$(MSI_LOCATION)\sdk.msi" />
</Chain>
<MsiPackage
SourceFile="!(bindpath.rtl)\rtl.msi"
InstallCondition="OptionsInstallRtl"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>

<MsiPackage
SourceFile="!(bindpath.bld)\bld.msi"
InstallCondition="OptionsInstallBld"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>

<MsiPackage
SourceFile="!(bindpath.cli)\cli.msi"
InstallCondition="OptionsInstallCli"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>

<MsiPackage
SourceFile="!(bindpath.dbg)\dbg.msi"
InstallCondition="OptionsInstallDbg"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>

<MsiPackage
SourceFile="!(bindpath.ide)\ide.msi"
InstallCondition="OptionsInstallIde"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>

<?if $(INCLUDE_X86_SDK) == true?>
<MsiPackage
SourceFile="!(bindpath.sdk_x86)\sdk.x86.msi"
InstallCondition="OptionsInstallSdkX86"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>
<?endif?>

<MsiPackage
SourceFile="!(bindpath.sdk_amd64)\sdk.amd64.msi"
InstallCondition="OptionsInstallSdkAMD64"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>

<?if $(INCLUDE_ARM64_SDK) == true ?>
<MsiPackage
SourceFile="!(bindpath.sdk_arm64)\sdk.arm64.msi"
InstallCondition="OptionsInstallSdkArm64"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>
<?endif?>
</Chain>
</Bundle>
</Wix>
Binary file removed platforms/Windows/bundle/swift.png
Binary file not shown.
Binary file added platforms/Windows/bundle/swift_side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading