-
Notifications
You must be signed in to change notification settings - Fork 43
/
build.cake
94 lines (81 loc) · 2.76 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
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var version = string.Format("{0:yy}.{1:d3}.{2}"
, DateTime.UtcNow
, DateTime.UtcNow.DayOfYear
, (int)((DateTime.UtcNow - DateTime.UtcNow.Date).TotalSeconds / 2));
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(Directory("./InnovatorAdmin/bin/"));
CleanDirectory(Directory("./InnovatorAdmin.Api/bin/"));
CleanDirectory(Directory("./InnovatorAdmin.Cmd/bin/"));
CleanDirectory(Directory("./artifacts/"));
});
Task("Publish")
.IsDependentOn("Clean")
.Does(() =>
{
var msBuild = new DotNetMSBuildSettings();
msBuild.Properties["Version"] = new string[] { version };
var deleteSettings = new DeleteDirectorySettings {
Recursive = true,
Force = true
};
DotNetPublish("./InnovatorAdmin/InnovatorAdmin.csproj", new DotNetPublishSettings
{
Configuration = configuration,
OutputDirectory = "./publish/",
SelfContained = true,
PublishSingleFile = false,
PublishReadyToRun = false,
PublishTrimmed = false,
MSBuildSettings = msBuild,
Verbosity = DotNetVerbosity.Detailed
});
Zip("./publish/", $"./artifacts/InnovatorAdmin.{version}.zip");
DeleteDirectory("./publish", deleteSettings);
DotNetPublish("./InnovatorAdmin.Cmd/InnovatorAdmin.Cmd.csproj", new DotNetPublishSettings
{
Configuration = configuration,
OutputDirectory = "./publish/",
SelfContained = true,
PublishSingleFile = true,
PublishReadyToRun = false,
PublishTrimmed = false,
MSBuildSettings = msBuild
});
Zip("./publish/", $"./artifacts/InnovatorAdmin.Cmd.{version}.zip");
DeleteDirectory("./publish", deleteSettings);
DotNetPack("./InnovatorAdmin.Api/InnovatorAdmin.Api.csproj", new DotNetPackSettings
{
Configuration = configuration,
OutputDirectory = "./artifacts/",
MSBuildSettings = msBuild
});
Information("Version: " + version);
});
Task("Test")
.IsDependentOn("Publish")
.Does(() =>
{
DotNetTest("./InnovatorAdmin.ApiTests/InnovatorAdmin.ApiTests.csproj", new DotNetTestSettings
{
Configuration = configuration
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Test");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);