-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.ps1
103 lines (81 loc) · 2.7 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
param(
[String] $majorMinor = "5.7", # 5.7
[String] $patch = "3", # $env:APPVEYOR_BUILD_VERSION
[String] $customLogger = "", # C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll
[Switch] $notouch,
[String] $project = "ReflectSoftware.Insight.Extensions.NLog"
)
function Set-AssemblyVersions($informational, $assembly)
{
(Get-Content assets/VersionInfo.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/VersionInfo.cs
}
function Install-NuGetPackages($solution)
{
#(New-Object Net.WebClient).DownloadFile('https://www.nuget.org/nuget.exe', 'C:\Tools\NuGet\NuGet.exe')
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-NuGetPackProj($csproj)
{
nuget pack -Prop Configuration=Release -Symbols $csproj
}
function Invoke-NuGetPackSpec($nuspec, $version)
{
nuget pack $nuspec -Version $version -OutputDirectory ..\
}
function Invoke-NuGetPack($version)
{
#ls src/**/*.csproj |
# Where-Object { -not ($_.Name -like "*net40*") } |
# ForEach-Object { Invoke-NuGetPackProj $_ }
ls src/**/*.csproj |
Where-Object { -not ($_.Name -like "*net40*") } |
ForEach-Object { Invoke-NuGetPackProj $_ }
pushd .\src
Invoke-NuGetPackSpec "ReflectSoftware.Insight.Extensions.NLog.nuspec" $version
popd
}
function Invoke-Build($project, $majorMinor, $patch, $customLogger, $notouch)
{
#$solution2 = "$project 2.0.sln"
#$solution4 = "$project 4.0.sln"
$solution45 = "$project 4.5.sln"
$package="$majorMinor.$patch"
Write-Output "$project $package"
if (-not $notouch)
{
$assembly = "$majorMinor.0.0"
Write-Output "Assembly version will be set to $assembly"
Set-AssemblyVersions $package $assembly
}
Install-NuGetPackages $solution45
Invoke-MSBuild $solution45 $customLogger
#Install-NuGetPackages $solution4
#Invoke-MSBuild $solution4 $customLogger
#Install-NuGetPackages $solution2
#Invoke-MSBuild $solution2 $customLogger
Invoke-NuGetPack $package
}
$ErrorActionPreference = "Stop"
if (-not $sln)
{
$slnfull = ls *.sln |
Where-Object { -not ($_.Name -like "*net40*") } |
Select -first 1
$sln = $slnfull.BaseName
}
Invoke-Build $project $majorMinor $patch $customLogger $notouch