forked from stephan-tolksdorf/fparsec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack.ps1
43 lines (36 loc) · 1.44 KB
/
pack.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# This PowerShell script builds the FParsec NuGet packages.
#
# Run this script from the VS2019 Command Prompt, e.g. with
# powershell -ExecutionPolicy ByPass -File pack.ps1 -versionSuffix "" > pack.out.txt
# or on macOS e.g. with
# pwsh -File pack.ps1 -versionSuffix "" > pack.out.txt
Param(
[string]$versionSuffix = "dev"
)
$ErrorActionPreference = 'Stop'
$configSuffices = $('-LowTrust') # The non-LowTrust version currently doesn't pass the tests.
$testTargetFrameworks = @{'' = $('net6')
'-LowTrust' = $('net6')}
function invoke([string] $cmd) {
echo ''
echo $cmd
Invoke-Expression $cmd
if ($LastExitCode -ne 0) {
throw "Non-zero exit code: $LastExitCode"
}
}
foreach ($folder in $("nupkgs", "FParsecCS\obj", "FParsecCS\bin", "FParsec\obj", "FParsec\bin")) {
try {
Remove-Item $folder -recurse
} catch {}
}
foreach ($configSuffix in $configSuffices) {
$config = "Release$configSuffix"
$props = "-c $config -p:VersionSuffix=$versionSuffix -p:FParsecNuGet=true -p:Platform=AnyCPU"
invoke "dotnet build FParsec/FParsec$configSuffix.fsproj $props -v n"
invoke "dotnet pack FParsec/FParsec$configSuffix.fsproj $props -o ""$pwd\nupkgs"""
invoke "dotnet build Test/Test$configSuffix.fsproj $props -v n"
foreach ($tf in $testTargetFrameworks[$configSuffix]) {
invoke "dotnet run --no-build --project Test/Test$configSuffix.fsproj $props"
}
}