@@ -116,28 +116,14 @@ $projects = [System.Collections.ArrayList]::new()
116116# Common/Dependencies for shared infrastructure
117117[void ]$projects.Add (" .\tooling\CommunityToolkit*\*.*proj" )
118118
119- # Deployable sample gallery heads
120- # TODO: this handles separate project heads, but won't directly handle the unified Skia head from Uno.
121- # Once we have that, just do a transform on the csproj filename inside this loop to decide the same csproj for those separate MultiTargets.
122- foreach ($multitarget in $MultiTargets ) {
123- # capitalize first letter, avoid case sensitivity issues on linux
124- $csprojFileNamePartForMultiTarget = $multitarget.substring (0 , 1 ).ToUpper() + $multitarget.Substring (1 ).ToLower()
125-
126- $path = " .\tooling\ProjectHeads\AllComponents\**\*.$csprojFileNamePartForMultiTarget .csproj" ;
127-
128- if (Test-Path $path ) {
129- [void ]$projects.Add ($path )
130- }
131- else {
132- Write-Warning " No project head could be found at $path for MultiTarget $multitarget . Skipping."
133- }
134- }
135-
136119# Individual projects
137120if ($Components -eq @ (' all' )) {
138121 $Components = @ (' **' )
139122}
140123
124+
125+ $allUsedMultiTargetPrefs = @ ()
126+
141127foreach ($componentName in $Components ) {
142128 if ($ExcludeComponents -contains $componentName ) {
143129 continue ;
@@ -146,11 +132,13 @@ foreach ($componentName in $Components) {
146132 foreach ($componentPath in Get-Item " $PSScriptRoot /../components/$componentName /" ) {
147133 $multiTargetPrefs = & $PSScriptRoot \MultiTarget\Get-MultiTargets.ps1 - component $ ($componentPath.BaseName )
148134
149- $shouldReferenceInSolution = $multiTargetPrefs.Where ({ $MultiTargets.Contains ($_ ) }).Count -gt 0
150-
135+ $usedMultiTargetPrefs = $multiTargetPrefs.Where ({ $MultiTargets.Contains ($_ ) });
136+ $shouldReferenceInSolution = $usedMultiTargetPrefs.Count -gt 0
137+
151138 if ($shouldReferenceInSolution ) {
152139 Write-Output " Add component $componentPath to solution" ;
153-
140+ $allUsedMultiTargetPrefs += $usedMultiTargetPrefs
141+
154142 [void ]$projects.Add (" .\components\$ ( $componentPath.BaseName ) \src\*.csproj" )
155143 [void ]$projects.Add (" .\components\$ ( $componentPath.BaseName ) \samples\*.Samples.csproj" )
156144 [void ]$projects.Add (" .\components\$ ( $componentPath.BaseName ) \tests\*.shproj" )
@@ -160,6 +148,26 @@ foreach ($componentName in $Components) {
160148 }
161149}
162150
151+ # Deployable sample gallery heads
152+ # Only include heads for requested MultiTargets if components were included that use them.
153+ # ===
154+ # TODO: this handles separate project heads, but won't directly handle the unified Skia head from Uno.
155+ # Once we have that, just do a transform on the csproj filename inside this loop to decide the same csproj for those separate MultiTargets.
156+ # ===
157+ foreach ($multitarget in $allUsedMultiTargetPrefs ) {
158+ # capitalize first letter, avoid case sensitivity issues on linux
159+ $csprojFileNamePartForMultiTarget = $multitarget.substring (0 , 1 ).ToUpper() + $multitarget.Substring (1 ).ToLower()
160+
161+ $path = " .\tooling\ProjectHeads\AllComponents\**\*.$csprojFileNamePartForMultiTarget .csproj" ;
162+
163+ if (Test-Path $path ) {
164+ [void ]$projects.Add ($path )
165+ }
166+ else {
167+ Write-Warning " No project head could be found at $path for MultiTarget $multitarget . Skipping."
168+ }
169+ }
170+
163171if ($UseDiagnostics.IsPresent )
164172{
165173 $sdkoptions = " -d"
0 commit comments