Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Create WindowsDesktop sharedfx bundle installer (#7540)
Browse files Browse the repository at this point in the history
* Copy ExecWithRetries from BuildTools

Adds working dir, log importance to ExecWithRetries. Also Inline attemptMessage and add log importance comment.

* Add WindowsDesktop sfx bundle installer, refactor

Adds bundle creation support to the packaging-tools, and factors the framework pack and runtime WiX files into a single, more flexible, "product" set of WiX files.

The old MSI generation directory is removed entirely: with the new "product" WiX files, the host and hostfxr MSI creation can move to the new system. The VS insertion nupkg generation code is also ported from PowerShell to MSBuild to fit the new system.

The old system is still used for some macOS pkgs and the macOS bundle installer, some Debian/RPM packages, and some tarballs/zips.
  • Loading branch information
dagood authored Aug 2, 2019
1 parent 1919a0d commit ccf0024
Show file tree
Hide file tree
Showing 94 changed files with 2,218 additions and 1,150 deletions.
13 changes: 7 additions & 6 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
<NETCoreAppMaximumVersion>$(MajorVersion).$(MinorVersion)</NETCoreAppMaximumVersion>
</PropertyGroup>

<!-- Common target to find all sfxproj. In a target to avoid evaluating for every project. -->
<Target Name="GetSharedFrameworkProjects">
<ItemGroup>
<SharedFrameworkProject Include="$(SourceDir)pkg\projects\**\*.sfxproj" />
</ItemGroup>
</Target>

<!--
Arcade SDK versioning is defined by static properties in a targets file: work around this by
moving properties based on versioning into a target.
Expand Down Expand Up @@ -223,10 +230,4 @@
</PropertyGroup>
</Target>

<Target Name="GetBundleDisplayVersion">
<PropertyGroup>
<BundleDisplayVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion).$(BuildNumberMajor)</BundleDisplayVersion>
</PropertyGroup>
</Target>

</Project>
11 changes: 11 additions & 0 deletions Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,24 @@
<ProjectToBuild Include="@(PkgprojProjectToBuild)" />
</ItemGroup>

<ItemGroup>
<SubsetName
Include="Bundle"
Description="The shared framework bundle installer projects. Produces .exe installers for Windows." />
</ItemGroup>
<ItemGroup Condition="'$(SubsetToLower)' == '' or $(SubsetToLower.Contains('bundle'))">
<BundleProjectToBuild Include="$(RepoRoot)src\pkg\projects\**\*.bundleproj" SignPhase="BundleInstallerFiles" />
<ProjectToBuild Include="@(BundleProjectToBuild)" />
</ItemGroup>

<ItemGroup>
<SubsetName
Include="Installer"
Description="Generates additional installers. This produces the shared frameworks and their installers." />
</ItemGroup>
<ItemGroup Condition="'$(SubsetToLower)' == '' or $(SubsetToLower.Contains('installer'))">
<InstallerProjectToBuild Include="$(RepoRoot)src\pkg\packaging\installers.proj" />
<InstallerProjectToBuild Include="$(RepoRoot)src\pkg\packaging\vs-insertion-packages.proj" />
<ProjectToBuild Include="@(InstallerProjectToBuild)" />
</ItemGroup>

Expand Down
11 changes: 9 additions & 2 deletions eng/Signing.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
Arcade's Sign.proj multiple times for different sets of files as the build progresses.
-->
<ItemsToSign Remove="@(ItemsToSign)" />

<!-- Find bundle artifacts, which need multiple stages to fully sign. -->
<BundleInstallerEngineArtifact Include="$(ArtifactsPackagesDir)**/*engine.exe" />
<BundleInstallerExeArtifact Include="$(ArtifactsPackagesDir)**/*.exe" />
</ItemGroup>

<ItemGroup Condition="'$(SignBinaries)' == 'true'">
Expand All @@ -38,11 +42,14 @@
</ItemGroup>

