-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.cake
More file actions
111 lines (94 loc) · 2.75 KB
/
build.cake
File metadata and controls
111 lines (94 loc) · 2.75 KB
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
var target = Argument("target", "Build");
var configuration = Argument("configuration", "Release");
var version = Argument("package-version", "0.1.0"); // default version if none is passed
var srcDirectory = "./src";
var consoleCsproj = $"{srcDirectory}/BuslyCLI.Console/BuslyCLI.Console.csproj";
var testsDirectory = "./tests";
var artifactsDirectory = "./artifacts";
var solution = $"./BuslyCLI.slnx";
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.WithCriteria(c => HasArgument("rebuild"))
.Does(() =>
{
CleanDirectories($"./{srcDirectory}/**/bin");
CleanDirectories($"./{srcDirectory}/**/obj");
CleanDirectories($"./{testsDirectory}/**/bin");
CleanDirectories($"./{testsDirectory}/**/obj");
CleanDirectory(artifactsDirectory);
});
Task("Compile")
.IsDependentOn("Clean")
.Does(() =>
{
var msBuildSettings = new DotNetMSBuildSettings()
.WithProperty("InformationalVersion", version);
DotNetBuild(solution, new DotNetBuildSettings
{
Configuration = configuration,
MSBuildSettings = msBuildSettings,
});
});
Task("Test")
.IsDependentOn("Compile")
.Does(() =>
{
DotNetTest(solution, new DotNetTestSettings
{
Configuration = configuration,
NoBuild = true,
NoRestore = true,
});
});
Task("Format-Check")
.Does(() =>
{
var settings = new DotNetFormatSettings
{
NoRestore = true,
VerifyNoChanges = true
};
DotNetFormat(".", settings);
});
Task("Format-Fix")
.Does(() =>
{
var settings = new DotNetFormatSettings
{
NoRestore = true,
VerifyNoChanges = false
};
DotNetFormat(".", settings);
});
Task("Pack-DotNetTool")
.IsDependentOn("Compile")
.Does(() =>
{
DotNetPack(consoleCsproj, new DotNetPackSettings
{
Configuration = configuration,
NoRestore = true,
NoBuild = true,
OutputDirectory = "./artifacts/nupkgs",
MSBuildSettings = new DotNetMSBuildSettings
{
Version = version,
},
});
});
//////////////////////////////////////////////////////////////////////
// Targets
//////////////////////////////////////////////////////////////////////
Task("Build")
.IsDependentOn("Format-Check")
.IsDependentOn("Clean")
.IsDependentOn("Compile")
.IsDependentOn("Test");
Task("PackDotNetTool")
.IsDependentOn("Build");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);