forked from gertjvr/TeamBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.ps1
56 lines (46 loc) · 2.09 KB
/
default.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
Framework '4.5.1'
properties {
$project = "TeamBot"
$birthYear = 2014
$maintainers = "Gert Jansen van Rensburg"
$description = "SlackBot for working with TeamCity"
$configuration = 'Release'
$src = resolve-path '.\src'
$packages = resolve-path '.\packages'
$build = if ($env:build_number -ne $NULL) { $env:build_number } else { '0' }
$version = [IO.File]::ReadAllText('.\VERSION.txt') + '.' + $build
}
task default -depends Test
task Package -depends Test {
rd .\package -recurse -force -ErrorAction SilentlyContinue | out-null
mkdir .\package -ErrorAction SilentlyContinue | out-null
exec { & $src\.nuget\NuGet.exe pack $src\$project\$project.csproj -Symbols -Prop Configuration=$configuration -OutputDirectory .\package }
write-host
write-host "To publish these packages, issue the following command:"
write-host " nuget push .\package\$project.$version.nupkg"
}
task Test -depends Compile {
$nunitRunner = join-path $packages "NUnit.Runners.2.6.3\tools\nunit-console.exe"
exec { & $nunitRunner $src\$project.Tests\bin\$configuration\$project.Tests.dll /nologo }
}
task Compile -depends CommonAssemblyInfo {
rd .\build -recurse -force -ErrorAction SilentlyContinue | out-null
exec { msbuild /t:clean /v:q /nologo /p:Configuration=$configuration $src\$project.sln }
exec { msbuild /t:build /v:q /nologo /p:Configuration=$configuration $src\$project.sln }
}
task CommonAssemblyInfo {
$date = Get-Date
$year = $date.Year
$copyrightSpan = if ($year -eq $birthYear) { $year } else { "$birthYear-$year" }
$copyright = "Copyright (c) $copyrightSpan $maintainers"
"using System.Reflection;
using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
[assembly: AssemblyProduct(""$project"")]
[assembly: AssemblyVersion(""$version"")]
[assembly: AssemblyFileVersion(""$version"")]
[assembly: AssemblyCopyright(""$copyright"")]
[assembly: AssemblyCompany(""$maintainers"")]
[assembly: AssemblyDescription(""$description"")]
[assembly: AssemblyConfiguration(""$configuration"")]" | out-file "$src\CommonAssemblyInfo.cs" -encoding "ASCII"
}