<FrameworkPackType>runtime</FrameworkPackType>
<BuildRidSpecificPacks>true</BuildRidSpecificPacks>
- <!-- Include a list of runtime files in the data dir. -->
+ <!-- Create a list of runtime files in the data dir using framework list infra. -->
<FrameworkListFilename>RuntimeList.xml</FrameworkListFilename>
+
+ <!-- Include manifests in the data dir. -->
+ <PlatformManifestTargetPath>data/PlatformManifest.txt</PlatformManifestTargetPath>
<FrameworkListTargetPath>data/</FrameworkListTargetPath>
</PropertyGroup>
<Target Name="IncludePlatformManifestFile"
DependsOnTargets="GetDepprojDependencyDataFiles;GetDependencyDataFileInclusionDefaults"
BeforeTargets="GetFiles">
- <ItemGroup Condition="'$(PackageTargetRuntime)' == '' AND '$(PlatformManifestTargetPath)' != ''">
+ <!-- Create a copy with some per-pkgproj templates replaced. -->
+ <PropertyGroup>
+ <_platformManifestFileTemplateFile Condition="'%(_depprojDataFile.PlatformManifestFile)' == 'true'">%(_depprojDataFile.Identity)</_platformManifestFileTemplateFile>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="Exists('$(_platformManifestFileTemplateFile)')">
+ <_runtimeDependencyItems>@(RuntimeDependency)</_runtimeDependencyItems>
+ <_filledPlatformManifestFileContent>$([System.IO.File]::ReadAllText('$(_platformManifestFileTemplateFile)')
+ .Replace("__PackageId__", "$(Id)"))
+ </_filledPlatformManifestFileContent>
+
+ <_filledPlatformManifestFile>$(IntermediateOutputPath)PlatformManifest.txt</_filledPlatformManifestFile>
+ </PropertyGroup>
+
+ <WriteLinesToFile
+ Condition="'$(_filledPlatformManifestFile)' != ''"
+ File="$(_filledPlatformManifestFile)"
+ Lines="$(_filledPlatformManifestFileContent)"
+ Overwrite="true" />
+
+ <ItemGroup Condition="'$(PlatformManifestTargetPath)' != ''">
<File
- Include="@(_depprojDataFile)"
- Condition="'%(_depprojDataFile.PlatformManifestFile)' == 'true'"
+ Include="$(_filledPlatformManifestFile)"
TargetPath="$(PlatformManifestTargetPath)" />
</ItemGroup>
</Target>
dirs,
"Microsoft.NETCore.App.Ref"))
{
- tester.HasOnlyTheseDataFiles(
- "data/FrameworkList.xml",
- "data/PlatformManifest.txt");
-
- tester.IsTargetingPack();
- tester.HasGoodPlatformManifest();
+ tester.IsTargetingPackForPlatform();
}
}
return new NuGetArtifactTester(nupkgPath);
}
+ public PackageIdentity Identity { get; }
public NuGetVersion PackageVersion { get; }
private readonly PackageArchiveReader _reader;
public NuGetArtifactTester(string file)
{
_reader = new PackageArchiveReader(ZipFile.Open(file, ZipArchiveMode.Read));
+ Identity = _reader.NuspecReader.GetIdentity();
PackageVersion = _reader.NuspecReader.GetVersion();
}
ContainsFrameworkList("FrameworkList.xml");
}
+ public void IsTargetingPackForPlatform()
+ {
+ IsFrameworkPack();
+
+ HasOnlyTheseDataFiles(
+ "data/FrameworkList.xml",
+ "data/PlatformManifest.txt");
+
+ HasGoodPlatformManifest();
+ }
+
public void IsAppHostPack()
{
IsRuntimeSpecificPack();
{
IsRuntimeSpecificPack();
- HasOnlyTheseDataFiles("data/RuntimeList.xml");
+ HasOnlyTheseDataFiles(
+ "data/RuntimeList.xml",
+ "data/PlatformManifest.txt");
+
+ HasGoodPlatformManifest();
ContainsFrameworkList("RuntimeList.xml");
}
// 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)
{
Assert.NotNull(tester);
- tester.HasOnlyTheseDataFiles(
- "data/FrameworkList.xml",
- "data/PlatformManifest.txt");
-
- tester.IsTargetingPack();
- tester.HasGoodPlatformManifest();
+ tester.IsTargetingPackForPlatform();
}
else
{