提交 9af7e7f0 编写于 作者: D Davis Goodin 提交者: GitHub

Add ReferencedByDefault=false to WD theme DLLs (dotnet/core-setup#7320)



Commit migrated from https://github.com/dotnet/core-setup/commit/0366d3f06d9dadbf1c1253e8b975ce6cb3a317d5
上级 bd4c8c34
......@@ -297,7 +297,7 @@
<CreateFrameworkListFile
Files="@(File)"
FileProfiles="@(FrameworkListFileProfile)"
FileClassifications="@(FrameworkListFileClass)"
TargetFile="$(FrameworkListFile)"
TargetFilePrefixes="ref/;runtimes/"
RootAttributes="@(FrameworkListRootAttributes)" />
......
......@@ -19,48 +19,48 @@
</PropertyGroup>
<ItemGroup Condition="'$(PackageTargetRuntime)' == ''">
<FrameworkListFileProfile Include="Accessibility.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="Microsoft.Win32.Registry.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="Microsoft.Win32.SystemEvents.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="PresentationCore.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.Aero.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.Aero2.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.AeroLite.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.Classic.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.Luna.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.Royale.dll" Profile="WPF" />
<FrameworkListFileProfile Include="ReachFramework.dll" Profile="WPF" />
<FrameworkListFileProfile Include="System.CodeDom.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Configuration.ConfigurationManager.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Design.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="System.Drawing.Common.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="System.Drawing.Design.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="System.Drawing.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="System.IO.Packaging.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Printing.dll" Profile="WPF" />
<FrameworkListFileProfile Include="System.Resources.Extensions.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.AccessControl.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.Cryptography.Cng.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.Cryptography.Pkcs.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.Cryptography.ProtectedData.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.Cryptography.Xml.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.Permissions.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.Principal.Windows.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Windows.Controls.Ribbon.dll" Profile="WPF" />
<FrameworkListFileProfile Include="System.Windows.Extensions.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Windows.Forms.Design.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="System.Windows.Forms.Design.Editors.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="System.Windows.Forms.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="System.Windows.Input.Manipulations.dll" Profile="WPF" />
<FrameworkListFileProfile Include="System.Windows.Presentation.dll" Profile="WPF" />
<FrameworkListFileProfile Include="System.Xaml.dll" Profile="WPF" />
<FrameworkListFileProfile Include="UIAutomationClient.dll" Profile="WPF" />
<FrameworkListFileProfile Include="UIAutomationClientSideProviders.dll" Profile="WPF" />
<FrameworkListFileProfile Include="UIAutomationProvider.dll" Profile="WPF" />
<FrameworkListFileProfile Include="UIAutomationTypes.dll" Profile="WPF" />
<FrameworkListFileProfile Include="WindowsBase.dll" Profile="WPF" />
<FrameworkListFileProfile Include="WindowsFormsIntegration.dll" />
<FrameworkListFileClass Include="Accessibility.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="Microsoft.Win32.Registry.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="Microsoft.Win32.SystemEvents.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="PresentationCore.dll" Profile="WPF" />
<FrameworkListFileClass Include="PresentationFramework.Aero.dll" Profile="WPF" ReferencedByDefault="false" />
<FrameworkListFileClass Include="PresentationFramework.Aero2.dll" Profile="WPF" ReferencedByDefault="false" />
<FrameworkListFileClass Include="PresentationFramework.AeroLite.dll" Profile="WPF" ReferencedByDefault="false" />
<FrameworkListFileClass Include="PresentationFramework.Classic.dll" Profile="WPF" ReferencedByDefault="false" />
<FrameworkListFileClass Include="PresentationFramework.dll" Profile="WPF" />
<FrameworkListFileClass Include="PresentationFramework.Luna.dll" Profile="WPF" ReferencedByDefault="false" />
<FrameworkListFileClass Include="PresentationFramework.Royale.dll" Profile="WPF" ReferencedByDefault="false" />
<FrameworkListFileClass Include="ReachFramework.dll" Profile="WPF" />
<FrameworkListFileClass Include="System.CodeDom.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Configuration.ConfigurationManager.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Design.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Drawing.Common.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Drawing.Design.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Drawing.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.IO.Packaging.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Printing.dll" Profile="WPF" />
<FrameworkListFileClass Include="System.Resources.Extensions.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Security.AccessControl.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Security.Cryptography.Cng.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Security.Cryptography.Pkcs.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Security.Cryptography.ProtectedData.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Security.Cryptography.Xml.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Security.Permissions.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Security.Principal.Windows.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Windows.Controls.Ribbon.dll" Profile="WPF" />
<FrameworkListFileClass Include="System.Windows.Extensions.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileClass Include="System.Windows.Forms.Design.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Design.Editors.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Input.Manipulations.dll" Profile="WPF" />
<FrameworkListFileClass Include="System.Windows.Presentation.dll" Profile="WPF" />
<FrameworkListFileClass Include="System.Xaml.dll" Profile="WPF" />
<FrameworkListFileClass Include="UIAutomationClient.dll" Profile="WPF" />
<FrameworkListFileClass Include="UIAutomationClientSideProviders.dll" Profile="WPF" />
<FrameworkListFileClass Include="UIAutomationProvider.dll" Profile="WPF" />
<FrameworkListFileClass Include="UIAutomationTypes.dll" Profile="WPF" />
<FrameworkListFileClass Include="WindowsBase.dll" Profile="WPF" />
<FrameworkListFileClass Include="WindowsFormsIntegration.dll" />
</ItemGroup>
<!-- Redistribute package content from other nuget packages. -->
......
......@@ -122,6 +122,16 @@ public void HasGoodPlatformManifest()
Assert.Contains(".dll", platformManifestContent);
}
public string ReadEntryContent(string entry)
{
return ReadEntryContent(_reader.GetEntry(entry));
}
public XDocument ReadEntryXDocument(string entry)
{
return ReadEntryXDocument(_reader.GetEntry(entry));
}
private void IsFrameworkPack()
{
Assert.Empty(_reader.GetPackageDependencies());
......
......@@ -3,7 +3,9 @@
// See the LICENSE file in the project root for more information.
using Microsoft.DotNet.CoreSetup.Test;
using System;
using System.Linq;
using System.Xml.Linq;
using Xunit;
namespace Microsoft.DotNet.CoreSetup.Packaging.Tests
......@@ -39,6 +41,32 @@ public void WindowsDesktopTargetingPackIsValid()
}
}
[Fact]
public void WindowsDesktopFrameworkListHasClassifications()
{
using (var tester = NuGetArtifactTester.OpenOrNull(
dirs,
"Microsoft.WindowsDesktop.App.Ref"))
{
// Let other test case handle if this is OK.
if (tester == null)
{
return;
}
XDocument fxList = tester.ReadEntryXDocument("data/FrameworkList.xml");
var files = fxList.Element("FileList").Elements("File").ToArray();
// Sanity check: did any elements we expect make it into the final file?
foreach (var attributeName in new[] { "Profile", "ReferencedByDefault" })
{
Assert.True(
files.Any(x => !string.IsNullOrEmpty(x.Attribute(attributeName)?.Value)),
$"Can't find a non-empty '{attributeName}' attribute in framework list.");
}
}
}
[Fact]
public void WindowsDesktopRuntimePackIsValid()
{
......
......@@ -20,23 +20,26 @@ public class CreateFrameworkListFile : BuildTask
public ITaskItem[] Files { get; set; }
/// <summary>
/// A list of assembly names with Profile classifications. A Profile="%(Profile)" attribute
/// is set in the framework list for the matching Files item if %(Profile) contains text.
/// A list of assembly names with classification info such as Profile. A
/// Profile="%(Profile)" attribute is included in the framework list for the matching Files
/// item if %(Profile) contains text.
///
/// If *any* FileProfiles are passed:
/// If *any* FileClassifications are passed:
///
/// *Every* file that ends up listed in the framework list must have a matching
/// FileProfile, even if %(Profile) is not set.
/// FileClassification.
///
/// Additionally, every FileProfile must find exactly one File.
/// Additionally, every FileClassification must find exactly one File.
///
/// This task fails if the conditions aren't met. This ensures the classification doesn't
/// become out of date when the list of files changes.
///
/// %(Identity): Assembly name (including ".dll").
/// %(Profile): List of profiles that apply, semicolon-delimited.
/// %(ReferencedByDefault): Empty (default) or "true"/"false". Indicates whether this file
/// should be referenced by default when the SDK uses this framework.
/// </summary>
public ITaskItem[] FileProfiles { get; set; }
public ITaskItem[] FileClassifications { get; set; }
[Required]
public string TargetFile { get; set; }
......@@ -59,13 +62,13 @@ public override bool Execute()
var frameworkManifest = new XElement("FileList", rootAttributes);
Dictionary<string, string> fileProfileLookup = FileProfiles
Dictionary<string, ITaskItem> fileClassLookup = FileClassifications
?.ToDictionary(
item => item.ItemSpec,
item => item.GetMetadata("Profile"),
item => item,
StringComparer.OrdinalIgnoreCase);
var usedFileProfiles = new HashSet<string>();
var usedFileClasses = new HashSet<string>();
foreach (var f in Files
.Where(IsTargetPathIncluded)
......@@ -157,31 +160,40 @@ public override bool Execute()
element.Add(new XAttribute("FileVersion", f.FileVersion));
if (fileProfileLookup != null)
if (fileClassLookup != null)
{
if (fileProfileLookup.TryGetValue(f.Filename, out string profile))
if (fileClassLookup.TryGetValue(f.Filename, out ITaskItem classItem))
{
string profile = classItem.GetMetadata("Profile");
if (!string.IsNullOrEmpty(profile))
{
element.Add(new XAttribute("Profile", profile));
}
usedFileProfiles.Add(f.Filename);
string referencedByDefault = classItem.GetMetadata("ReferencedByDefault");
if (!string.IsNullOrEmpty(referencedByDefault))
{
element.Add(new XAttribute("ReferencedByDefault", referencedByDefault));
}
usedFileClasses.Add(f.Filename);
}
else
{
Log.LogError($"File matches no profile classification: {f.Filename}");
Log.LogError($"File matches no classification: {f.Filename}");
}
}
frameworkManifest.Add(element);
}
foreach (var unused in fileProfileLookup
?.Keys.Except(usedFileProfiles).OrderBy(p => p)
foreach (var unused in fileClassLookup
?.Keys.Except(usedFileClasses).OrderBy(p => p)
?? Enumerable.Empty<string>())
{
Log.LogError($"Profile classification matches no files: {unused}");
Log.LogError($"Classification matches no files: {unused}");
}
Directory.CreateDirectory(Path.GetDirectoryName(TargetFile));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册