Create AppHost pack nupkg and installers (dotnet/core-setup#5818)
authorDavis Goodin <dagood@users.noreply.github.com>
Mon, 15 Apr 2019 21:27:26 +0000 (16:27 -0500)
committerGitHub <noreply@github.com>
Mon, 15 Apr 2019 21:27:26 +0000 (16:27 -0500)
* Create AppHost pack nupkg and installers

* Publish rid-specific AppHost packs

Commit migrated from https://github.com/dotnet/core-setup/commit/29db80e003d7160f20bd2b036ba16721c3ee66bc

13 files changed:
src/installer/pkg/dir.props
src/installer/pkg/packaging-tools/framework.packaging.targets
src/installer/pkg/packaging-tools/packaging-tools.props
src/installer/pkg/packaging-tools/packaging-tools.targets
src/installer/pkg/packaging-tools/windows/pack/product.wxs [moved from src/installer/pkg/packaging-tools/windows/targetingPack/product.wxs with 100% similarity]
src/installer/pkg/packaging-tools/windows/wix.targets
src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/Microsoft.NETCore.DotNetAppHost.pkgproj
src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/Microsoft.NETCore.DotNetAppHost.props [new file with mode: 0644]
src/installer/pkg/projects/dir.props
src/installer/pkg/projects/dir.targets
src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Host.pkgproj [new file with mode: 0644]
src/installer/pkg/projects/netcoreapp/pkg/dir.props
src/installer/publish/dir.props

index 0f8f4f7..e490025 100644 (file)
@@ -90,6 +90,7 @@
     <SharedHostBrandName>$(ProductBrandPrefix) Host - $(ProductBrandSuffix)</SharedHostBrandName>
     <HostFxrBrandName>$(ProductBrandPrefix) Host FX Resolver - $(ProductBrandSuffix)</HostFxrBrandName>
     <TargetingPackBrandName>$(ProductBrandPrefix) Targeting Pack - $(ProductBrandSuffix)</TargetingPackBrandName>
+    <AppHostPackBrandName>$(ProductBrandPrefix) AppHost Pack - $(ProductBrandSuffix)</AppHostPackBrandName>
     <SharedFrameworkBrandName>$(ProductBrandPrefix) Runtime - $(ProductBrandSuffix)</SharedFrameworkBrandName>
   </PropertyGroup>
 
index c94e124..84e8954 100644 (file)
   </Target>
 
   <!--
-    Copy the files in the package's data/ dir to a layout directory. This is what the targeting pack
-    installer will place in the dotnet install dir.
+    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.
 
     This extracts from the nupkg (zip) directly. An alternative would be using the PackageFile
     items, but there's some risk of handling TargetPath metadata and filtering symbols differently
     <RemoveDir Directories="$(PackLayoutDir)" />
 
     <PropertyGroup>
-      <TargetingPackNupkgFile>$(PackageOutputPath)$(Id).$(PackageVersion).nupkg</TargetingPackNupkgFile>
+      <FrameworkPackNupkgFile>$(PackageOutputPath)$(Id).$(PackageVersion).nupkg</FrameworkPackNupkgFile>
     </PropertyGroup>
 
-    <ZipFileGetEntries TargetArchive="$(TargetingPackNupkgFile)">
-      <Output TaskParameter="Entries" ItemName="TargetingPackNupkgEntries" />
+    <ZipFileGetEntries TargetArchive="$(FrameworkPackNupkgFile)">
+      <Output TaskParameter="Entries" ItemName="FrameworkPackNupkgEntries" />
     </ZipFileGetEntries>
 
     <ItemGroup>
-      <TargetingPackDataEntries
-        Include="@(TargetingPackNupkgEntries)"
+      <FrameworkPackDataEntries
+        Include="@(FrameworkPackNupkgEntries)"
         Condition="
-          $([System.String]::new('%(TargetingPackNupkgEntries.Identity)').StartsWith('data/')) OR
-          $([System.String]::new('%(TargetingPackNupkgEntries.Identity)').StartsWith('ref/')) OR
-          $([System.String]::new('%(TargetingPackNupkgEntries.Identity)').StartsWith('runtimes/'))" />
+          $([System.String]::new('%(FrameworkPackNupkgEntries.Identity)').StartsWith('data/')) OR
+          $([System.String]::new('%(FrameworkPackNupkgEntries.Identity)').StartsWith('ref/')) OR
+          $([System.String]::new('%(FrameworkPackNupkgEntries.Identity)').StartsWith('runtimes/'))" />
     </ItemGroup>
 
     <ZipFileExtractToDirectory
-      SourceArchive="$(TargetingPackNupkgFile)"
+      SourceArchive="$(FrameworkPackNupkgFile)"
       DestinationDirectory="$(PackLayoutDir)packs/$(Id)/$(Version)/"
       OverwriteDestination="true"
-      Include="@(TargetingPackDataEntries)" />
+      Include="@(FrameworkPackDataEntries)" />
   </Target>
 
   <Target Name="GenerateSharedFramework"
index a42c345..1894e7f 100644 (file)
@@ -8,22 +8,35 @@
   <PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Ref'))">
     <FrameworkPackType>targeting</FrameworkPackType>
 
-    <!--
-      Prevent 'runtime.<rid>.Microsoft.<framework>.App.Ref' packages from being built.
+    <!-- Include the platform manifest in the data dir. -->
+    <PlatformManifestTargetPath>data/PlatformManifest.txt</PlatformManifestTargetPath>
+    <FrameworkListTargetPath>data/</FrameworkListTargetPath>
+  </PropertyGroup>
 
-      Not the same as HasRuntimePackages, which is used to set up ProjectReferences on the runtime
-      packages and generate assets such as the platform manifest.
+  <PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Host'))">
+    <FrameworkPackType>apphost</FrameworkPackType>
+
+    <!-- AppHost packs are only per-RID, e.g. 'Microsoft.NETCore.App.Host.win-x64'. -->
+    <BuildRidSpecificPacks>true</BuildRidSpecificPacks>
+    <BuildLineupPackage>false</BuildLineupPackage>
+
+    <!--
+      Use generic package description: packaging tasks don't handle RID suffix nicely and expect an
+      individual description for each RID.
     -->
-    <BuildRuntimePackages>false</BuildRuntimePackages>
+    <UseRuntimePackageDescription>true</UseRuntimePackageDescription>
+  </PropertyGroup>
 
-    <PackageType>DotnetPlatform</PackageType>
+  <PropertyGroup Condition="'$(FrameworkPackType)' != ''">
     <Version>$(ProductVersion)</Version>
+    <PackageType>DotnetPlatform</PackageType>
 
-    <!-- Include the platform manifest in the data dir. -->
-    <PlatformManifestTargetPath>data/PlatformManifest.txt</PlatformManifestTargetPath>
-    <FrameworkListTargetPath>data/</FrameworkListTargetPath>
-
-    <!-- Exclude runtime.json from the package. -->
+    <!--
+      Prevent 'runtime.<rid>.Microsoft.<framework>.App.Ref' packages from being built, and disable
+      the runtime.json and lineup package infrastructure. Packs are either RID-agnostic or use
+      convention-based runtime packages, not runtime.json with a lineup package.
+    -->
+    <BuildRuntimePackages>false</BuildRuntimePackages>
     <IncludeRuntimeJson>false</IncludeRuntimeJson>
     <IsLineupPackage>false</IsLineupPackage>
 
index 0939929..2cf5417 100644 (file)
     <PropertyGroup Condition="'$(FrameworkPackType)' == 'targeting'">
       <InstallerName>$(ShortFrameworkName)-targeting-pack</InstallerName>
       <WixProductMoniker>$(TargetingPackBrandName)</WixProductMoniker>
+    </PropertyGroup>
 
-      <MacOSComponentName>com.microsoft.$(ShortFrameworkName).pack.$(FrameworkPackType).$(ProductVersion).component.osx.x64</MacOSComponentName>
-      <MacOSSharedInstallDir>/usr/local/share/dotnet</MacOSSharedInstallDir>
+    <PropertyGroup Condition="'$(FrameworkPackType)' == 'apphost'">
+      <InstallerName>$(ShortFrameworkName)-apphost-pack</InstallerName>
+      <WixProductMoniker>$(AppHostPackBrandName)</WixProductMoniker>
     </PropertyGroup>
 
     <PropertyGroup Condition="'$(GenerateSharedFramework)' == 'true'">
@@ -27,6 +29,9 @@
     </PropertyGroup>
 
     <PropertyGroup>
+      <MacOSComponentName>com.microsoft.$(ShortFrameworkName).pack.$(FrameworkPackType).$(ProductVersion).component.osx.x64</MacOSComponentName>
+      <MacOSSharedInstallDir>/usr/local/share/dotnet</MacOSSharedInstallDir>
+
       <VersionedInstallerName>$(InstallerName)-$(ProductBandVersion)</VersionedInstallerName>
       <VersionedInstallerName>$(VersionedInstallerName.ToLowerInvariant())</VersionedInstallerName>
       <InstallerPackageRelease>1</InstallerPackageRelease>
index 3dad253..fd96a7b 100644 (file)
   <!-- Set up information to pass to WiX, depending on the type of installer being created. -->
   <Target Name="GetWixBuildConfiguration" DependsOnTargets="GetInstallerProperties">
 
-    <ItemGroup Condition="'$(FrameworkPackType)' == 'targeting'">
+    <ItemGroup Condition="'$(FrameworkPackType)' != ''">
       <DirectoryToHarvest
         Include="$(PackLayoutDir)"
         Name="install-files"
-        SubstituteVar="TargetingPackSrc"
+        SubstituteVar="PackSrc"
         ComponentGroupName="InstallFiles"
         DirectoryRef="DOTNETHOME" />
 
-      <WixSrcFile Include="$(MSBuildThisFileDirectory)targetingPack/product.wxs" />
+      <WixSrcFile Include="$(MSBuildThisFileDirectory)pack/product.wxs" />
     </ItemGroup>
 
     <ItemGroup Condition="'$(GenerateSharedFramework)' == 'true'">
index 5290ece..5621f7d 100644 (file)
@@ -4,9 +4,9 @@
 
   <PropertyGroup>
     <Version>$(AppHostVersion)</Version>
-  </PropertyGroup>      
+  </PropertyGroup>
 
-  <Import Condition="'$(PackageTargetRuntime)' != ''" Project="$(MSBuildThisFileDirectory)runtime.$(OSGroup).$(MSBuildProjectName).props" />
+  <Import Project="$(MSBuildProjectName).props" />
 
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
 </Project>
\ No newline at end of file
diff --git a/src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/Microsoft.NETCore.DotNetAppHost.props b/src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/Microsoft.NETCore.DotNetAppHost.props
new file mode 100644 (file)
index 0000000..1dcc4ed
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <Import
+    Condition="'$(PackageTargetRuntime)' != ''"
+    Project="$(MSBuildThisFileDirectory)runtime.$(OSGroup).Microsoft.NETCore.DotNetAppHost.props" />
+
+</Project>
index bdd61d6..b03b22a 100644 (file)
@@ -16,6 +16,7 @@
     <IsLineupPackage Condition="'$(PackageTargetRuntime)' == ''">true</IsLineupPackage>
 
     <BuildRuntimePackages>true</BuildRuntimePackages>
+    <BuildLineupPackage>true</BuildLineupPackage>
 
     <PackProjectDependencies>true</PackProjectDependencies>
   </PropertyGroup>
   <ItemGroup Condition="'$(HasRuntimePackages)' != 'false'">
     <_project Include="@(BuildRID)">
       <Platform Condition="'%(Platform)' == ''">x64</Platform>
-      <PackageTargetRuntime>%(Identity)</PackageTargetRuntime>
-      <AdditionalProperties>PackageTargetRuntime=%(Identity);NuGetRuntimeIdentifier=%(Identity);Platform=%(Platform)</AdditionalProperties>
+      <BuildRID>%(Identity)</BuildRID>
+      <PackageTargetRuntime>%(BuildRID)</PackageTargetRuntime>
+      <AdditionalProperties>PackageTargetRuntime=%(BuildRID);NuGetRuntimeIdentifier=%(BuildRID);Platform=%(Platform)</AdditionalProperties>
     </_project>
 
     <RuntimeProject Include="@(_project->'$(MSBuildProjectFullPath)')" />
+
+    <!--
+      Pack projects need package IDs like "Microsoft.NETCore.App.Host.Runtime.<rid>". The package
+      tooling statically uses the MSBuild project name as the package ID, allowing for a prefix, but
+      not a suffix. Set BaseId as a non-overridable global to force the desired ID in a way that the
+      rest of the packaging tooling automatically respects.
+
+      Force IdPrefix to '' to allow using the well-supported PackageTargetRuntime without adding the
+      undesired 'runtime.<rid>.' prefix to the package ID.
+    -->
+    <RidSpecificPackProject
+      Include="@(_project->'$(MSBuildProjectFullPath)')"
+      BaseId="$(MSBuildProjectName).%(BuildRID)"
+      AdditionalProperties="%(AdditionalProperties);BaseId=%(BaseId);IdPrefix=" />
   </ItemGroup>
 
   <ItemGroup Condition="'$(PackageTargetRuntime)' == '' and '$(HasRuntimePackages)' != 'false'">
index 0a29238..742ac83 100644 (file)
     <ItemGroup>
       <!-- The pkg and src builds both build these projects. Add them to both phases. -->
       <PkgSrcProject Include="@(RuntimeProject)" Condition="'$(BuildRuntimePackages)' == 'true'" />
-      <PkgSrcProject Include="$(MSBuildProjectFullPath)" />
+      <PkgSrcProject Include="@(RidSpecificPackProject)" Condition="'$(BuildRidSpecificPacks)' == 'true'" />
+      <PkgSrcProject Include="$(MSBuildProjectFullPath)" Condition="'$(BuildLineupPackage)' == 'true'"/>
 
       <Project Include="@(PkgSrcProject)" Phase="pkg" />
       <Project Include="@(PkgSrcProject)" Phase="src" />
 
       <!--
-        Create targeting pack packages/installers. Similar to the runtime package, we only make one
-        Debian or RPM package for all distros of that type.
+        Create framework pack non-nuget packages/installers. Similar to the runtime package, we only
+        make one Debian or RPM package for all distros of that type.
       -->
       <Project
         Include="$(MSBuildProjectFullPath)"
         Phase="installer"
         Condition="
-          '$(FrameworkPackType)' == 'targeting' AND
+          '$(FrameworkPackType)' != '' AND
           '$(BuildDistroIndependentInstallers)' == 'true'" />
     </ItemGroup>
 
diff --git a/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Host.pkgproj b/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Host.pkgproj
new file mode 100644 (file)
index 0000000..98845cb
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+
+  <!--
+    Create AppHost Pack based on legacy DotNetAppHost package. This can be collapsed once the legacy
+    package is no longer used.
+  -->
+  <Import Project="..\..\Microsoft.NETCore.DotNetAppHost\Microsoft.NETCore.DotNetAppHost.props" />
+
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
\ No newline at end of file
index 6275811..3d64106 100644 (file)
@@ -15,7 +15,7 @@
   </PropertyGroup>
 
   <!-- Redistribute package content from other nuget packages. -->
-  <ItemGroup>
+  <ItemGroup Condition="'$(FrameworkPackType)' != 'apphost'">
     <ProjectReference Include="..\src\netcoreapp.depproj">
       <AdditionalProperties Condition="'$(PackageTargetRuntime)' != ''">NuGetRuntimeIdentifier=$(PackageTargetRuntime)</AdditionalProperties>
     </ProjectReference>
index 75ace2b..1f8d8e7 100644 (file)
     <CompressedFile Include="$(AssetOutputPath)**/*$(CompressedFileExtension)">
       <RelativeBlobPath>$(BinariesRelativePath)</RelativeBlobPath>
     </CompressedFile>
-    <RuntimePackageFile Include="$(PackageOutputPath)**/runtime.*.nupkg" >
-      <RelativeBlobPath>$(BinariesRelativePath)</RelativeBlobPath>
-    </RuntimePackageFile>
+
+    <RuntimePackageFile
+      Include="
+        $(PackageOutputPath)**/runtime.*.nupkg;
+        $(PackageOutputPath)**/*.App.Host.*.nupkg"
+      RelativeBlobPath="$(BinariesRelativePath)"/>
+
     <RidAgnosticPackageFile Include="$(PackageOutputPath)**/*.nupkg" Exclude="@(RuntimePackageFile)" >
       <RelativeBlobPath>$(BinariesRelativePath)</RelativeBlobPath>
     </RidAgnosticPackageFile>