forked from richard-green/Authentiqr.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cake
99 lines (84 loc) · 2.73 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
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var version = new Version("8.0.0");
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(Directory("./output"));
CleanDirectory(Directory("./src/Authentiqr.NET/bin") + Directory(configuration));
CleanDirectory(Directory("./src/Authentiqr.Core/bin") + Directory(configuration));
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./src/Authentiqr.NET.sln");
});
Task("Solution-Info")
.IsDependentOn("Clean")
.Does(() =>
{
var file = "./src/SolutionInfo.cs";
CreateAssemblyInfo(file, new AssemblyInfoSettings {
Product = "Authentiqr.NET",
Version = version.ToString(),
FileVersion = version.ToString(),
InformationalVersion = version.ToString(),
Copyright = string.Format("Copyright (c) Richard Green 2011 - {0}", DateTime.Now.Year)
});
});
Task("Build")
.IsDependentOn("Solution-Info")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
if(IsRunningOnWindows())
{
// Use MSBuild
MSBuild("./src/Authentiqr.NET.sln", settings =>
settings.SetConfiguration(configuration));
}
else
{
// Use XBuild
XBuild("./src/Authentiqr.NET.sln", settings =>
settings.SetConfiguration(configuration));
}
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
NUnit3("./src/**/bin/" + configuration + "/*.Tests.dll", new NUnit3Settings {
NoResults = true
});
});
Task("Build-Packages")
.IsDependentOn("Restore-NuGet-Packages")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
var settings = new DotNetPackSettings {
NoBuild = true,
Configuration = configuration,
OutputDirectory = "./output"
};
DotNetPack("./src/Authentiqr.Core/Authentiqr.Core.csproj", settings);
Zip("./src/Authentiqr.NET/bin/" + configuration, "./output/Authentiqr.NET-" + version.ToString() + ".zip");
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build-Packages");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);