This repository has been archived by the owner on Apr 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.cake
107 lines (84 loc) · 3.31 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
//////////////////////////////////////////////////////////////////////
// ADDINS
//////////////////////////////////////////////////////////////////////
#addin "Cake.FileHelpers"
//////////////////////////////////////////////////////////////////////
// TOOLS
//////////////////////////////////////////////////////////////////////
#tool "GitVersion.CommandLine"
#tool "nuget:?package=vswhere"
#tool "nuget:?package=xunit.runner.console"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Version
var gitVersion = GitVersion();
var majorMinorPatch = gitVersion.MajorMinorPatch;
var informationalVersion = gitVersion.InformationalVersion;
var nugetVersion = gitVersion.NuGetVersion;
var buildVersion = gitVersion.FullBuildMetaData;
var solutionFile = "./src/BoxKite.Twitter.sln";
// Artifacts
var artifactDirectory ="./artifacts/";
var testCoverageOutputFile = artifactDirectory + "OpenCover.xml";
// Bootstrap
CreateDirectory(artifactDirectory);
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Restore")
.Does(() =>
{
NuGetRestore(solutionFile);
// do it twice due to dotnet core toolchain v1.x issue.
NuGetRestore(solutionFile);
});
Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
// multiple versions of visual studio 2017 (and upwards) can be installed
// side by side and in different locations. You can no longer assume that
// msbuild is installed in C:\Program Files :)
FilePath msBuildPath = VSWhereLatest().CombineWithFilePath("./MSBuild/15.0/Bin/MSBuild.exe");
MSBuild(solutionFile, new MSBuildSettings() {
ToolPath= msBuildPath
}
.WithTarget("restore;build;pack")
.WithProperty("PackageOutputPath", MakeAbsolute(Directory(artifactDirectory)).ToString())
.WithProperty("TreatWarningsAsErrors", "true")
.SetConfiguration("Release")
// Due to https://github.com/NuGet/Home/issues/4790 and https://github.com/NuGet/Home/issues/4337 we
// have to pass a version explicitly
.WithProperty("Version", nugetVersion.ToString())
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false));
});
Task("Test")
.Does(() =>
{
XUnit2("./src/**/bin/Release/*.Tests.dll", new XUnit2Settings {
OutputDirectory = artifactDirectory,
XmlReportV1 = true,
NoAppDomain = true
});
});
Task("Package")
.IsDependentOn("Build")
.IsDependentOn("Test")
.Does(() =>
{
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Package");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);