|
| 1 | +<# |
| 2 | +.SYNOPSIS |
| 3 | + Generates the solution file comprising of platform heads for samples, individual component projects, and tests. |
| 4 | +.DESCRIPTION |
| 5 | + Used mostly for CI building of everything and testing end-to-end scenarios involving the full |
| 6 | + sample app experience. |
| 7 | +
|
| 8 | + Otherwise it is recommended to focus on an individual component's solution instead. |
| 9 | +.PARAMETER IncludeHeads |
| 10 | + List of TFM based projects to include. This can be 'all', 'uwp', or 'winappsdk'. |
| 11 | +
|
| 12 | + Defaults to 'all' for local-use. |
| 13 | +.PARAMETER UseDiagnostics |
| 14 | + Add extra diagnostic output to running slngen, such as a binlog, etc... |
| 15 | +.EXAMPLE |
| 16 | + C:\PS> .\GenerateAllSolution -IncludeHeads winappsdk |
| 17 | + Build a solution that doesn't contain UWP projects. |
| 18 | +.NOTES |
| 19 | + Author: Windows Community Toolkit Labs Team |
| 20 | + Date: April 27, 2022 |
| 21 | +#> |
| 22 | +Param ( |
| 23 | + [Parameter(HelpMessage = "The heads to include for building platform samples and tests.", ParameterSetName = "IncludeHeads")] |
| 24 | + [ValidateSet('all', 'uwp', 'winappsdk')] |
| 25 | + [string]$IncludeHeads = 'all', |
| 26 | + |
| 27 | + [Parameter(HelpMessage = "Add extra diagnostic output to slngen generator.")] |
| 28 | + [switch]$UseDiagnostics = $false |
| 29 | +) |
| 30 | + |
| 31 | +# Generate required props for "All" solution. |
| 32 | +& ./common/MultiTarget/GenerateAllProjectReferences.ps1 |
| 33 | +& ./common/GenerateVSCodeLaunchConfig.ps1 |
| 34 | + |
| 35 | +# Set up constant values |
| 36 | +$generatedSolutionFilePath = 'Toolkit.Labs.All.sln' |
| 37 | +$platforms = '"Any CPU;x64;x86;ARM64"' |
| 38 | +$slngenConfig = "--folders true --collapsefolders true --ignoreMainProject" |
| 39 | + |
| 40 | +# remove previous file if it exists |
| 41 | +if (Test-Path -Path $generatedSolutionFilePath) |
| 42 | +{ |
| 43 | + Remove-Item $generatedSolutionFilePath |
| 44 | + Write-Host "Removed previous solution file" |
| 45 | +} |
| 46 | + |
| 47 | +# Projects to include |
| 48 | +$projects = [System.Collections.ArrayList]::new() |
| 49 | + |
| 50 | +# Common/Dependencies for shared infrastructure |
| 51 | +[void]$projects.Add(".\common\**\*.*proj") |
| 52 | + |
| 53 | +# Sample Apps |
| 54 | +if ($IncludeHeads -ne 'winappsdk') |
| 55 | +{ |
| 56 | + [void]$projects.Add(".\platforms\**\*.Uwp.csproj") |
| 57 | +} |
| 58 | + |
| 59 | +if ($IncludeHeads -ne 'uwp') |
| 60 | +{ |
| 61 | + [void]$projects.Add(".\platforms\**\*.WinAppSdk.csproj") |
| 62 | +} |
| 63 | + |
| 64 | +[void]$projects.Add(".\platforms\**\*.Droid.csproj") |
| 65 | +[void]$projects.Add(".\platforms\**\*.*OS.csproj") |
| 66 | +[void]$projects.Add(".\platforms\**\*.Skia.*.csproj") |
| 67 | +[void]$projects.Add(".\platforms\**\*.Wasm.csproj") |
| 68 | + |
| 69 | +# Tests |
| 70 | +if ($IncludeHeads -ne 'winappsdk') |
| 71 | +{ |
| 72 | + [void]$projects.Add(".\tests\**\*.Uwp.csproj") |
| 73 | +} |
| 74 | + |
| 75 | +if ($IncludeHeads -ne 'uwp') |
| 76 | +{ |
| 77 | + [void]$projects.Add(".\tests\**\*.WinAppSdk.csproj") |
| 78 | +} |
| 79 | + |
| 80 | +# Individual projects |
| 81 | +[void]$projects.Add(".\labs\**\src\*.csproj") |
| 82 | +[void]$projects.Add(".\labs\**\samples\*.Samples\*.Samples.csproj") |
| 83 | +[void]$projects.Add(".\labs\**\tests\*.Tests\*.shproj") |
| 84 | + |
| 85 | +if ($UseDiagnostics.IsPresent) |
| 86 | +{ |
| 87 | + $sdkoptions = " -d" |
| 88 | + $diagnostics = '-bl:slngen.binlog --consolelogger:"ShowEventId;Summary;Verbosity=Detailed" --filelogger:"LogFile=slngen.log;Append;Verbosity=Diagnostic;Encoding=UTF-8" ' |
| 89 | +} |
| 90 | +else |
| 91 | +{ |
| 92 | + $sdkoptions = "" |
| 93 | + $diagnostics = "" |
| 94 | +} |
| 95 | + |
| 96 | +$cmd = "dotnet$sdkoptions tool run slngen -o $generatedSolutionFilePath $slngenConfig $diagnostics--platform $platforms $($projects -Join ' ')" |
| 97 | + |
| 98 | +Write-Output "Running Command: $cmd" |
| 99 | + |
| 100 | +Invoke-Expression $cmd |
0 commit comments