forked from damianh/LibLog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
33 lines (25 loc) · 1022 Bytes
/
build.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
function Run-Task
{
param(
[scriptblock] $block
)
& $block
if($LASTEXITCODE -ne 0)
{
exit $LASTEXITCODE
}
}
if (-not (Test-Path env:APPVEYOR_BUILD_NUMBER)) { $env:APPVEYOR_BUILD_NUMBER = '0' }
$suffix = "build." + $env:APPVEYOR_BUILD_NUMBER
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
Run-Task { dotnet build src\LibLog.sln -c Release }
Run-Task { dotnet test src\LibLog.Tests -c Release --no-build }
Get-ChildItem ./src/*.pp -Recurse | ForEach-Object { Remove-Item $_ }
$files = (Get-ChildItem -Path ./src/LibLog -Filter *.cs -File) +
(Get-ChildItem -Path ./src/LibLog/LogProviders -Filter *.cs -File)
$files | ForEach-Object {
$in = (Get-Content $_.FullName).Replace('YourRootNamespace.', '$rootnamespace$.');
Set-Content ($_.FullName + ".pp") -Value '// <auto-generated/>', '// ReSharper disable CheckNamespace', $in;
}
& $NUGET_EXE pack src/LibLog/LibLog.nuspec -Suffix $suffix -OutputDirectory artifacts