<ItemGroup Condition="'$(SignBurnEngineFiles)' == 'true'">
<ItemsToSign Include="$(ArtifactsPackagesDir)**/*engine.exe" />
<ItemsToSign Include="@(BundleInstallerEngineArtifact)" />
</ItemGroup>

<ItemGroup Condition="'$(SignBurnBundleFiles)' == 'true'">
<ItemsToSign Include="$(ArtifactsPackagesDir)**/*.exe" />
<!-- Sign the bundles, now that the engine is reattached. Avoid re-signing the engine. -->
<ItemsToSign
Include="@(BundleInstallerExeArtifact)"
Exclude="@(BundleInstallerEngineArtifact)" />
<!-- Note: wixstdba is internal to the engine bundle and does not get signed. -->
</ItemGroup>

Expand Down
35 changes: 20 additions & 15 deletions signing/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
<Project>

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.targets))\Directory.Build.targets" />

<!-- If signing is enabled, wait until all projects in this stage are done and sign them. -->
<Target Name="Build"
Condition="
'$(SkipSigning)' != 'true' and
'$(OSGroup)' == 'Windows_NT'">
<!-- Ensure all projects in this stage have built. -->
<MSBuild
Projects="@(StageProject)"
Targets="Build" />
<!-- Ensure all projects in this stage have built. -->
<Target Name="EnsureProjectsBuilt">
<MSBuild Projects="@(StageProject)" Targets="Build" />
</Target>

<!--
Run Arcade's signing project directly. The 'eng/Signing.props' extensibility props file checks
if '$(<StageName>)' == 'true' and points Arcade to the correct files.
-->
<!--
Run Arcade's signing project directly. The 'eng/Signing.props' extensibility props file checks
if '$(<StageName>)' == 'true' and points Arcade to the correct files.
-->
<Target Name="RunArcadeSigning">
<MSBuild
Projects="$(ArcadeSdkSignProject)"
Targets="Sign"
Expand All @@ -27,4 +21,15 @@
ArtifactsPackagesDir=$(ArtifactsPackagesDir)" />
</Target>

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.targets))\Directory.Build.targets" />

<!-- If signing is enabled, wait until all projects in this stage are done and sign them. -->
<Target Name="Build"
Condition="
'$(SkipSigning)' != 'true' and
'$(OSGroup)' == 'Windows_NT'"
DependsOnTargets="
EnsureProjectsBuilt;
RunArcadeSigning" />

</Project>
9 changes: 9 additions & 0 deletions signing/SignBurnBundleFiles.proj
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<!-- Before signing the bundles, the engines need to be injected back into the bundles. -->
<Target Name="ReattachAllEnginesToBundles"
BeforeTargets="RunArcadeSigning">
<MSBuild
Projects="@(ProjectToBuild -> WithMetadataValue('SignPhase', 'Bundle'))"
Targets="ReattachEngineToBundle" />
</Target>

</Project>
11 changes: 11 additions & 0 deletions signing/SignBurnEngineFiles.proj
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<StageProject Include="@(ProjectToBuild -> WithMetadataValue('SignPhase', 'BundleInstallerFiles'))" />
</ItemGroup>

<!-- To sign the burn engines, they need to be extracted from the bundles using WiX tools. -->
<Target Name="ExtractAllEngineBundles"
BeforeTargets="RunArcadeSigning">
<MSBuild Projects="@(StageProject)" Targets="ExtractEngineBundle" />
</Target>

</Project>
12 changes: 12 additions & 0 deletions signing/SignMsiFiles.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,16 @@
<StageProject Include="@(ProjectToBuild -> WithMetadataValue('SignPhase', 'MsiFiles'))" />
</ItemGroup>

<!--
Add shared framework projects to the list to ensure is built. Done in a target because the sfx
projects are not available statically.
-->
<Target Name="EnsureSharedFrameworkProjectsBuilt"
DependsOnTargets="GetSharedFrameworkProjects"
BeforeTargets="EnsureProjectsBuilt">
<ItemGroup>
<StageProject Include="@(SharedFrameworkProjects)" />
</ItemGroup>
</Target>

