-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.cake
134 lines (104 loc) · 2.79 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//#addin nuget:?package=Cake.DocFx&version=0.5.0
//#tool "docfx.console"
var solutionFile = "Sandwych.QuickGraph.sln";
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
Task("Restore-NuGet-Packages")
.Does(() =>
{
DotNetCoreRestore(solutionFile, new DotNetCoreRestoreSettings
{
Verbosity = DotNetCoreVerbosity.Minimal,
});
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
Information("Building Libraries...");
var libSettings = new DotNetCoreBuildSettings() {
NoRestore = true,
Configuration = configuration,
};
if(!IsRunningOnWindows())
{
libSettings.Framework = "netstandard2.0";
}
var libProjects = GetFiles("./src/**/*.csproj");
foreach(var project in libProjects)
{
// .NET Core
DotNetCoreBuild(project.ToString(), libSettings);
}
Information("Building Unit tests...");
var testSettings = new DotNetCoreBuildSettings() {
NoRestore = true,
Configuration = configuration,
};
var testProjects = GetFiles("./test/**/*.csproj");
foreach(var project in testProjects)
{
// .NET Core
DotNetCoreBuild(project.ToString(), testSettings);
}
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
{
Framework = "netcoreapp2.0",
NoBuild = true,
NoRestore = true,
Configuration = configuration,
};
var projects = GetFiles("./test/**/*.Tests.csproj");
foreach(var project in projects)
{
DotNetCoreTest(project.ToString(), settings);
}
});
Task("Create-NuGet-Packages")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
// Build libraries
var projects = GetFiles("./src/**/*.csproj");
foreach(var project in projects)
{
var name = project.GetDirectory().FullPath;
if(name.EndsWith("Tests") || name.EndsWith("Xunit"))
{
continue;
}
DotNetCorePack(project.FullPath, new DotNetCorePackSettings {
NoBuild = true,
NoRestore = true,
IncludeSymbols = false,
Configuration = configuration,
});
}
});
/*
Task("Generate-Docs").Does(() => {
DocFxBuild("./docs/docfx.json");
});
Task("View-Docs").Does(() => {
DocFxBuild("./docs/docfx.json", new DocFxBuildSettings {
Serve = true,
});
});
*/
Task("Travis")
.IsDependentOn("Run-Unit-Tests");
Task("Appveyor-Build")
.IsDependentOn("Create-NuGet-Packages");
Task("Appveyor-Test")
.IsDependentOn("Run-Unit-Tests");
Task("Default")
.IsDependentOn("Run-Unit-Tests")
.Does(() => {
Information("Executing the default task...");
});
RunTarget(target);