diff --git a/GenerateAllSolution.ps1 b/GenerateAllSolution.ps1 index bbb6388..fb24cf3 100644 --- a/GenerateAllSolution.ps1 +++ b/GenerateAllSolution.ps1 @@ -111,28 +111,14 @@ $projects = [System.Collections.ArrayList]::new() # Common/Dependencies for shared infrastructure [void]$projects.Add(".\tooling\CommunityToolkit*\*.*proj") -# Deployable sample gallery heads -# TODO: this handles separate project heads, but won't directly handle the unified Skia head from Uno. -# Once we have that, just do a transform on the csproj filename inside this loop to decide the same csproj for those separate MultiTargets. -foreach ($multitarget in $MultiTargets) { - # capitalize first letter, avoid case sensitivity issues on linux - $csprojFileNamePartForMultiTarget = $multitarget.substring(0,1).ToUpper() + $multitarget.Substring(1).ToLower() - - $path = ".\tooling\ProjectHeads\AllComponents\**\*.$csprojFileNamePartForMultiTarget.csproj"; - - if (Test-Path $path) { - [void]$projects.Add($path) - } - else { - Write-Warning "No project head could be found at $path for MultiTarget $multitarget. Skipping." - } -} - # Individual projects if ($Components -eq @('all')) { $Components = @('**') } + +$allUsedMultiTargetPrefs = @() + foreach ($componentName in $Components) { if ($ExcludeComponents -contains $componentName) { continue; @@ -141,11 +127,13 @@ foreach ($componentName in $Components) { foreach ($componentPath in Get-Item "$PSScriptRoot/../components/$componentName/") { $multiTargetPrefs = & $PSScriptRoot\MultiTarget\Get-MultiTargets.ps1 -component $($componentPath.BaseName) - $shouldReferenceInSolution = $multiTargetPrefs.Where({ $MultiTargets.Contains($_) }).Count -gt 0 - + $usedMultiTargetPrefs = $multiTargetPrefs.Where({ $MultiTargets.Contains($_) }); + $shouldReferenceInSolution = $usedMultiTargetPrefs.Count -gt 0 + if ($shouldReferenceInSolution) { Write-Output "Add component $componentPath to solution"; - + $allUsedMultiTargetPrefs += $usedMultiTargetPrefs + [void]$projects.Add(".\components\$($componentPath.BaseName)\src\*.csproj") [void]$projects.Add(".\components\$($componentPath.BaseName)\samples\*.Samples.csproj") [void]$projects.Add(".\components\$($componentPath.BaseName)\tests\*.shproj") @@ -155,6 +143,26 @@ foreach ($componentName in $Components) { } } +# Deployable sample gallery heads +# Only include heads for requested MultiTargets if components were included that use them. +# === +# TODO: this handles separate project heads, but won't directly handle the unified Skia head from Uno. +# Once we have that, just do a transform on the csproj filename inside this loop to decide the same csproj for those separate MultiTargets. +# === +foreach ($multitarget in $allUsedMultiTargetPrefs) { + # capitalize first letter, avoid case sensitivity issues on linux + $csprojFileNamePartForMultiTarget = $multitarget.substring(0,1).ToUpper() + $multitarget.Substring(1).ToLower() + + $path = ".\tooling\ProjectHeads\AllComponents\**\*.$csprojFileNamePartForMultiTarget.csproj"; + + if (Test-Path $path) { + [void]$projects.Add($path) + } + else { + Write-Warning "No project head could be found at $path for MultiTarget $multitarget. Skipping." + } +} + if ($UseDiagnostics.IsPresent) { $sdkoptions = "-d"