forked from cake-build/cake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaths.cake
73 lines (65 loc) · 2.34 KB
/
paths.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
public record BuildPaths(
BuildDirectories Directories,
FilePath SignClientPath,
FilePath SignFilterPath
)
{
public static BuildPaths GetPaths(
ICakeContext context,
string configuration,
string semVersion
)
{
if (context == null)
{
throw new ArgumentNullException("context");
}
if (string.IsNullOrEmpty(configuration))
{
throw new ArgumentNullException("configuration");
}
if (string.IsNullOrEmpty(semVersion))
{
throw new ArgumentNullException("semVersion");
}
var artifactsDir = (DirectoryPath)(context.Directory("./artifacts") + context.Directory("v" + semVersion));
var testResultsDir = artifactsDir.Combine("test-results");
var nugetRoot = artifactsDir.Combine("nuget");
var testCoverageOutputFilePath = testResultsDir.CombineWithFilePath("OpenCover.xml");
var integrationTestsBin = context.MakeAbsolute(context.Directory("./tests/integration/tools"));
var integrationTestsBinTool = integrationTestsBin.Combine("Cake.Tool");
// Directories
var buildDirectories = new BuildDirectories(
artifactsDir,
testResultsDir,
nugetRoot,
integrationTestsBinTool);
var signClientPath = context.Tools.Resolve("sign.exe")
?? context.Tools.Resolve("sign")
?? (
context.IsRunningOnWindows()
? throw new Exception("Failed to locate sign tool")
: null
);
var signFilterPath = context.MakeAbsolute(context.File("./build/signclient.filter"));
return new BuildPaths(
Directories: buildDirectories,
SignClientPath: signClientPath,
SignFilterPath: signFilterPath
);
}
}
public record BuildDirectories(
DirectoryPath Artifacts,
DirectoryPath TestResults,
DirectoryPath NuGetRoot,
DirectoryPath IntegrationTestsBinTool
)
{
public ICollection<DirectoryPath> ToClean { get; } = new[] {
Artifacts,
TestResults,
NuGetRoot,
IntegrationTestsBinTool
};
}