Skip to content

[release/6] cherry-pick Android installer changes needed to build swift 6 installer #346

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 6 commits into from
Nov 19, 2024
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
13 changes: 9 additions & 4 deletions platforms/Windows/SideBySideUpgradeStrategy.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
<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>
<WindowsSDKUpgradeCode Condition=" '$(ProductArchitecture)' == 'x86' ">{443F4D7F-38F3-47C8-9BEE-37FEB01D13C8}</WindowsSDKUpgradeCode>
<WindowsSDKUpgradeCode Condition=" '$(ProductArchitecture)' == 'amd64' ">{762D10FE-EBE5-4554-BB78-FB13A4A487E3}</WindowsSDKUpgradeCode>
<WindowsSDKUpgradeCode Condition=" '$(ProductArchitecture)' == 'arm64' ">{9749D9E6-E860-4FF6-9E8A-525270F471A3}</WindowsSDKUpgradeCode>
<AndroidSDKUpgradeCode Condition=" '$(ProductArchitecture)' == 'aarch64' ">{485f88f4-9342-48cb-853a-12da885a5818}</AndroidSDKUpgradeCode>
<AndroidSDKUpgradeCode Condition=" '$(ProductArchitecture)' == 'x86_64' ">{0838ee60-5d4a-4832-b844-73dad6eb1cc1}</AndroidSDKUpgradeCode>
<AndroidSDKUpgradeCode Condition=" '$(ProductArchitecture)' == 'armv7' ">{1269a926-3528-4ab7-b4d6-386d5c3f903a}</AndroidSDKUpgradeCode>
<AndroidSDKUpgradeCode Condition=" '$(ProductArchitecture)' == 'i686' ">{d889349b-0000-4600-a04a-93602525d5db}</AndroidSDKUpgradeCode>
</PropertyGroup>

<PropertyGroup Condition="'$(MajorMinorProductVersion)' == '0.0'">
Expand Down Expand Up @@ -52,7 +56,8 @@
DbgUpgradeCode=$(DbgUpgradeCode);
IdeUpgradeCode=$(IdeUpgradeCode);
RtlUpgradeCode=$(RtlUpgradeCode);
SdkUpgradeCode=$(SdkUpgradeCode);
WindowsSDKUpgradeCode=$(WindowsSDKUpgradeCode);
AndroidSDKUpgradeCode=$(AndroidSDKUpgradeCode);
</DefineConstants>
</PropertyGroup>
</Project>
28 changes: 28 additions & 0 deletions platforms/Windows/android_sdk/android_sdk.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="WixToolset.Sdk/4.0.1">
<PropertyGroup>
<OutputName>android_sdk.$(ProductArchitecture)</OutputName>
<Platform>x86</Platform>

<SwiftShimsPath>$(SDK_ROOT)\usr\lib\swift\shims</SwiftShimsPath>

<DefineConstants>
$(DefineConstants);
SwiftShimsPath=$(SwiftShimsPath);
</DefineConstants>
</PropertyGroup>

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

<ItemGroup>
<HarvestDirectory Include="$(SwiftShimsPath)">
<ComponentGroupName>SwiftShims</ComponentGroupName>
<DirectoryRefId>AndroidSDK_usr_lib_swift_shims</DirectoryRefId>
<PreprocessorVariable>var.SwiftShimsPath</PreprocessorVariable>
<SuppressCom>true</SuppressCom>
<SuppressRegistry>true</SuppressRegistry>
<SuppressRootDirectory>true</SuppressRootDirectory>
</HarvestDirectory>
</ItemGroup>
</Project>
1,230 changes: 1,230 additions & 0 deletions platforms/Windows/android_sdk/android_sdk.wxs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions platforms/Windows/bld/bld.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
DEVTOOLS_ROOT=$(DEVTOOLS_ROOT);
TOOLCHAIN_ROOT=$(TOOLCHAIN_ROOT);
TOOLCHAIN_ROOT_USR_LIB_CLANG=$(TOOLCHAIN_ROOT)\usr\lib\clang;
TOOLCHAIN_ROOT_USR_LIB_SWIFT_CLANG=$(TOOLCHAIN_ROOT)\usr\lib\swift\clang;
</DefineConstants>
</PropertyGroup>

