-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cake
103 lines (84 loc) · 2.46 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
95
96
97
98
99
100
101
102
103
#addin "Cake.Topshelf"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var projDir = Directory("./Plex.As.A.Service/Plex.Service/bin/debug/net461");
var testDir = Directory("./Plex.As.A.Service/Plex.Service.Common.Tests/bin/debug/net461");
var solution = "./Plex.As.A.Service.sln";
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Description("Cleaning the build directory.")
.Does(() =>
{
CleanDirectory(projDir);
CleanDirectory(testDir);
});
Task("Restore")
.Description("Restoring NuGet packages.")
.Does(() =>
{
DotNetCoreRestore(solution);
});
Task("Build")
.Description("Building the solution.")
.Does(() =>
{
DotNetCoreBuild(solution); //, buildSettings);
});
Task("Test")
.Description("Runs Unit tests.")
.Does(() =>
{
var unitTests = GetFiles("./Plex.As.A.Service/Plex.Service.Common.Tests/*.csproj");
foreach(var test in unitTests)
{
DotNetCoreTest(test.FullPath);
}
});
Task("Install")
.Description("Installs the service.")
.Does(() =>
{
InstallTopshelf($"{projDir}/Plex.Service.exe", new TopshelfSettings()
{
Autostart = true,
LocalSystem = true,
Delayed = true
});
});
Task("Start")
.Description("Starts the Service.")
.Does(() =>
{
StartTopshelf("" + projDir + "/Plex.Service.exe");
});
Task("Stop")
.Description("Stops the service.")
.Does(() =>
{
StopTopshelf("" + projDir + "/Plex.Service.exe");
});
Task("Uninstall")
.Description("Uninstalls the service.")
.Does(() =>
{
UninstallTopshelf("" + projDir + "/Plex.Service.exe");
});
Task("")
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Uninstall");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);