@@ -91,12 +91,12 @@ Param (
9191)
9292
9393if ($MultiTargets -eq ' all' ) {
94- $MultiTargets = @ (' wasm' , ' uwp' , ' wasdk' , ' wpf' , ' linuxgtk' , ' macos' , ' ios' , ' android' , ' netstandard' )
94+ $MultiTargets = @ (' wasm' , ' uwp' , ' wasdk' , ' wpf' , ' linuxgtk' , ' macos' , ' ios' , ' android' , ' netstandard' )
9595}
9696
97- if ($ExcludeMultiTargets -eq $null )
97+ if ($null -eq $ExcludeMultiTargets )
9898{
99- $ExcludeMultiTargets = @ ()
99+ $ExcludeMultiTargets = @ ()
100100}
101101
102102$MultiTargets = $MultiTargets | Where-Object { $_ -notin $ExcludeMultiTargets }
@@ -175,20 +175,30 @@ function Invoke-MSBuildWithBinlog {
175175
176176# Components are built individually
177177foreach ($ComponentName in $Components ) {
178- # Find all components source csproj (when wildcard), or find specific component csproj by name.
178+ # Find all components source csproj (when wildcard), or find specific component csproj by name.
179179 foreach ($componentCsproj in Get-ChildItem - Path " $PSScriptRoot /../components/$ComponentName /$ComponentDir /*.csproj" ) {
180180 # Get component name from csproj path
181181 $componentPath = Get-Item " $componentCsproj /../../"
182182
183183 # Get supported MultiTarget for this component
184184 $supportedMultiTargets = & $PSScriptRoot \MultiTarget\Get-MultiTargets.ps1 - component $ ($componentPath.BaseName )
185185
186- # If this component doesn't list one of the provided MultiTargets, skip it
187- if ($MultiTargets -notin $supportedMultiTargets ) {
188- Write-Warning " Skipping $ ( $componentPath.BaseName ) , no supported MultiTargets were included for build."
186+ # Flag to check if any of the requested targets are supported by the component
187+ $isTargetSupported = $false
188+
189+ foreach ($requestedTarget in $MultiTargets ) {
190+ if ($requestedTarget -in $supportedMultiTargets ) {
191+ $isTargetSupported = $true
192+ break
193+ }
194+ }
195+
196+ # If none of the requested targets are supported by the component, we can skip build to save time and avoid errors.
197+ if (-not $isTargetSupported ) {
198+ Write-Warning " Skipping $ ( $componentPath.BaseName ) , none of the requested MultiTargets are enabled for this component."
189199 continue
190200 }
191201
192202 Invoke-MSBuildWithBinlog $componentCsproj.FullName $EnableBinLogs $BinlogOutput
193203 }
194- }
204+ }
0 commit comments