-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cake
70 lines (54 loc) · 1.98 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
#load nuget:?package=Cake.Issues.Recipe&prerelease
#load buildData.cake
#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools"
#tool "nuget:?package=MSBuild.Extension.Pack"
var target = Argument("target", "Default");
Setup<BuildData>(setupContext =>
{
return new BuildData(setupContext);
});
Task("Build")
.Does<BuildData>((data) =>
{
var solutionFile =
data.IssuesData.RepositoryRootDirectory.Combine("src").CombineWithFilePath("ClassLibrary1.sln");
NuGetRestore(solutionFile);
var settings =
new MSBuildSettings()
.WithTarget("Rebuild");
// XML File Logger
settings =
settings.WithLogger(
Context.Tools.Resolve("MSBuild.ExtensionPack.Loggers.dll").FullPath,
"XmlFileLogger",
string.Format(
"logfile=\"{0}\";verbosity=Detailed;encoding=UTF-8",
data.MsBuildLogFilePath));
EnsureDirectoryExists(IssuesParameters.OutputDirectory);
MSBuild(solutionFile, settings);
// Pass path to MsBuild log file to Cake.Issues.Recipe
IssuesParameters.InputFiles.MsBuildXmlFileLoggerLogFilePath = data.MsBuildLogFilePath;
});
Task("Run-InspectCode")
.WithCriteria((context) => context.IsRunningOnWindows(), "InspectCode is only supported on Windows.")
.Does<BuildData>((data) =>
{
var settings = new InspectCodeSettings() {
OutputFile = data.InspectCodeLogFilePath
};
InspectCode(
data.IssuesData.RepositoryRootDirectory.Combine("src").CombineWithFilePath("ClassLibrary1.sln"),
settings);
// Pass path to InspectCode log file to Cake.Issues.Recipe
IssuesParameters.InputFiles.InspectCodeLogFilePath = data.InspectCodeLogFilePath;
});
Task("Lint")
.IsDependentOn("Run-InspectCode");
// Make sure build and linters run before issues task.
IssuesBuildTasks.ReadIssuesTask
.IsDependentOn("Build")
.IsDependentOn("Lint");
// Run issues task by default.
Task("Default")
.IsDependentOn("Issues");
RunTarget(target);