This repository has been archived by the owner on Dec 21, 2024. It is now read-only.
forked from datalust/serilog-sinks-seq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild.ps1
66 lines (53 loc) · 1.78 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
param(
[String] $majorMinor = "0.0", # 2.0
[String] $patch = "0", # $env:APPVEYOR_BUILD_VERSION
[String] $customLogger = "", # C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll
[Switch] $notouch
)
function Set-AssemblyVersions($informational, $assembly)
{
(Get-Content assets/CommonAssemblyInfo.cs) |
ForEach-Object { $_ -replace """1.0.0.0""", """$assembly""" } |
ForEach-Object { $_ -replace """1.0.0""", """$informational""" } |
ForEach-Object { $_ -replace """1.1.1.1""", """$($informational).0""" } |
Set-Content assets/CommonAssemblyInfo.cs
}
function Install-NuGetPackages($solution)
{
nuget restore "$solution"
}
function Invoke-MSBuild($solution, $customLogger)
{
if ($customLogger)
{
msbuild "$solution" /verbosity:minimal /p:Configuration=Release /logger:"$customLogger"
}
else
{
msbuild "$solution" /verbosity:minimal /p:Configuration=Release
}
}
function Invoke-NuGetPackSpec($nuspec, $version)
{
nuget pack $nuspec -Version $version
}
function Invoke-Build($majorMinor, $patch, $customLogger, $notouch)
{
$project = "serilog-sinks-seq"
$solution = "$project.sln"
$solution4 = "$project-net40.sln"
$package="$majorMinor.$patch"
Write-Output "Building $project $package"
if (-not $notouch)
{
$assembly = "$majorMinor.0.0"
Write-Output "Assembly version will be set to $assembly"
Set-AssemblyVersions $package $assembly
}
Install-NuGetPackages $solution
Invoke-MSBuild $solution4 $customLogger
Invoke-MSBuild $solution $customLogger
Invoke-NuGetPackSpec "src/Serilog.Sinks.Seq/Serilog.Sinks.Seq.nuspec" $package
}
$ErrorActionPreference = "Stop"
Invoke-Build $majorMinor $patch $customLogger $notouch