Skip to content

Commit

Permalink
Create WindowsDesktop sharedfx bundle installer (dotnet/core-setup#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.


Commit migrated from dotnet/core-setup@ccf0024
  • Loading branch information
dagood authored Aug 2, 2019
1 parent de9e3fb commit 9aebd37
Show file tree
Hide file tree
Showing 92 changed files with 2,202 additions and 1,142 deletions.
11 changes: 11 additions & 0 deletions src/installer/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
7 changes: 0 additions & 7 deletions src/installer/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/installer/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
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/installer/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/installer/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/installer/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/installer/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/installer/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/installer/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
21 changes: 15 additions & 6 deletions src/installer/pkg/packaging-tools/installer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@

<Target Name="GenerateInstallers"
DependsOnTargets="
GetInstallerProperties;
GetInstallerGenerationFlags;
GenerateDeb;
GenerateRpm;
GenerateMsi;
GenerateExeBundle;
GeneratePkg;
GenerateCompressedArchive" />

<Target Name="GenerateDeb" DependsOnTargets="TestDebuild;CreateDeb" Condition="'$(BuildDebPackage)' == 'true'"/>
<Target Name="GenerateRpm" DependsOnTargets="TestFPMTool;CreateRpm" Condition="'$(BuildRpmPackage)' == 'true'"/>
<Target Name="GenerateMsi" DependsOnTargets="CreateMsi" Condition="'$(GenerateMSI)' == 'true'"/>
<Target Name="GenerateDeb" DependsOnTargets="TestDebuild;CreateDeb" Condition="'$(GenerateDeb)' == 'true'"/>
<Target Name="GenerateRpm" DependsOnTargets="TestFPMTool;CreateRpm" Condition="'$(GenerateRpm)' == 'true'"/>
<Target Name="GenerateMsi" DependsOnTargets="CreateWixInstaller" Condition="'$(GenerateMSI)' == 'true'"/>
<Target Name="GenerateExeBundle" DependsOnTargets="CreateWixInstaller" Condition="'$(GenerateExeBundle)' == 'true'"/>
<Target Name="GeneratePkg" DependsOnTargets="CreatePkg" Condition="'$(GeneratePkg)' == 'true'"/>
<Target Name="GenerateCompressedArchive" DependsOnTargets="CreateCompressedArchive" Condition="'$(GenerateCompressedArchive)' == 'true'"/>

Expand Down Expand Up @@ -150,11 +152,15 @@
<!--
Create MSI installer, using WiX tools.
-->
<Target Name="CreateMsi"
<Target Name="CreateWixInstaller"
DependsOnTargets="
GetInstallerProperties;
RunLightLinker">
<Message Text="$(MSBuildProjectName) -> $(InstallerFile)" Importance="high" />
<Error
Condition="'$(GenerateExeBundle)' == 'true' and '$(GenerateMSI)' == 'true'"
Text="GenerateExeBundle and GenerateMSI are both set, but only one can be created at a time." />

<Message Text="$(MSBuildProjectName) -> $(OutInstallerFile)" Importance="high" />
</Target>

<Target Name="CreateCompressedArchive"
Expand All @@ -180,6 +186,9 @@
GetInstallerProperties;
FixLayoutPermissions">
<PropertyGroup>
<MacOSComponentName>com.microsoft.$(ShortFrameworkName).pack.$(FrameworkPackType).$(ProductVersion).component.osx.x64</MacOSComponentName>
<MacOSSharedInstallDir>/usr/local/share/dotnet</MacOSSharedInstallDir>

<_pkgArgs></_pkgArgs>
<_pkgArgs>$(_pkgArgs) --root $(PackLayoutDir)</_pkgArgs>
<_pkgArgs>$(_pkgArgs) --identifier $(MacOSComponentName)</_pkgArgs>
Expand Down
1 change: 1 addition & 0 deletions src/installer/pkg/packaging-tools/packaging-tools.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="framework.bundle.props" Condition="'$(MSBuildProjectExtension)' == '.bundleproj'" />
<Import Project="framework.dependency.props" Condition="'$(MSBuildProjectExtension)' == '.depproj'" />
<Import Project="framework.packaging.props" Condition="'$(MSBuildProjectExtension)' == '.pkgproj'" />
<Import Project="framework.sharedfx.props" Condition="'$(MSBuildProjectExtension)' == '.sfxproj'" />
Expand Down
Loading

0 comments on commit 9aebd37

Please sign in to comment.