Skip to content

Commit e7ebe9d

Browse files
committed
Add Filter-Supported-Components.ps1 script for one-line multi-component MultiTarget / WinUI checks via Test-Component-Support.ps1
1 parent 0d0b212 commit e7ebe9d

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<#
2+
.SYNOPSIS
3+
Given a list of components, filters them based on their support for the specified MultiTarget TFM(s) and WinUI major version.
4+
5+
.DESCRIPTION
6+
This script checks each component to determine if it supports the specified MultiTarget TFM(s) and WinUI major version.
7+
It returns a list of components that are supported for the given parameters.
8+
9+
.PARAMETER MultiTargets
10+
Specifies the MultiTarget TFM(s) to include for building the components.
11+
12+
.PARAMETER WinUIMajorVersion
13+
Specifies the WinUI major version to use when building for Uno. Also decides the package id and dependency variant.
14+
15+
.NOTES
16+
Author: Arlo Godfrey
17+
Date: 6/6/2025
18+
#>
19+
Param (
20+
[ValidateSet('all', 'wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')]
21+
[Alias("mt")]
22+
[Parameter(Mandatory=$true)]
23+
[string[]]$MultiTargets,
24+
25+
[Alias("c")]
26+
[Parameter(Mandatory=$true)]
27+
[string[]]$Components,
28+
29+
[Alias("winui")]
30+
[Parameter(Mandatory=$true)]
31+
[int]$WinUIMajorVersion
32+
)
33+
34+
if ($MultiTargets -eq 'all') {
35+
$MultiTargets = @('wasm', 'uwp', 'wasdk', 'wpf', 'linuxgtk', 'macos', 'ios', 'android', 'netstandard')
36+
}
37+
38+
$supportedComponents = @();
39+
40+
if ($Components -eq @('all')) {
41+
$Components = @('**')
42+
}
43+
44+
foreach ($ComponentName in $Components) {
45+
# Find all components source csproj (when wildcard), or find specific component csproj by name.
46+
$path = "$PSScriptRoot/../../components/$ComponentName/src/*.csproj"
47+
48+
foreach ($componentCsproj in Get-ChildItem -Path $path) {
49+
# Get component name from csproj path
50+
$componentPath = Get-Item "$componentCsproj/../../"
51+
$componentName = $($componentPath.BaseName);
52+
53+
# Get supported MultiTarget for this component
54+
$supportedMultiTargets = & $PSScriptRoot\Get-MultiTargets.ps1 -component $componentName
55+
56+
$componentSupportResult = & $PSScriptRoot\Test-Component-Support.ps1 `
57+
-RequestedMultiTargets $MultiTargets `
58+
-SupportedMultiTargets $supportedMultiTargets `
59+
-Component $componentName `
60+
-WinUIMajorVersion $WinUIMajorVersion
61+
62+
if ($componentSupportResult.IsSupported -eq $true) {
63+
$supportedComponents += $componentName
64+
}
65+
}
66+
}
67+
68+
69+
return $supportedComponents;

0 commit comments

Comments
 (0)