</Project>
7 changes: 0 additions & 7 deletions src/pkg/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@
<WixObjRoot>$(IntermediateOutputRootPath)wix/</WixObjRoot>
<WixObjDir>$(WixObjRoot)$(MSBuildProjectName)/</WixObjDir>
<MsiArch>$(TargetArchitecture)</MsiArch>
<MicrosoftEulaFile>$(MSBuildThisFileDirectory)packaging/windows/eula.rtf</MicrosoftEulaFile>

<GenerateMSI>true</GenerateMSI>
<GenerateMSI Condition="'$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'arm64'">false</GenerateMSI>
<GenerateMSI Condition="'$(OSGroup)' != 'Windows_NT'">false</GenerateMSI>

<GeneratePkg Condition="'$(OSGroup)' == 'OSX'">true</GeneratePkg>

<!--
Allow packaging one build's outputs for a different RID. For example, package portable bits
Expand Down
3 changes: 1 addition & 2 deletions src/pkg/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@
Acquire WiX tools, if not present.
-->
<Target Name="AcquireWix"
DependsOnTargets="GetAcquireWixProperties"
Condition="'$(GenerateMSI)' == 'true'">
DependsOnTargets="GetAcquireWixProperties">
<MSBuild Projects="$(AcquireWixProjectFile)" Targets="AcquireWixCore" />
</Target>

Expand Down
20 changes: 20 additions & 0 deletions src/pkg/packaging-tools/acquire-nuget-exe/acquire-nuget-exe.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<UsingTask TaskName="DownloadFile" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />

<!--
Acquire NuGet.exe, if not present.
-->
<Target Name="AcquireNuGetExeCore"
Condition="!Exists('$(NuGetExeFile)')"
DependsOnTargets="GetAcquireNuGetExeProperties">
<MakeDir Directories="$(NuGetExeToolDir)" />
<DownloadFile
Uri="$(NuGetExeDownloadUrl)"
DestinationPath="$(NuGetExeFile)"
Overwrite="true" />
</Target>

<Import Project="$(MSBuildThisFileDirectory)..\packaging-tools.targets" />

</Project>
10 changes: 10 additions & 0 deletions src/pkg/packaging-tools/framework.bundle.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<!--
Shared properties specific to bundle projects (bundleproj).
-->

<PropertyGroup>
<GenerateExeBundle>true</GenerateExeBundle>
</PropertyGroup>

</Project>
23 changes: 23 additions & 0 deletions src/pkg/packaging-tools/framework.bundle.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Shared targets specific to bundle projects (bundleproj).
-->

<Target Name="GetSharedFrameworkBundleInstallerProperties"
BeforeTargets="GetInstallerProperties">
<Error
Condition="'@(BundleComponentReference)' == ''"
Text="Bundle project lacks references to components that it should bundle." />

<PropertyGroup>
<InstallerName>$(ShortFrameworkName)-runtime</InstallerName>
<WixProductMoniker>$(SharedFrameworkBrandName)</WixProductMoniker>
</PropertyGroup>
</Target>

