forked from JoshMcCullough/SVG
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.cake
94 lines (80 loc) · 2.52 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
#tool "nuget:?package=NUnit.ConsoleRunner"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var version = Argument("nuget_version", "1.0.0.0-beta");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
var solution = "./Svg.sln";
var solutionEditor = "./Svg.Editor.sln";
var nuspec = GetFiles("./**/*.nuspec");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Restore-NuGet-Packages")
.Does(() =>
{
NuGetRestore(solution);
NuGetRestore(solutionEditor);
});
Task("Clean")
.Does(() =>
{
DeleteDirectories(GetDirectories("./**/bin"), true);
DeleteDirectories(GetDirectories("./**/obj"), true);
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
if(IsRunningOnWindows())
{
// Use MSBuild
MSBuild(solution, settings => {
settings.SetConfiguration(configuration);
settings.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86;
});
// Use MSBuild
MSBuild(solutionEditor, settings => {
settings.SetConfiguration(configuration);
settings.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86;
});
}
else
{
// Use DotNetBuild
DotNetBuild(solution, settings =>
settings.SetConfiguration(configuration));
// Use DotNetBuild
DotNetBuild(solutionEditor, settings =>
settings.SetConfiguration(configuration));
}
});
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
NUnit3("./src/build/tests/bin/" + configuration + "/**/*.Tests.dll");
});
Task("NuGet")
.IsDependentOn("Test")
.Does (() =>
{
if(!DirectoryExists("./build/nuget/"))
CreateDirectory("./build/nuget");
NuGetPack(nuspec, new NuGetPackSettings {
ArgumentCustomization = args=>args.Append("-Properties configuration=" + configuration),
BasePath = "./",
OutputDirectory = "./build/nuget/",
Symbols = true,
Verbosity = NuGetVerbosity.Detailed,
Version = version
});
});
Task("Default")
.IsDependentOn("NuGet");
RunTarget(target);