Skip to content

Commit 508c988

Browse files
dtivelgoofballLogic
authored andcommitted
Fix build script issues. (#33)
1 parent 258473e commit 508c988

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

build.ps1

+25-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@ $CLIRoot = Join-Path $RepoRoot 'cli'
1010
$DotNetExe = Join-Path $CLIRoot 'dotnet.exe'
1111
$NuGetExe = Join-Path $RepoRoot '.nuget\nuget.exe'
1212

13+
Function Error-Log {
14+
param(
15+
[string]$ErrorMessage,
16+
[switch]$Fatal)
17+
if (-not $Fatal) {
18+
Write-Error "[$(Trace-Time)]`t$ErrorMessage"
19+
}
20+
else {
21+
Write-Error "[$(Trace-Time)]`t[FATAL] $ErrorMessage" -ErrorAction Stop
22+
}
23+
}
24+
25+
Function Trace-Time() {
26+
$currentTime = Get-Date
27+
$lastTime = $Global:LastTraceTime
28+
$Global:LastTraceTime = $currentTime
29+
"{0:HH:mm:ss} +{1:F0}" -f $currentTime, ($currentTime - $lastTime).TotalSeconds
30+
}
31+
32+
$Global:LastTraceTime = Get-Date
33+
1334
rm -r $ArtifactsDir -Force | Out-Null
1435

1536
New-Item -ItemType Directory -Force -Path $CLIRoot | Out-Null
@@ -55,18 +76,20 @@ pushd $TestDir
5576
& $DotNetExe test --configuration $Configuration -f netcoreapp1.0
5677

5778
if (-not $?) {
79+
popd
5880
Error-Log "Tests failed!!!"
5981
Exit 1
6082
}
6183

6284
# net46
6385
& $DotNetExe build --configuration $Configuration -f net46 --runtime win7-x64
6486

65-
$xunit = Join-Path $RepoRoot packages\xunit.runner.console.2.1.0\tools\xunit.console.x86.exe
87+
$xunit = Join-Path $RepoRoot packages\xunit.runner.console.2.1.0\tools\xunit.console.exe
6688

67-
& $xunit bin\release\net46\win7-x64\json-ld.net.tests.dll -html (Join-Path $ArtifactsDir "testresults.html")
89+
& $xunit bin\$Configuration\net46\win7-x64\json-ld.net.tests.dll -html (Join-Path $ArtifactsDir "testresults.html")
6890

6991
if (-not $?) {
92+
popd
7093
Write-Host "Tests failed!!!"
7194
Exit 1
7295
}

0 commit comments

Comments
 (0)