Expand All @@ -22,4 +23,15 @@
<SuppressRootDirectory>true</SuppressRootDirectory>
</HarvestDirectory>
</ItemGroup>

<ItemGroup>
<HarvestDirectory Include="$(TOOLCHAIN_ROOT)\usr\lib\swift\clang">
<ComponentGroupName>SwiftClangResources</ComponentGroupName>
<DirectoryRefId>_usr_lib_swift_clang</DirectoryRefId>
<PreprocessorVariable>var.TOOLCHAIN_ROOT_USR_LIB_SWIFT_CLANG</PreprocessorVariable>
<SuppressCom>true</SuppressCom>
<SuppressRegistry>true</SuppressRegistry>
<SuppressRootDirectory>true</SuppressRootDirectory>
</HarvestDirectory>
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions platforms/Windows/bld/bld.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@
<ComponentGroupRef Id="TestingMacros" />

<ComponentGroupRef Id="ClangResources" />
<ComponentGroupRef Id="SwiftClangResources" />

<ComponentGroupRef Id="EnvironmentVariables" />
<ComponentGroupRef Id="VersionedDirectoryCleanup" />
Expand Down
20 changes: 20 additions & 0 deletions platforms/Windows/bundle/installer.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
$(DefineConstants);
INCLUDE_X86_SDK=$(INCLUDE_X86_SDK);
INCLUDE_ARM64_SDK=$(INCLUDE_ARM64_SDK);
ANDROID_INCLUDE_ARM64_SDK=$(ANDROID_INCLUDE_ARM64_SDK);
ANDROID_INCLUDE_x86_64_SDK=$(ANDROID_INCLUDE_x86_64_SDK);
ANDROID_INCLUDE_ARM_SDK=$(ANDROID_INCLUDE_ARM_SDK);
ANDROID_INCLUDE_X86_SDK=$(ANDROID_INCLUDE_X86_SDK);
</DefineConstants>
</PropertyGroup>

Expand All @@ -31,4 +35,20 @@
<ItemGroup Condition=" '$(INCLUDE_ARM64_SDK)' != '' ">
<ProjectReference Include="..\sdk\sdk.wixproj" Properties="ProductArchitecture=arm64;Platform=x86" BindName="sdk_arm64" />
</ItemGroup>

<ItemGroup Condition=" '$(ANDROID_INCLUDE_ARM64_SDK)' != '' ">
<ProjectReference Include="..\android_sdk\android_sdk.wixproj" Properties="ProductArchitecture=aarch64;Platform=x86" BindName="android_sdk_aarch64" />
</ItemGroup>

<ItemGroup Condition=" '$(ANDROID_INCLUDE_x86_64_SDK)' != '' ">
<ProjectReference Include="..\android_sdk\android_sdk.wixproj" Properties="ProductArchitecture=x86_64;Platform=x86" BindName="android_sdk_x86_64" />
</ItemGroup>

<ItemGroup Condition=" '$(ANDROID_INCLUDE_ARM_SDK)' != '' ">
<ProjectReference Include="..\android_sdk\android_sdk.wixproj" Properties="ProductArchitecture=armv7;Platform=x86" BindName="android_sdk_armv7" />
</ItemGroup>

<ItemGroup Condition=" '$(ANDROID_INCLUDE_X86_SDK)' != '' ">
<ProjectReference Include="..\android_sdk\android_sdk.wixproj" Properties="ProductArchitecture=i686;Platform=x86" BindName="android_sdk_i686" />
</ItemGroup>
</Project>
40 changes: 40 additions & 0 deletions platforms/Windows/bundle/installer.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
<Variable Name="OptionsInstallRedistAMD64" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallSdkArm64" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallRedistArm64" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallAndroidSdkArm64" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallAndroidSdkAMD64" bal:Overridable="yes" Persisted="yes" Value="1" />
<Variable Name="OptionsInstallAndroidSdkArm" bal:Overridable="yes" Persisted="yes" Value="0" />
<Variable Name="OptionsInstallAndroidSdkX86" bal:Overridable="yes" Persisted="yes" Value="0" />

