forked from alexfdezsauco/Nothing.Nauta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
74 lines (63 loc) · 2.15 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
#load "config.cake"
var target = Argument("target", "Default");
var buildConfiguration = Argument("Configuration", "Release");
Setup (context => {
context.Tools.RegisterFile("./tools/GitVersion.CommandLine/tools/gitversion.exe");
});
Task("UpdateVersion")
.Does (() => {
FilePath gitVersionPath = Context.Tools.Resolve("gitversion.exe");
StartProcess (gitVersionPath, new ProcessSettings {
Arguments = new ProcessArgumentBuilder ()
.Append ("/output")
.Append ("buildserver")
.Append ("/nofetch")
.Append ("/updateassemblyinfo")
});
IEnumerable<string> redirectedStandardOutput;
StartProcess (gitVersionPath, new ProcessSettings {
Arguments = new ProcessArgumentBuilder ()
.Append ("/output")
.Append ("json"),
RedirectStandardOutput = true
}, out redirectedStandardOutput);
NuGetVersionV2 = redirectedStandardOutput.FirstOrDefault(s => s.Contains("NuGetVersionV2")).Split(':')[1].Trim(',').Trim('"');
});
Task("Restore")
.Does(() => {
});
Task("Build")
.IsDependentOn("UpdateVersion")
.IsDependentOn("Restore")
.Does (() =>
{
DotNetCoreBuild(
SolutionFileName,
new DotNetCoreBuildSettings()
{
Configuration = buildConfiguration,
ArgumentCustomization = args => args
.Append($"/p:Version={NuGetVersionV2}")
.Append($"/p:PackageVersion={NuGetVersionV2}")
});
});
Task("Pack")
.IsDependentOn("Build")
.Does (() =>
{
for(int i = 0; i < ComponentProjects.Length; i++)
{
var componentProject = ComponentProjects[i];
var packageOutputDirectory = $"./output/nuget";
var settings = new DotNetCorePackSettings
{
Configuration = buildConfiguration,
OutputDirectory = packageOutputDirectory,
ArgumentCustomization = args => args
.Append($"/p:PackageVersion={NuGetVersionV2}")
.Append($"/p:Version={NuGetVersionV2}")
};
DotNetCorePack(componentProject, settings);
}
});
RunTarget(target);