Skip to content

Commit

Permalink
Merge pull request #617 from dsplaisted/LayoutTargetingPacks
Browse files Browse the repository at this point in the history
Use .Ref targeting packs and include in layout under packs folder
  • Loading branch information
dsplaisted authored Feb 21, 2019
2 parents bd9a640 + d1d8a04 commit e19eb34
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/redist/targets/GenerateBundledVersions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<Project>
<PropertyGroup>
<NetCoreTargetingPackRoot Condition="'%24(NetCoreTargetingPackRoot)' == ''">%24([MSBuild]::NormalizePath('%24(MSBuildThisFileDirectory)..\..\packs'))</NetCoreTargetingPackRoot>
<NETCoreAppMaximumVersion>$(_NETCoreAppTargetFrameworkVersion)</NETCoreAppMaximumVersion>
<BundledNETCoreAppTargetFrameworkVersion>$(_NETCoreAppTargetFrameworkVersion)</BundledNETCoreAppTargetFrameworkVersion>
<BundledNETCoreAppPackageVersion>$(_NETCoreAppPackageVersion)</BundledNETCoreAppPackageVersion>
Expand Down Expand Up @@ -199,8 +201,8 @@ Copyright (c) .NET Foundation. All rights reserved.
RuntimeFrameworkName="Microsoft.NETCore.App"
DefaultRuntimeFrameworkVersion="$(_NETCoreAppPackageVersion)"
LatestRuntimeFrameworkVersion="$(_NETCoreAppPackageVersion)"
TargetingPackName="Microsoft.NETCore.App"
TargetingPackVersion="$(_NETCoreAppPackageVersion)"
TargetingPackName="Microsoft.NETCore.App.Ref"
TargetingPackVersion="$(NetCoreAppTargetingPackVersion)"
AppHostPackNamePattern="runtime.**RID**.Microsoft.NETCore.DotNetAppHost"
AppHostRuntimeIdentifiers="@(NetCoreRuntimePackRids, '%3B')"
RuntimePackNamePatterns="runtime.**RID**.Microsoft.NETCore.App%3Bruntime.**RID**.Microsoft.NETCore.DotNetHostResolver%3Bruntime.**RID**.Microsoft.NETCore.DotNetHostPolicy"
Expand Down Expand Up @@ -230,8 +232,8 @@ Copyright (c) .NET Foundation. All rights reserved.
RuntimeFrameworkName="Microsoft.AspNetCore.App"
DefaultRuntimeFrameworkVersion="$(MicrosoftAspNetCoreAppPackageVersion)"
LatestRuntimeFrameworkVersion="$(MicrosoftAspNetCoreAppPackageVersion)"
TargetingPackName="Microsoft.AspNetCore.App"
TargetingPackVersion="$(MicrosoftAspNetCoreAppPackageVersion)"
TargetingPackName="Microsoft.AspNetCore.App.Ref"
TargetingPackVersion="$(AspNetTargetingPackVersion)"
RuntimePackNamePatterns="runtime.**RID**.Microsoft.AspNetCore.App"
RuntimePackRuntimeIdentifiers="@(AspNetCoreRuntimePackRids, '%3B')"
/>
Expand Down
71 changes: 67 additions & 4 deletions src/redist/targets/GenerateLayout.targets
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@
<RelativeLayoutPath></RelativeLayoutPath>
</BundledLayoutComponent>

<BundledLayoutPackage Include="MicrosoftNetCoreAppTargetingPackNupkg">
<PackageName>Microsoft.NETCore.App.Ref</PackageName>
<PackageVersion>$(NetCoreAppTargetingPackVersion)</PackageVersion>
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage>

<BundledLayoutPackage Include="MicrosoftAspNetCoreAppTargetingPackNupkg">
<PackageName>Microsoft.AspNetCore.App.Ref</PackageName>
<PackageVersion>$(AspNetTargetingPackVersion)</PackageVersion>
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage>

<BundledInstallerComponent Include="DownloadedRuntimeDepsInstallerFile"
Condition="('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') And '$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
<BaseUrl>$(CoreSetupRootUrl)$(MicrosoftNETCoreAppPackageVersion)</BaseUrl>
Expand Down Expand Up @@ -183,7 +195,52 @@
<DownloadFile Condition=" '@(ComponentToDownload)' != '' And '%(ComponentToDownload.ShouldDownload)' == 'true'"
Uri="%(ComponentToDownload.BaseUrl)/%(ComponentToDownload.DownloadFileName)"
DestinationPath="%(ComponentToDownload.DownloadDestination)" />


<ItemGroup>
<BundledLayoutPackageDownloadProject Include="$(MSBuildThisFileDirectory)DownloadPackage.csproj">
<Properties>
PackageToRestore=%(BundledLayoutPackage.PackageName);
PackageVersionToRestore=%(BundledLayoutPackage.PackageVersion);
TargetFramework=$(TargetFramework);
LayoutPackageDescription=%(BundledLayoutPackage.Identity)
</Properties>
</BundledLayoutPackageDownloadProject>
</ItemGroup>

<MSBuild
BuildInParallel="False"
Projects="@(BundledLayoutPackageDownloadProject)">
</MSBuild>

<ItemGroup>
<!-- Use lowercase package name in package path -->
<BundledLayoutPackage>
<LoweredPackageName>$([MSBuild]::ValueOrDefault('%(BundledLayoutPackage.PackageName)', '').ToLower())</LoweredPackageName>
</BundledLayoutPackage>

<BundledLayoutPackageDownloadFiles Include="$(NuGetPackageRoot)\%(BundledLayoutPackage.LoweredPackageName)\%(BundledLayoutPackage.PackageVersion)\**\*.*">
<RelativeLayoutPath>%(BundledLayoutPackage.RelativeLayoutPath)</RelativeLayoutPath>
<LayoutPackageDescription>%(BundledLayoutPackage.Identity)</LayoutPackageDescription>
</BundledLayoutPackageDownloadFiles>

