-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.cake
103 lines (85 loc) · 2.91 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
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Build");
var githubRef = Argument("ref", string.Empty);
var version = Argument("package-version", "8.1.97");
var suffix = Argument("version-suffix", "alpha");
var configuration = Argument("configuration", "Release");
var solution = Argument("solution", "FileOnQ.Prism.Popups.XCT.sln");
var sample = Argument("sample", "./sample/FileOnQ.Prism.Popups.XCT.Sample.sln");
var csproj = Argument("csproj", "./src/FileOnQ.Prism.Popups.XCT/FileOnQ.Prism.Popups.XCT.csproj");
//////////////////////////////////////////////////////////////////////
// MSBuild Settings
//////////////////////////////////////////////////////////////////////
var msbuildSettings = new MSBuildSettings
{
ToolVersion = MSBuildToolVersion.VS2019,
Configuration = configuration
};
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectories("./src/**/bin/");
Information("Cleaning Directory ./src/**/bin/");
CleanDirectories("./src/**/obj/");
Information("Cleaning Directory ./src/**/obj/");
CleanDirectories("./Sample/**/bin/");
Information("Cleaning Directory ./Sample/**/bin/");
CleanDirectories("./Sample/**/obj/");
Information("Cleaning Directory ./Sample/**/obj/");
});
Task("Restore")
.Does(() =>
{
NuGetRestore(solution);
});
Task("Build")
.Does(() =>
{
MSBuild(solution, msbuildSettings);
});
Task("Pack")
.Does(() =>
{
if (!string.IsNullOrEmpty(githubRef))
{
version = githubRef
.Split("/")
.LastOrDefault()
.TrimStart('v');
if (version.Contains("-dev."))
{
var segments = version.Split("-");
version = segments[0];
suffix = segments[1];
}
else
{
suffix = string.Empty;
}
}
MSBuild(csproj, msbuildSettings
.WithTarget("pack")
.WithProperty("PackageVersion", string.IsNullOrEmpty(suffix) ? version : $"{version}-{suffix}")
.WithProperty("Version", version)
.WithProperty("AssemblyVersion", version)
.WithProperty("PackageOutputPath", "../../"));
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("CI-Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build");
Task("Package-Build")
.IsDependentOn("CI-Build")
.IsDependentOn("Pack");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);