From: Davis Goodin Date: Tue, 23 Jul 2019 15:10:07 +0000 (-0500) Subject: Fix platform manifest package id column (dotnet/core-setup#7322) X-Git-Tag: submit/tizen/20210909.063632~11032^2~117 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2b7dbeccb09a9c21a4557099c9168e1179da018;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix platform manifest package id column (dotnet/core-setup#7322) Fixes "__PackageId__" placeholder appearing in outputs. Added test to ensure this doesn't happen. Also adds platform manifest to runtime packs. Commit migrated from https://github.com/dotnet/core-setup/commit/7e3b0d0caf21b89608a3373e040041cc458722ba --- diff --git a/src/installer/pkg/packaging-tools/packaging-tools.props b/src/installer/pkg/packaging-tools/packaging-tools.props index 83633db..2f2ce2b 100644 --- a/src/installer/pkg/packaging-tools/packaging-tools.props +++ b/src/installer/pkg/packaging-tools/packaging-tools.props @@ -23,8 +23,11 @@ runtime true - + RuntimeList.xml + + + data/PlatformManifest.txt data/ diff --git a/src/installer/pkg/projects/Directory.Build.targets b/src/installer/pkg/projects/Directory.Build.targets index a205a17..2a3723f 100644 --- a/src/installer/pkg/projects/Directory.Build.targets +++ b/src/installer/pkg/projects/Directory.Build.targets @@ -262,10 +262,29 @@ - + + + <_platformManifestFileTemplateFile Condition="'%(_depprojDataFile.PlatformManifestFile)' == 'true'">%(_depprojDataFile.Identity) + + + + <_runtimeDependencyItems>@(RuntimeDependency) + <_filledPlatformManifestFileContent>$([System.IO.File]::ReadAllText('$(_platformManifestFileTemplateFile)') + .Replace("__PackageId__", "$(Id)")) + + + <_filledPlatformManifestFile>$(IntermediateOutputPath)PlatformManifest.txt + + + + + diff --git a/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs b/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs index 2e22062..707f8be 100644 --- a/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs +++ b/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/NETCoreTests.cs @@ -18,12 +18,7 @@ namespace Microsoft.DotNet.CoreSetup.Packaging.Tests dirs, "Microsoft.NETCore.App.Ref")) { - tester.HasOnlyTheseDataFiles( - "data/FrameworkList.xml", - "data/PlatformManifest.txt"); - - tester.IsTargetingPack(); - tester.HasGoodPlatformManifest(); + tester.IsTargetingPackForPlatform(); } } diff --git a/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs b/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs index dc5deff..d13360f 100644 --- a/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs +++ b/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs @@ -62,6 +62,7 @@ namespace Microsoft.DotNet.CoreSetup.Packaging.Tests return new NuGetArtifactTester(nupkgPath); } + public PackageIdentity Identity { get; } public NuGetVersion PackageVersion { get; } private readonly PackageArchiveReader _reader; @@ -69,6 +70,7 @@ namespace Microsoft.DotNet.CoreSetup.Packaging.Tests public NuGetArtifactTester(string file) { _reader = new PackageArchiveReader(ZipFile.Open(file, ZipArchiveMode.Read)); + Identity = _reader.NuspecReader.GetIdentity(); PackageVersion = _reader.NuspecReader.GetVersion(); } @@ -88,6 +90,17 @@ namespace Microsoft.DotNet.CoreSetup.Packaging.Tests ContainsFrameworkList("FrameworkList.xml"); } + public void IsTargetingPackForPlatform() + { + IsFrameworkPack(); + + HasOnlyTheseDataFiles( + "data/FrameworkList.xml", + "data/PlatformManifest.txt"); + + HasGoodPlatformManifest(); + } + public void IsAppHostPack() { IsRuntimeSpecificPack(); @@ -97,7 +110,11 @@ namespace Microsoft.DotNet.CoreSetup.Packaging.Tests { IsRuntimeSpecificPack(); - HasOnlyTheseDataFiles("data/RuntimeList.xml"); + HasOnlyTheseDataFiles( + "data/RuntimeList.xml", + "data/PlatformManifest.txt"); + + HasGoodPlatformManifest(); ContainsFrameworkList("RuntimeList.xml"); } @@ -120,6 +137,18 @@ namespace Microsoft.DotNet.CoreSetup.Packaging.Tests // Sanity: check if the manifest has some content. Assert.Contains(".dll", platformManifestContent); + + // Check that the lines contain the package ID where they're supposed to. + foreach (var parts in platformManifestContent + .Split('\r', '\n') + .Select(line => line.Split("|")) + .Where(parts => parts.Length > 1)) + { + Assert.True( + parts[1] == Identity.Id, + $"Platform manifest package id column '{parts[1]}' doesn't match " + + $"actual package id '{Identity.Id}'"); + } } public string ReadEntryContent(string entry) diff --git a/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/WindowsDesktopTests.cs b/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/WindowsDesktopTests.cs index 375539d..af00969 100644 --- a/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/WindowsDesktopTests.cs +++ b/src/installer/test/Microsoft.DotNet.CoreSetup.Packaging.Tests/WindowsDesktopTests.cs @@ -27,12 +27,7 @@ namespace Microsoft.DotNet.CoreSetup.Packaging.Tests { Assert.NotNull(tester); - tester.HasOnlyTheseDataFiles( - "data/FrameworkList.xml", - "data/PlatformManifest.txt"); - - tester.IsTargetingPack(); - tester.HasGoodPlatformManifest(); + tester.IsTargetingPackForPlatform(); } else {