-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.cake
151 lines (120 loc) · 6.7 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0
//#tool nuget:?package=GitVersion.CommandLine
//using Cake.Common.Tools.DotNetCore.Pack;
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
var package = Argument<bool>("package", true);
var prerelease = Argument<bool>("develop", false);
var semver = Argument<string>("semver");
var product = "HareDu2";
var copyright = "Copyright (c) 2013-2020 Albert L. Hives, et al.";
var solutionInfo = "./src/HareDu/SolutionVersion.cs";
var solution = "./src/HareDu.sln";
var brokerBuildPath = (DirectoryPath)(Directory("./src/HareDu/bin") + Directory(configuration));
var coreBuildPath = (DirectoryPath)(Directory("./src/HareDu.Core/bin") + Directory(configuration));
var snapshotBuildPath = (DirectoryPath)(Directory("./src/HareDu.Snapshotting/bin") + Directory(configuration));
var diagnosticsBuildPath = (DirectoryPath)(Directory("./src/HareDu.Diagnostics/bin") + Directory(configuration));
var artifactsBasePath = (DirectoryPath)Directory("./artifacts");
var baseBinPath = artifactsBasePath.Combine("bin");
var bin462Path = baseBinPath.Combine("lib/net462");
var binCorePath = baseBinPath.Combine("lib/netstandard2.0");
var nugetPath = artifactsBasePath.Combine("nuget");
var bin462FullPath = MakeAbsolute(bin462Path).FullPath;
TaskSetup(context =>
{
var message = string.Format("Task {0} started", context.Task.Name);
Information(message);
});
TaskTeardown(context =>
{
var message = string.Format("Task {0} finished", context.Task.Name);
Information(message);
});
Task("Clean")
.Does(() =>
{
CleanDirectory("./artifacts");
});
Task("Restore")
.Does(() =>
{
DotNetCoreRestore("./src");
});
Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
var config = new DotNetCoreBuildSettings
{
Configuration = configuration,
MSBuildSettings = new DotNetCoreMSBuildSettings()
};
DotNetCoreBuild("./src", config);
});
/*
Task("Copy-Build-Artifacts")
.IsDependentOn("Build")
.Does(() =>
{
EnsureDirectoryExists(bin462Path);
CopyFiles(string.Format("{0}/net462/*.dll", coreBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.pdb", coreBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.xml", coreBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.yaml", coreBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.config", coreBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.dll", brokerBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.pdb", brokerBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.xml", brokerBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.yaml", brokerBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.config", brokerBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.dll", snapshotBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.pdb", snapshotBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.xml", snapshotBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.yaml", snapshotBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.config", snapshotBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.dll", diagnosticsBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.pdb", diagnosticsBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.xml", diagnosticsBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.yaml", diagnosticsBuildPath.ToString()), bin462Path);
CopyFiles(string.Format("{0}/net462/*.config", diagnosticsBuildPath.ToString()), bin462Path);
EnsureDirectoryExists(binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.dll", coreBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.pdb", coreBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.xml", coreBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.yaml", coreBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.config", coreBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.dll", brokerBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.pdb", brokerBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.xml", brokerBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.yaml", brokerBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.config", brokerBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.dll", snapshotBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.pdb", snapshotBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.xml", snapshotBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.yaml", snapshotBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.config", snapshotBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.dll", diagnosticsBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.pdb", diagnosticsBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.xml", diagnosticsBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.yaml", diagnosticsBuildPath.ToString()), binCorePath);
CopyFiles(string.Format("{0}/netstandard2.0/*.config", diagnosticsBuildPath.ToString()), binCorePath);
CopyFileToDirectory("license", artifactsBasePath);
});
*/
Task("Pack")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings{
OutputDirectory = "./artifacts",
Configuration = configuration,
MSBuildSettings = new DotNetCoreMSBuildSettings()
};
DotNetCorePack("./src/*", settings);
});
Task("Default")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build");
// .IsDependentOn("Pack");
RunTarget(target);