<!--
For the online bundle, we need to provide a download URL for each package and its .cabs.
Expand Down Expand Up @@ -119,6 +123,42 @@
<MsiProperty Name="INSTALLREDIST" Value="[OptionsInstallRedistArm64]" />
</MsiPackage>
<?endif?>

<?if $(ANDROID_INCLUDE_ARM64_SDK) == true ?>
<MsiPackage
SourceFile="!(bindpath.android_sdk_aarch64)\android_sdk.aarch64.msi"
InstallCondition="OptionsInstallAndroidSdkArm64"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>
<?endif?>

<?if $(ANDROID_INCLUDE_x86_64_SDK) == true ?>
<MsiPackage
SourceFile="!(bindpath.android_sdk_x86_64)\android_sdk.x86_64.msi"
InstallCondition="OptionsInstallAndroidSdkAMD64"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>
<?endif?>

<?if $(ANDROID_INCLUDE_ARM_SDK) == true ?>
<MsiPackage
SourceFile="!(bindpath.android_sdk_armv7)\android_sdk.armv7.msi"
InstallCondition="OptionsInstallAndroidSdkArm"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>
<?endif?>

<?if $(ANDROID_INCLUDE_X86_SDK) == true ?>
<MsiPackage
SourceFile="!(bindpath.android_sdk_i686)\android_sdk.i686.msi"
InstallCondition="OptionsInstallAndroidSdkX86"
DownloadUrl="$(BaseReleaseDownloadUrl)/{2}">
<MsiProperty Name="INSTALLROOT" Value="[InstallRoot]" />
</MsiPackage>
<?endif?>
</Chain>
</Bundle>
</Wix>
8 changes: 6 additions & 2 deletions platforms/Windows/bundle/theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<Font Id="2" Height="-22" Weight="500" Foreground="graytext">Segoe UI</Font>
<Font Id="3" Height="-12" Weight="500" Foreground="windowtext" Background="window">Segoe UI</Font>

<Window Width="614" Height="384" HexStyle="100a0000" FontId="0" Caption="#(loc.Caption)">
<ImageControl X="0" Y="0" Width="165" Height="384" ImageFile="swift_side.png"/>
<Window Width="614" Height="456" HexStyle="100a0000" FontId="0" Caption="#(loc.Caption)">
<ImageControl X="0" Y="0" Width="165" Height="456" ImageFile="swift_side.png"/>
<Label X="176" Y="11" Width="-11" Height="32" FontId="1" DisablePrefix="yes">#(loc.Title)</Label>

<Page Name="Help">
Expand Down Expand Up @@ -67,6 +67,10 @@
<Checkbox Name="OptionsInstallRedistArm64" X="194" Y="285" Width="-11" Height="17" TabStop="yes" FontId="3" EnableCondition="OptionsInstallSdkArm64">#(loc.Redist_arm64)</Checkbox>
<Checkbox Name="OptionsInstallSdkX86" X="176" Y="303" Width="-11" Height="17" TabStop="yes" FontId="3">#(loc.Sdk_ProductName_x86)</Checkbox>
<Checkbox Name="OptionsInstallRedistX86" X="194" Y="321" Width="-11" Height="17" TabStop="yes" FontId="3" EnableCondition="OptionsInstallSdkX86">#(loc.Redist_x86)</Checkbox>
<Checkbox Name="OptionsInstallAndroidSdkArm64" X="176" Y="339" Width="-11" Height="17" TabStop="yes" FontId="3">#(loc.Android_Sdk_arm64)</Checkbox>
<Checkbox Name="OptionsInstallAndroidSdkAMD64" X="176" Y="357" Width="-11" Height="17" TabStop="yes" FontId="3">#(loc.Android_Sdk_amd64)</Checkbox>
<Checkbox Name="OptionsInstallAndroidSdkArm" X="176" Y="375" Width="-11" Height="17" TabStop="yes" FontId="3">#(loc.Android_Sdk_arm)</Checkbox>
<Checkbox Name="OptionsInstallAndroidSdkX86" X="176" Y="393" Width="-11" Height="17" TabStop="yes" FontId="3">#(loc.Android_Sdk_x86)</Checkbox>

