-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.cake
60 lines (59 loc) · 1.89 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
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument ("target", "Default");
var configuration = Argument ("configuration", "Release");
var artifactDirectory = "./artifacts";
var solutions = GetFiles ("./**/*.sln");
var solutionPaths = solutions.Select (solution => solution.GetDirectory ());
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task ("Clean")
.Does (() => {
var cleanDirectories = new [] {
artifactDirectory
};
foreach (var path in solutionPaths) {
Information ("Cleaning {0}", path);
CleanDirectories (path + "/**/bin/" + configuration);
CleanDirectories (path + "/**/obj/" + configuration);
}
CleanDirectories (cleanDirectories);
DotNetCoreClean (".");
});
Task ("Restore")
.Does (() => {
foreach (var path in solutionPaths) {
DotNetCoreRestore (path.FullPath);
}
});
Task ("Build")
.IsDependentOn ("Clean")
.IsDependentOn ("Restore")
.Does (() => {
foreach (var path in solutionPaths) {
DotNetCoreBuild (path.FullPath);
}
});
Task ("Run-Unit-Tests")
.Does (() => {
var projects = GetFiles ("./test/**/*.csproj");
var settings = new DotNetCoreTestSettings {
Configuration = configuration,
NoBuild = true
};
foreach (var project in projects) {
DotNetCoreTest (project.FullPath, settings);
}
});
Task ("Pack")
.Does (() => {
DotNetCorePack (
"./src/ExtensionMethods",
new DotNetCorePackSettings {
OutputDirectory = artifactDirectory,
Configuration = configuration
});
});
RunTarget (target);