Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
fparsec/pack.ps1
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
43 lines (36 sloc)
1.44 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" | |
} | |
} |