<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.OptionsOkButton)</Text>
Expand Down
4 changes: 2 additions & 2 deletions platforms/Windows/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ Note that these GUIDs are substituted at bind time so they skip the normal valid

| Property | Description |
| -------- | ----------- |
| BldUpgradeCode, CliUpgradeCode, DbgUpgradeCode, IdeUpgradeCode, RtlUpgradeCode, SdkUpgradeCode | Upgrade codes for individual packages. Packages keep the same upgrade codes "forever" because MSI lets you specify version ranges for upgrades, which you can find in `shared/shared.wxs`. |
| BldUpgradeCode, CliUpgradeCode, DbgUpgradeCode, IdeUpgradeCode, RtlUpgradeCode, WindowsSDKUpgradeCode, AndroidSDKUpgradeCode | Upgrade codes for individual packages. Packages keep the same upgrade codes "forever" because MSI lets you specify version ranges for upgrades, which you can find in `shared/shared.wxs`. |
| BundleUpgradeCode | Upgrade codes for the bundle. 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 through v5.10.9999). You can keep the history of upgrade codes using a condition like `Condition="'$(MajorMinorProductVersion)' == '5.10'` or just replace BundleUpgradeCode when forking to a new minor version. |


Expand All @@ -227,7 +227,7 @@ Note that these GUIDs are substituted at bind time so they skip the normal valid
To support side-by-side installation for each minor release (the latest point release of each minor release), we need to use "old-school" `Upgrade`/`UpgradeVersion` authoring to get the upgrade version ranges, which also requires manually scheduling `RemoveExistingProducts`. (We can no longer use WiX's `MajorUpgrade` element because it's intended to support the way-more-common case of upgrading every version.) To avoid duplication, the upgrade logic is authored in `shared\shared.wxs` and referenced from the `Package` element of each package:

```xml
<WixVariable Id="SideBySidePackageUpgradeCode" Value="$(SdkUpgradeCode)" />
<WixVariable Id="SideBySidePackageUpgradeCode" Value="$(WindowsSDKUpgradeCode)" />
<FeatureGroupRef Id="SideBySideUpgradeStrategy" />
```

Expand Down
4 changes: 2 additions & 2 deletions platforms/Windows/sdk/sdk.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
Language="1033"
Manufacturer="!(loc.ManufacturerName)"
Name="!(loc.Sdk_ProductName_$(ProductArchitecture))"
UpgradeCode="$(SdkUpgradeCode)"
UpgradeCode="$(WindowsSDKUpgradeCode)"
Version="$(NonSemVerProductVersion)"
Scope="$(PackageScope)">

<Media Id="1" Cabinet="sdk.$(ProductArchitecture).cab" EmbedCab="$(ArePackageCabsEmbedded)" />

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

<!--
Expand Down
4 changes: 3 additions & 1 deletion platforms/Windows/shared/shared.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
<Directory Id="_usr_include" Name="include" />
<Directory Id="_usr_lib" Name="lib">
<Directory Id="_usr_lib_clang" Name="clang" />
<Directory Id="_usr_lib_swift" Name="swift" />
<Directory Id="_usr_lib_swift" Name="swift">
<Directory Id="_usr_lib_swift_clang" Name="clang" />
</Directory>
</Directory>
<Directory Id="_usr_share" Name="share">
<Directory Id="_usr_share_docc" Name="docc">
Expand Down
4 changes: 4 additions & 0 deletions platforms/Windows/shared/swift.en-us.wxl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<String Id="Sdk_ProductName_arm64" Value="Swift Windows SDK (ARM64)" />
<String Id="Sdk_ProductName_amd64" Value="Swift Windows SDK (AMD64)" />
<String Id="Sdk_ProductName_x86" Value="Swift Windows SDK (X86)" />
<String Id="Android_Sdk_arm64" Value="Swift Android SDK (ARM64)" />
<String Id="Android_Sdk_amd64" Value="Swift Android SDK (AMD64)" />
<String Id="Android_Sdk_arm" Value="Swift Android SDK (ARM)" />
<String Id="Android_Sdk_x86" Value="Swift Android SDK (X86)" />
<String Id="BundleName" Value="Swift Developer Toolkit" />
<String Id="ManufacturerName" Value="swift.org" />

Expand Down