-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
84 lines (72 loc) · 2.61 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
var target = Argument("Target", "Default");
var configuration = Argument("Configuration", "Release");
var solution = "./imagini.sln";
var testProject = "./Tests/Tests.csproj";
Task("Restore").Does(() => {
DotNetCoreRestore();
});
Task("Clean").Does(() => {
DotNetCoreClean(solution);
CleanDirectory("./docs/coverage/");
CleanDirectory("./docs/api/");
});
Task("Build").Does(() => {
DotNetCoreBuild(solution, new DotNetCoreBuildSettings {
Configuration = configuration
});
}).OnError(ex => {
Error("Build Failed");
throw ex;
});
Task("Test").Does(() => {
DotNetCoreTest(testProject, new DotNetCoreTestSettings {
NoBuild = true,
Configuration = configuration,
ArgumentCustomization = (b) => b
.Append("/p:CollectCoverage=true")
.Append("/p:CoverletOutputFormat=opencover")
.Append("/p:CoverletOutput=./coverage.xml")
.Append("/p:Exclude=\"[SDL*]*\"")
});
});
Task("ApiDoc").Does(() => {
DotNetCoreTool(solution, "doc", "-f Html -s ./Imagini.Core/ -o ./docs/api/core/");
DotNetCoreTool(solution, "doc", "-f Html -s ./Imagini.2D/ -o ./docs/api/2d/");
DotNetCoreTool(solution, "doc", "-f Html -s ./Imagini.ImageSharp/ -o ./docs/api/imagesharp/");
DotNetCoreTool(solution, "doc", "-f Html -s ./Imagini.Fonts/ -o ./docs/api/fonts/");
CopyFile("docs/index.css", "docs/api/core/index.css");
CopyFile("docs/index.css", "docs/api/2d/index.css");
CopyFile("docs/index.css", "docs/api/imagesharp/index.css");
CopyFile("docs/index.css", "docs/api/fonts/index.css");
});
Task("ReportCoverage").Does(() => {
var param = "\"-reports:./Tests/coverage.xml\" " +
"\"-targetdir:./docs/coverage/\" " +
"\"-sourcedirs:./Imagini.Core/;./Imagini.2D/\" " +
"\"-reporttypes:HTML;Badges\"";
Information("Running 'reportgenerator " + param + "'");
StartProcess("reportgenerator", new ProcessSettings {
Arguments = param
});
// DotNetCoreTool(testProject, "reportgenerator", param);
});
Task("InstallTools").Does(() => {
StartProcess("dotnet", new ProcessSettings {
Arguments = "tool install --global dotnet-reportgenerator-globaltool"
});
StartProcess("dotnet", new ProcessSettings {
Arguments = "tool install --global dotbook"
});
});
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("ReportCoverage")
.IsDependentOn("ApiDoc");
Task("CleanBuild")
.IsDependentOn("Clean")
.IsDependentOn("Default");
Task("CI")
.IsDependentOn("InstallTools")
.IsDependentOn("CleanBuild");
RunTarget(target);