-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.cake
100 lines (81 loc) · 2.37 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
#nullable enable
// Arguments
var target = Argument("t", "default");
var configuration = Argument("c", "Debug");
var partial = Argument("partial", false);
var vendor = Argument("vendor", string.Empty);
// Paths
var root = Context.Environment.WorkingDirectory;
var ariseProj = root.CombineWithFilePath("arise.proj");
var outLog = root.Combine("out").Combine("log");
// Utilities
DotNetMSBuildSettings ConfigureMSBuild(string target)
{
var prefix = $"{target}_{Environment.UserName}_{Environment.MachineName}_";
var time = DateTime.Now;
string name;
do
{
name = $"{prefix}{time:yyyy-MM-dd_HH_mm_ss}.binlog";
time = time.AddSeconds(1);
}
while (System.IO.File.Exists(name));
var settings = new DotNetMSBuildSettings
{
// TODO: https://github.com/dotnet/msbuild/issues/6756
NoLogo = true,
BinaryLogger = new()
{
Enabled = true,
FileName = outLog.CombineWithFilePath(name).FullPath,
},
ConsoleLoggerSettings = new()
{
NoSummary = true,
},
ArgumentCustomization = args => args.Append("-ds:false"),
};
if (partial)
settings.Properties.Add("ArisePartialBuild", new[] { "true" });
if (!string.IsNullOrWhiteSpace(vendor))
settings.Properties.Add(
"AriseVendorProjectPath",
new[] { new FilePath(vendor).MakeAbsolute(Context.Environment).FullPath });
return settings;
}
// Tasks
Task("default")
.IsDependentOn("publish");
Task("default-editor")
.IsDependentOn("publish");
Task("restore")
.Does(() =>
DotNetRestore(
ariseProj.FullPath,
new()
{
MSBuildSettings = ConfigureMSBuild("restore"),
}));
Task("build")
.IsDependentOn("restore")
.Does(() =>
DotNetBuild(
ariseProj.FullPath,
new()
{
MSBuildSettings = ConfigureMSBuild("build"),
Configuration = configuration,
NoRestore = true,
}));
Task("publish")
.IsDependentOn("build")
.Does(() =>
DotNetPublish(
ariseProj.FullPath,
new()
{
MSBuildSettings = ConfigureMSBuild("publish"),
Configuration = configuration,
NoBuild = true,
}));
RunTarget(target);