Skip to content

Commit f8e4cea

Browse files
committed
Update build to skip building 'phisilica' on non-windows
1 parent 484863e commit f8e4cea

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

build.psm1

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
$metadata = Get-Content $PSScriptRoot/tools/metadata.json | ConvertFrom-Json
77
$dotnetSDKVersion = $(Get-Content $PSScriptRoot/global.json | ConvertFrom-Json).Sdk.Version
88
$dotnetLocalDir = if ($IsWindows) { "$env:LocalAppData\Microsoft\dotnet" } else { "$env:HOME/.dotnet" }
9+
$windowsOnlyAgents = @('phisilica')
910

1011
function Start-Build
1112
{
@@ -43,13 +44,18 @@ function Start-Build
4344
$MyInvocation.MyCommand.Parameters["AgentToInclude"].Attributes |
4445
Where-Object { $_ -is [ValidateSet] } |
4546
Select-Object -First 1 |
46-
ForEach-Object ValidValues
47+
ForEach-Object ValidValues |
48+
Skip-Unapplicable
4749
} else {
4850
$agents.Split(",", [System.StringSplitOptions]::TrimEntries)
4951
Write-Verbose "Include agents specified in Metadata.json"
5052
}
5153
}
5254

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+
5359
$RID = $Runtime ?? (dotnet --info |
5460
Select-String '^\s*RID:\s+(\w+-\w+)$' |
5561
Select-Object -First 1 |
@@ -183,6 +189,26 @@ function Start-Build
183189
}
184190
}
185191

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+
186212
function GetProjectFile($dir)
187213
{
188214
return Get-Item "$dir/*.csproj" | ForEach-Object FullName

0 commit comments

Comments
 (0)