-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.cake
62 lines (49 loc) · 1.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
#load ".cake/Configuration.cake"
/**********************************************************/
Setup<Configuration>(Configuration.Create);
/**********************************************************/
#load ".cake/CI.cake"
// -- DotNetCore
#load ".cake/Restore-DotNetCore.cake"
#load ".cake/Build-DotNetCore.cake"
#load ".cake/Test-DotNetCore.cake"
#load ".cake/Publish-Pack-DotNetCore.cake"
// -------------
Task("Restore:DotNetCore:Tools")
.IsDependeeOf("Restore")
.Does<Configuration>(config => {
var settings = new ProcessSettings()
{
RedirectStandardOutput = false
};
settings.Arguments = string.Format($"tool restore");
using(var process = StartAndReturnProcess("dotnet", settings))
{
process.WaitForExit();
}
});
Task("Tools:Git-Export")
.Does<Configuration>(config => {
var settings = new ProcessSettings()
{
RedirectStandardOutput = false
};
var exportArtifactRootPath = $"{config.Artifacts.Root}/export";
EnsureDirectoryExists(exportArtifactRootPath);
var exportArchiveFile = MakeAbsolute(File($"{exportArtifactRootPath}/export.zip"));
if(FileExists(exportArchiveFile))
{
DeleteFile(exportArchiveFile);
}
settings.Arguments = string.Format($"archive -o {exportArchiveFile} HEAD");
using(var process = StartAndReturnProcess("git", settings))
{
process.WaitForExit();
if(process.GetExitCode() == 0)
{
Information("Exported source to {0}", exportArchiveFile);
config.Artifacts.Add(ArtifactTypeOption.Other, exportArchiveFile.GetFilename().ToString(), exportArchiveFile);
}
}
});
RunTarget(Argument("target", Argument("Target", "Default")));