<!-- Remove files from the root of the package, as these are either files NuGet writes, or not necessary -->
<BundledLayoutPackageDownloadFiles Remove="$(NuGetPackageRoot)\%(BundledLayoutPackage.LoweredPackageName)\%(BundledLayoutPackage.PackageVersion)\*.*" />

<!-- Set destination path in layout -->
<BundledLayoutPackageDownloadFiles>
<DestinationPath>%(BundledLayoutPackageDownloadFiles.RecursiveDir)%(BundledLayoutPackageDownloadFiles.Filename)%(BundledLayoutPackageDownloadFiles.Extension)</DestinationPath>
</BundledLayoutPackageDownloadFiles>
<BundledLayoutPackageDownloadFiles>
<DestinationPath>$(RedistLayoutPath)/%(BundledLayoutPackageDownloadFiles.RelativeLayoutPath)/%(BundledLayoutPackageDownloadFiles.DestinationPath)</DestinationPath>
</BundledLayoutPackageDownloadFiles>
<BundledLayoutPackageDownloadFiles>
<DestinationPath>$([MSBuild]::NormalizePath(%(BundledLayoutPackageDownloadFiles.DestinationPath)))</DestinationPath>
</BundledLayoutPackageDownloadFiles>

<!-- Creating a new item here isn't strictly necessary, but makes it easier to see what's going on in the .binlog,
since the metadata updates don't show up there -->
<BundledLayoutPackageDownloadFilesWithDestination Include="@(BundledLayoutPackageDownloadFiles)"/>
</ItemGroup>
</Target>

<Target Name="CleanLayoutPath">
Expand All @@ -192,9 +249,15 @@
<MakeDir Directories="$(RedistLayoutPath)" />
</Target>

<Target Name="ExtractBundledComponents">
<Target Name="LayoutBundledComponents">
<ExtractArchiveToDirectory SourceArchive="%(BundledLayoutComponent.DownloadDestination)"
DestinationDirectory="$(RedistLayoutPath)/%(BundledLayoutComponent.RelativeLayoutPath)" />
DestinationDirectory="$(RedistLayoutPath)/%(BundledLayoutComponent.RelativeLayoutPath)" />

<Copy SourceFiles="@(BundledLayoutPackageDownloadFilesWithDestination)"
DestinationFiles="@(BundledLayoutPackageDownloadFilesWithDestination->'%(DestinationPath)')"
SkipUnchangedFiles="true"
/>

</Target>

<Target Name="RetargetTools">
Expand Down Expand Up @@ -285,7 +348,7 @@
<Target Name="GenerateLayout"
DependsOnTargets="DownloadBundledComponents;
CleanLayoutPath;
ExtractBundledComponents;
LayoutBundledComponents;
GenerateVersionFile;
GenerateBundledVersions;
LayoutRuntimeGraph;
Expand Down
6 changes: 6 additions & 0 deletions test/EndToEnd/GivenAspNetAppsResolveImplicitVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ public void StandalonePublishWithLatestTFMUsesBundledAspNetCoreAppVersion()
[MemberData(nameof(SupportedAspNetCoreAppVersions))]
public void ItRollsForwardToTheLatestVersion(string minorVersion)
{
if (minorVersion == "3.0")
{
// https://github.com/dotnet/core-sdk/issues/621
return;
}

var testProjectCreator = new TestProjectCreator(identifier: minorVersion)
{
PackageName = TestProjectCreator.AspNetCoreAppPackageName,
Expand Down
10 changes: 10 additions & 0 deletions test/EndToEnd/GivenFrameworkDependentApps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,23 @@ public class GivenFrameworkDependentApps : TestBase
[ClassData(typeof(SupportedNetCoreAppVersions))]
public void ItDoesNotRollForwardToTheLatestVersionOfNetCore(string minorVersion)
{
if (minorVersion == "3.0")
{
// https://github.com/dotnet/core-sdk/issues/621
return;
}
ItDoesNotRollForwardToTheLatestVersion(TestProjectCreator.NETCorePackageName, minorVersion);
}

[Theory]
[ClassData(typeof(SupportedAspNetCoreVersions))]
public void ItDoesNotRollForwardToTheLatestVersionOfAspNetCoreApp(string minorVersion)
{
if (minorVersion == "3.0")
{
// https://github.com/dotnet/core-sdk/issues/621
return;
}
ItDoesNotRollForwardToTheLatestVersion(TestProjectCreator.AspNetCoreAppPackageName, minorVersion);
}

Expand Down
10 changes: 10 additions & 0 deletions test/EndToEnd/GivenSelfContainedAppsRollForward.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,23 @@ public partial class GivenSelfContainedAppsRollForward : TestBase
[ClassData(typeof(SupportedNetCoreAppVersions))]
public void ItRollsForwardToTheLatestNetCoreVersion(string minorVersion)
{
if (minorVersion == "3.0")
{
// https://github.com/dotnet/core-sdk/issues/621
return;
}
ItRollsForwardToTheLatestVersion(TestProjectCreator.NETCorePackageName, minorVersion);
}

[Theory]
[ClassData(typeof(SupportedAspNetCoreVersions))]
public void ItRollsForwardToTheLatestAspNetCoreAppVersion(string minorVersion)
{
if (minorVersion == "3.0")
{
// https://github.com/dotnet/core-sdk/issues/621
return;
}
ItRollsForwardToTheLatestVersion(TestProjectCreator.AspNetCoreAppPackageName, minorVersion);
}

Expand Down

0 comments on commit e19eb34

Please sign in to comment.