-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cake
99 lines (83 loc) · 2.12 KB
/
build.cake
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
#tool nuget:?package=xunit.runner.console&version=2.2.0
#load build/paths.cake
#load build/version.cake
var target = Argument("Target", "Build");
var configuration = Argument("Configuration", "Release");
var packageOutputPath = Argument("PackageOutputPath", "packages");
var packageVersion = "0.1.0";
Task("Restore")
.Does(() =>
{
NuGetRestore(Paths.SolutionFile);
});
Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
MSBuild(
Paths.SolutionFile,
settings =>
{
settings.SetConfiguration(configuration)
.WithTarget("Build")
.WithProperty("BuildInParallel", "true");
settings.MaxCpuCount = 0;
});
});
Task("Clean")
.IsDependentOn("Remove-Packages")
.Does(() =>
{
DotNetBuild(
Paths.SolutionFile,
settings => settings.SetConfiguration("Release")
.WithTarget("Clean"));
DotNetBuild(
Paths.SolutionFile,
settings => settings.SetConfiguration("Debug")
.WithTarget("Clean"));
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
XUnit2($"**/bin/{configuration}/*Tests.dll");
});
Task("Remove-Packages")
.Does(() =>
{
CleanDirectory(packageOutputPath);
});
Task("Package-NuGet")
.IsDependentOn("Test")
.IsDependentOn("Version")
.IsDependentOn("Remove-Packages")
.Does(() =>
{
EnsureDirectoryExists(packageOutputPath);
NuGetPack(
Paths.NuspecFile,
new NuGetPackSettings
{
Version = packageVersion,
OutputDirectory = packageOutputPath
}
);
});
Task("Package-Chocolatey")
.IsDependentOn("Test")
.IsDependentOn("Version")
.IsDependentOn("Remove-Packages")
.Does(() =>
{
EnsureDirectoryExists(packageOutputPath);
ChocolateyPack(
Paths.NuspecFile,
new ChocolateyPackSettings
{
Version = packageVersion,
OutputDirectory = packageOutputPath
}
);
});
RunTarget(target);