forked from FantasticFiasco/mvvm-dialogs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
95 lines (78 loc) · 2.78 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
#load "build/utils.cake"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// VARIABLES
//////////////////////////////////////////////////////////////////////
var solution = new FilePath("./MvvmDialogs.sln");
var netProject = new FilePath("./src/net/MvvmDialogs.csproj");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Description("Clean all files")
.Does (() =>
{
CleanDirectories("./**/bin");
CleanDirectories("./**/obj");
});
Task("Restore")
.Description("Restore NuGet packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore(solution);
});
Task("Build")
.Description("Build the solution")
.IsDependentOn("Restore")
.Does(() =>
{
// Build for default .NET version
MSBuild(solution, settings => settings
.SetConfiguration(configuration)
.SetMaxCpuCount(0)); // Enable parallel build
// Build for .NET version 4.0
MSBuild(netProject, settings => settings
.SetConfiguration(configuration)
.WithProperty("TargetFrameworkVersion", "v4.0")
.SetMaxCpuCount(0)); // Enable parallel build
// Build for .NET version 3.5
MSBuild(netProject, settings => settings
.SetConfiguration(configuration)
.WithProperty("TargetFrameworkVersion", "v3.5")
.SetMaxCpuCount(0)); // Enable parallel build
});
Task("Pack")
.Description("Create NuGet package")
.IsDependentOn("Build")
.Does(() =>
{
var version = GetAssemblyVersion("./SolutionInfo.cs");
var branch = EnvironmentVariable("APPVEYOR_REPO_BRANCH");
// Unless on master, this is a pre-release
if (branch != "master")
{
var sha = EnvironmentVariable("APPVEYOR_REPO_COMMIT");
version += $"-sha-{sha}";
}
NuGetPack(
"./MvvmDialogs.nuspec",
new NuGetPackSettings
{
Version = version,
Symbols = true
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Pack");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);