2019-11-28 01:13:45 +00:00
|
|
|
param([switch]$NoTest, [switch]$NoCoverage, [string]$Configuration = 'Release', [switch]$NoPack)
|
2019-10-06 18:38:57 +00:00
|
|
|
|
2019-10-04 16:28:14 +00:00
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
|
2020-01-03 21:28:05 +00:00
|
|
|
$netcore_tfm = 'netcoreapp3.1'
|
2019-10-21 18:54:51 +00:00
|
|
|
$net_tfm = 'net48'
|
|
|
|
$xunitVersion = '2.4.1'
|
|
|
|
$xunitNetTfmVersion = 'net472'
|
2019-10-05 15:57:58 +00:00
|
|
|
|
2020-02-10 19:03:58 +00:00
|
|
|
$env:IcedDefineConstants = ''
|
2019-10-06 18:38:57 +00:00
|
|
|
|
2019-10-21 18:54:51 +00:00
|
|
|
if ($null -eq $IsWindows) {
|
|
|
|
$IsWindows = $true
|
2019-10-06 18:38:57 +00:00
|
|
|
}
|
2019-10-04 16:28:14 +00:00
|
|
|
|
2019-11-06 01:49:44 +00:00
|
|
|
dotnet build -v:m -c $configuration src/csharp/Iced.sln
|
2019-10-24 19:06:52 +00:00
|
|
|
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
2019-10-06 18:38:57 +00:00
|
|
|
|
|
|
|
if (!$NoTest) {
|
2019-10-21 18:54:51 +00:00
|
|
|
if ($IsWindows) {
|
2019-11-06 01:49:44 +00:00
|
|
|
& $HOME/.nuget/packages/xunit.runner.console/$xunitVersion/tools/$xunitNetTfmVersion/xunit.console.exe src/csharp/Intel/Iced.UnitTests/bin/$configuration/$net_tfm/Iced.UnitTests.dll -noappdomain
|
2019-10-21 18:54:51 +00:00
|
|
|
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
2019-11-06 01:49:44 +00:00
|
|
|
& $HOME/.nuget/packages/xunit.runner.console/$xunitVersion/tools/$xunitNetTfmVersion/xunit.console.x86.exe src/csharp/Intel/Iced.UnitTests/bin/$configuration/$net_tfm/Iced.UnitTests.dll -noappdomain
|
2019-10-21 18:54:51 +00:00
|
|
|
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
|
|
|
}
|
2019-11-06 01:49:44 +00:00
|
|
|
if (!(Test-Path src/csharp/Intel/Iced.UnitTests/bin/$configuration/$netcore_tfm)) { throw "Invalid tfm: $netcore_tfm" }
|
2019-10-06 18:38:57 +00:00
|
|
|
$collectCoverage = if ($NoCoverage) { '' } else { 'true' }
|
2020-01-25 09:00:46 +00:00
|
|
|
dotnet test -c $configuration -f $netcore_tfm -p:Exclude='\"[Iced]Iced.Intel.InstructionMemorySizes,[Iced]Iced.Intel.EncoderInternal.OpCodeHandlers,[Iced]Iced.Intel.InstructionInfoInternal.InfoHandlers,[Iced]Iced.Intel.MnemonicUtils,[Iced]Iced.Intel.InstructionOpCounts\"' -p:ExcludeByFile="$PWD\src\csharp\Intel\Iced\**\*.g.cs" -p:ExcludeByAttribute='ObsoleteAttribute' -p:CollectCoverage=$collectCoverage -p:CoverletOutputFormat=lcov --no-build src/csharp/Intel/Iced.UnitTests/Iced.UnitTests.csproj -- RunConfiguration.NoAutoReporters=true RunConfiguration.TargetPlatform=X64
|
2019-10-06 18:38:57 +00:00
|
|
|
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
|
|
|
}
|
2019-10-04 16:28:14 +00:00
|
|
|
|
2019-11-28 01:13:45 +00:00
|
|
|
if (!$NoPack) {
|
|
|
|
# Don't include the IVT in the final binary
|
2020-02-10 19:03:58 +00:00
|
|
|
$env:IcedDefineConstants = 'IcedNoIVT'
|
2019-11-28 01:13:45 +00:00
|
|
|
dotnet clean -v:m -c $configuration src/csharp/Iced.sln
|
|
|
|
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
|
|
|
dotnet pack -v:m -c $configuration src/csharp/Intel/Iced/Iced.csproj
|
|
|
|
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
|
|
|
}
|
2019-10-06 18:38:57 +00:00
|
|
|
|
2020-02-10 19:03:58 +00:00
|
|
|
$env:IcedDefineConstants = ''
|