-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.cake
53 lines (47 loc) · 1.33 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
var semanticVersion = Argument<string>("packageversion", "1.0.0");
var version = semanticVersion.Split(new[] { '-' }).FirstOrDefault() ?? semanticVersion;
Information("Version: {0}", semanticVersion);
Information("Legacy version: {0}", version);
Task("Clean")
.Does(() =>
{
CleanDirectory("./.artifacts");
});
Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
DotNetBuild("./src/Snitch.sln", new DotNetBuildSettings
{
Configuration = "Release",
MSBuildSettings = new DotNetMSBuildSettings()
.TreatAllWarningsAs(MSBuildTreatAllWarningsAs.Error)
.WithProperty("Version", version)
.WithProperty("AssemblyVersion", version)
.WithProperty("FileVersion", version)
});
});
Task("Run-Tests")
.IsDependentOn("Build")
.Does(() =>
{
DotNetTest("./src/Snitch.Tests/Snitch.Tests.csproj", new DotNetTestSettings
{
Configuration = "Release"
});
});
Task("Pack")
.IsDependentOn("Run-Tests")
.Does(() =>
{
DotNetPack("./src/Snitch.sln", new DotNetPackSettings
{
Configuration = "Release",
NoRestore = true,
NoBuild = true,
OutputDirectory = "./.artifacts",
MSBuildSettings = new DotNetMSBuildSettings()
.WithProperty("PackageVersion", semanticVersion)
});
});
RunTarget("Pack")