forked from devontee33/bitprim-insight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
95 lines (73 loc) · 2.78 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
#tool "nuget:?package=GitVersion.CommandLine&version=4.0.0-beta0012"
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var coin = Argument("coin", "BCH");
var solutionName = "bitprim.insight.sln";
var solutionTutorialsName = "bitprim.insight.tutorials.sln";
var platform = "/property:Platform=x64";
Task("Clean")
.Does(() => {
Information("Cleaning... ");
CleanDirectory("./bitprim.insight/bin");
CleanDirectory("./bitprim.insight.tests/bin");
CleanDirectory("./bitprim.insight.tutorials/bin");
CleanDirectory("./bitprim.insight.tutorials.tests/bin");
});
Task("Restore")
.Does(() => {
DotNetCoreRestore(solutionName);
DotNetCoreRestore(solutionTutorialsName);
});
GitVersion versionInfo = null;
Task("Version")
.Does(() => {
GitVersion(new GitVersionSettings{
UpdateAssemblyInfo = false,
OutputType = GitVersionOutput.BuildServer
});
versionInfo = GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json });
Information("Version calculated: " + versionInfo.MajorMinorPatch);
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Version")
.IsDependentOn("Restore")
.Does(() => {
Information("Building " + coin);
MSBuild(solutionName, new MSBuildSettings {
ArgumentCustomization = args => args.Append(platform + " /p:" + coin + "=true"),
Configuration = configuration
});
MSBuild(solutionTutorialsName, new MSBuildSettings {
ArgumentCustomization = args => args.Append(platform + " /p:BCH=true"),
Configuration = configuration
});
});
Task("Test")
.IsDependentOn("Build")
.Does(() => {
DotNetCoreTest("./bitprim.insight.tests",new DotNetCoreTestSettings
{
ArgumentCustomization = args=> args.Append(platform + " /p:" + coin + "=true"),
Configuration = configuration
});
DotNetCoreTest("./bitprim.insight.tutorials.tests",new DotNetCoreTestSettings
{
ArgumentCustomization = args=> args.Append(platform + " /p:BCH=true"),
Configuration = configuration
});
});
Task("UpdateVersionInfo")
.IsDependentOn("Test")
.WithCriteria(AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
var isTag = AppVeyor.Environment.Repository.Tag.IsTag && !string.IsNullOrWhiteSpace(AppVeyor.Environment.Repository.Tag.Name);
if (isTag)
{
AppVeyor.UpdateBuildVersion(AppVeyor.Environment.Repository.Tag.Name);
}
});
Task("Default")
.IsDependentOn("UpdateVersionInfo");
RunTarget(target);