Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add File Classification for runtime pack #12578

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/Microsoft.Private.Winforms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is a transport package consumed by [WPF](https://github.com/dotnet/wpf/) an

## `sdk\dotnet-windowsdesktop` folder

This folder contains props and targets used to ingest our assemblies into the [Windows Desktop SDK](https://github.com/dotnet/windowsdesktop/) for purpose of bundling of our analyzers into Microsoft.WindowsDesktop.App.Ref pack.
This folder contains props and targets used to ingest our assemblies into the [Windows Desktop SDK](https://github.com/dotnet/windowsdesktop/), bundling the correct set of assemblies into either the Microsoft.WindowsDesktop.App.Ref pack or Microsoft.WindowsDesktop.App.Runtime pack.

* [`System.Windows.Forms.FileClassification.props`](sdk\dotnet-windowsdesktop\System.Windows.Forms.FileClassification.props) contains a manifest for the "WindowsForms" SDK[¹](#ref1), i.e. a list of our assemblies that form it.
The file is imported by [Microsoft.WindowsDesktop.App.Ref project](https://github.com/dotnet/windowsdesktop/blob/main/src/windowsdesktop/src/sfx/Microsoft.WindowsDesktop.App.Ref.sfxproj).<br/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<!--
This props file comes from dotnet/winforms. It gets ingested by dotnet/windowsdesktop and processed by
pkg\windowsdesktop\sfx\Microsoft.WindowsDesktop.App.Ref.sfxproj.
src\windowsdesktop\src\sfx\Microsoft.WindowsDesktop.App.Ref.sfxproj and src\windowsdesktop\src\sfx\Microsoft.WindowsDesktop.App.Runtime.sfxproj.
-->
<Project>
<ItemGroup Condition="'$(PackageTargetRuntime)' == ''">
<!-- File classifications that should be included for both the ref and runtime pack. -->
<ItemGroup>
<FrameworkListFileClass Include="Microsoft.VisualBasic.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="Microsoft.VisualBasic.Forms.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Design.dll" Profile="WindowsForms" />
Expand All @@ -12,14 +13,26 @@
<FrameworkListFileClass Include="System.Drawing.dll" Profile="WindowsForms" />
<!-- System.Private.Windows.Core is now used by both WPF and Windows Forms -->
<FrameworkListFileClass Include="System.Private.Windows.Core.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.Forms.Primitives.dll" Profile="WindowsForms" />
</ItemGroup>

<!-- File classifications that should only be included for the ref pack. -->
<ItemGroup Condition="'$(PackageTargetRuntime)' == ''">
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.CodeFixes.CSharp.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.CodeFixes.VisualBasic.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.CSharp.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Analyzers.VisualBasic.dll" Profile="WindowsForms" />
<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.Forms.Primitives.dll" Profile="WindowsForms" />
</ItemGroup>

<!-- File classifications that should only be included for the runtime pack. Note analyzers should not be included in the runtime pack. -->
<ItemGroup Condition="'$(PackageTargetRuntime)' != ''">
<FrameworkListFileClass Include="Microsoft.VisualBasic.Forms.resources.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Design.resources.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.Primitives.resources.dll" Profile="WindowsForms" />
<FrameworkListFileClass Include="System.Windows.Forms.resources.dll" Profile="WindowsForms" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ Param(

$assemblies = $xmlDoc.package.files.file | `
Where-Object {
# take only assemblies placed in \lib\netcoreappX.Y, and that are not resources
# also exclude Accessibility.dll as it is explicitly added to WindowsDesktop bundle
# take assemblies that are not analyzer resources. Also exclude Accessibility.dll as it is explicitly added to WindowsDesktop bundle.
($_.target.StartsWith('lib\') -or $_.target.StartsWith('ref\') -or $_.target.StartsWith('sdk\analyzers\'))`
-and $_.target.EndsWith('.dll', [System.StringComparison]::OrdinalIgnoreCase) `
-and !$_.target.EndsWith('resources.dll', [System.StringComparison]::OrdinalIgnoreCase) `
-and !$_.target.EndsWith('\Accessibility.dll', [System.StringComparison]::OrdinalIgnoreCase)
-and !$_.target.EndsWith('\Accessibility.dll', [System.StringComparison]::OrdinalIgnoreCase) `
-and $_.target -notmatch "..*Analyzers..*.resources.dll"
} | `
Select-Object -Unique @{Name="Path";Expression={Split-Path $_.target -Leaf}} | `
Select-Object -ExpandProperty Path;
Expand Down Expand Up @@ -61,17 +60,49 @@ else {
#>
Write-Host "Regenerating the manifest" -ForegroundColor Green

$sorted = $assemblies | Sort-Object;

$output = "<!--
This props file comes from dotnet/winforms. It gets ingested by dotnet/windowsdesktop and processed by
pkg\windowsdesktop\sfx\Microsoft.WindowsDesktop.App.Ref.sfxproj.
src\windowsdesktop\src\sfx\Microsoft.WindowsDesktop.App.Ref.sfxproj and src\windowsdesktop\src\sfx\Microsoft.WindowsDesktop.App.Runtime.sfxproj.
-->
<Project>
<!-- File classifications that should be included for both the ref and runtime pack. -->
<ItemGroup>`r`n";
$sorted | `
ForEach-Object {
$assembly = $_;
if (!$assembly.Contains("Analyzers") `
-and !$assembly.EndsWith("resources.dll")) {
if ($assembly.Equals("System.Private.Windows.Core.dll")) {
$output += " <!-- System.Private.Windows.Core is now used by both WPF and Windows Forms -->`r`n <FrameworkListFileClass Include=`"$assembly`" Profile=`"WindowsForms;WPF`" />`r`n"
}
else {
$output += " <FrameworkListFileClass Include=`"$assembly`" Profile=`"WindowsForms`" />`r`n"
}
}
}
$output += " </ItemGroup>

<!-- File classifications that should only be included for the ref pack. -->
<ItemGroup Condition=`"'`$(PackageTargetRuntime)' == ''`">`r`n";
$assemblies | `
Sort-Object | `
$sorted | `
ForEach-Object {
$assembly = $_;
if ($assembly.Contains("Analyzers")) {
$output += " <FrameworkListFileClass Include=`"$assembly`" Profile=`"WindowsForms`" />`r`n"
}
}
$output += " </ItemGroup>

<!-- File classifications that should only be included for the runtime pack. Note analyzers should not be included in the runtime pack. -->
<ItemGroup Condition=`"'`$(PackageTargetRuntime)' != ''`">`r`n";
$sorted | `
ForEach-Object {
$assembly = $_;
$output += " <FrameworkListFileClass Include=`"$assembly`" Profile=`"WindowsForms`" />`r`n"
if ($assembly.EndsWith("resources.dll")) {
$output += " <FrameworkListFileClass Include=`"$assembly`" Profile=`"WindowsForms`" />`r`n"
}
}
$output += " </ItemGroup>
</Project>";
Expand Down