<!-- Target overrides (can't be shared with other package projects) -->

<Target Name="Build"
DependsOnTargets="GenerateInstallers" />

</Project>
7 changes: 7 additions & 0 deletions src/pkg/packaging-tools/framework.packaging.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Shared properties specific to packaging projects (pkgproj).
-->

<PropertyGroup>
<GenerateDeb>true</GenerateDeb>
<GenerateRpm>true</GenerateRpm>
<GeneratePkg>true</GeneratePkg>
<GenerateMSI>true</GenerateMSI>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Packaging" Version="$(MicrosoftDotNetBuildTasksPackagingPackageVersion)" />
</ItemGroup>
Expand Down
54 changes: 54 additions & 0 deletions src/pkg/packaging-tools/framework.packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,60 @@
Shared targets specific to projects building 'Microsoft.*.App*' packages.
-->

<Target Name="GetTargetingPackInstallerProperties"
Condition="'$(FrameworkPackType)' == 'targeting'"
BeforeTargets="GetInstallerProperties">
<PropertyGroup>
<InstallerName>$(ShortFrameworkName)-targeting-pack</InstallerName>
<WixProductMoniker>$(TargetingPackBrandName)</WixProductMoniker>
<VSInsertionShortComponentName>TargetingPack</VSInsertionShortComponentName>
</PropertyGroup>
</Target>

<Target Name="GetAppHostPackInstallerProperties"
Condition="'$(FrameworkPackType)' == 'apphost'"
BeforeTargets="GetInstallerProperties">
<PropertyGroup>
<InstallerName>$(ShortFrameworkName)-apphost-pack</InstallerName>
<WixProductMoniker>$(AppHostPackBrandName)</WixProductMoniker>
<VSInsertionShortComponentName>AppHostPack</VSInsertionShortComponentName>
</PropertyGroup>
</Target>

<Target Name="GetRuntimePackInstallerProperties"
Condition="'$(FrameworkPackType)' == 'runtime'"
BeforeTargets="GetInstallerGenerationFlags">
<!-- Runtime packs are obtained only through NuGet. -->
<PropertyGroup>
<GenerateDeb>false</GenerateDeb>
<GenerateRpm>false</GenerateRpm>
<GeneratePkg>false</GeneratePkg>
<GenerateMSI>false</GenerateMSI>
</PropertyGroup>
</Target>

<!--
This targets file is imported for all pkgproj files, but some (like DotNetHostPolicy) don't need
installers and just use the normal packaging tooling.
-->
<Target Name="DisableInstallerGenerationForPkgprojWithoutInstallers"
Condition="'$(FrameworkPackType)' == ''"
BeforeTargets="GetInstallerGenerationFlags">
<PropertyGroup>
<GenerateDeb>false</GenerateDeb>
<GenerateRpm>false</GenerateRpm>
<GeneratePkg>false</GeneratePkg>
</PropertyGroup>

<!--
Generate MSIs for projects that build a part of the shared framework (host, hostfxr) with this
tooling. Other installer types are not supported and Core-Setup infra generates them.
-->
<PropertyGroup Condition="'$(GenerateSharedFrameworkPart)' != 'true'">
<GenerateMSI>false</GenerateMSI>
</PropertyGroup>
</Target>

<!--
Copy the files in the package's data/ dir to a layout directory. This is what the pack installer
will place in the dotnet install dir.
Expand Down
5 changes: 5 additions & 0 deletions src/pkg/packaging-tools/framework.sharedfx.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Shared properties specific to shared framework projects (sfxproj).
-->

<PropertyGroup>
<GenerateMSI>true</GenerateMSI>
<GenerateCompressedArchive>true</GenerateCompressedArchive>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>$(NETCoreAppFramework)</TargetFramework>
<PackageId>unused</PackageId>
Expand Down
13 changes: 13 additions & 0 deletions src/pkg/packaging-tools/framework.sharedfx.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@

<UsingTask TaskName="ProcessSharedFrameworkDeps" AssemblyFile="$(LocalBuildToolsTaskFile)" />

<Target Name="GetSharedFrameworkInstallerProperties"
Condition="'$(GenerateSharedFramework)' == 'true'"
DependsOnTargets="GetInstallerBrandingNames"
BeforeTargets="
GetInstallerGenerationFlags;
GetInstallerProperties">
<PropertyGroup>
<InstallerName>$(ShortFrameworkName)-runtime</InstallerName>
<WixProductMoniker>$(SharedFrameworkBrandName)</WixProductMoniker>
<VSInsertionShortComponentName>SharedFramework</VSInsertionShortComponentName>
</PropertyGroup>
</Target>

<Target Name="GetPackageReference"
DependsOnTargets="GetProductVersions"
BeforeTargets="CollectPackageReferences">
Expand Down
Loading

0 comments on commit ccf0024

Please sign in to comment.