|
6 | 6 | $metadata = Get-Content $PSScriptRoot/tools/metadata.json | ConvertFrom-Json |
7 | 7 | $dotnetSDKVersion = $(Get-Content $PSScriptRoot/global.json | ConvertFrom-Json).Sdk.Version |
8 | 8 | $dotnetLocalDir = if ($IsWindows) { "$env:LocalAppData\Microsoft\dotnet" } else { "$env:HOME/.dotnet" } |
| 9 | +$windowsOnlyAgents = @('phisilica') |
9 | 10 |
|
10 | 11 | function Start-Build |
11 | 12 | { |
@@ -43,13 +44,18 @@ function Start-Build |
43 | 44 | $MyInvocation.MyCommand.Parameters["AgentToInclude"].Attributes | |
44 | 45 | Where-Object { $_ -is [ValidateSet] } | |
45 | 46 | Select-Object -First 1 | |
46 | | - ForEach-Object ValidValues |
| 47 | + ForEach-Object ValidValues | |
| 48 | + Skip-Unapplicable |
47 | 49 | } else { |
48 | 50 | $agents.Split(",", [System.StringSplitOptions]::TrimEntries) |
49 | 51 | Write-Verbose "Include agents specified in Metadata.json" |
50 | 52 | } |
51 | 53 | } |
52 | 54 |
|
| 55 | + if (HasUnapplicableAgent $AgentToInclude) { |
| 56 | + throw "One or more specified agents cannot be built on the current platform: $($windowsOnlyAgents -join ', ').`nPlease skip them and try again." |
| 57 | + } |
| 58 | + |
53 | 59 | $RID = $Runtime ?? (dotnet --info | |
54 | 60 | Select-String '^\s*RID:\s+(\w+-\w+)$' | |
55 | 61 | Select-Object -First 1 | |
@@ -183,6 +189,26 @@ function Start-Build |
183 | 189 | } |
184 | 190 | } |
185 | 191 |
|
| 192 | +filter Skip-Unapplicable { |
| 193 | + if ($IsWindows -or $windowsOnlyAgents -notcontains $_) { |
| 194 | + $_ |
| 195 | + } |
| 196 | +} |
| 197 | + |
| 198 | +function HasUnapplicableAgent($specifiedAgents) { |
| 199 | + if ($IsWindows) { |
| 200 | + return $false |
| 201 | + } |
| 202 | + |
| 203 | + foreach ($agent in $windowsOnlyAgents) { |
| 204 | + if ($specifiedAgents -contains $agent) { |
| 205 | + return $true |
| 206 | + } |
| 207 | + } |
| 208 | + |
| 209 | + return $false |
| 210 | +} |
| 211 | + |
186 | 212 | function GetProjectFile($dir) |
187 | 213 | { |
188 | 214 | return Get-Item "$dir/*.csproj" | ForEach-Object FullName |
|
0 commit comments