-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.cake
More file actions
132 lines (110 loc) · 4.8 KB
/
build.cake
File metadata and controls
132 lines (110 loc) · 4.8 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#tool "nuget:?package=xunit.runner.console&version=2.3.1"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument ("target", "Default");
var configuration = Argument ("configuration", "Release");
var version = Argument ("build_version", "1.0.0.0");
var releaseCandidate = Argument ("release_candidate", "0");
Information("target: {0}", target);
Information("configuration: {0}", configuration);
Information("build_version: {0}", version);
Information("release_candidate: {0}", releaseCandidate);
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var rootDir = Directory ("./");
var sourceDir = Directory ("./src");
var buildDir = Directory ("./localBuild");
var solutionOutputDir = Directory (buildDir.Path + "/MergeQueryObjectSolution");
var integrationTestOutputDir = Directory (buildDir.Path + "/IntegrationTests");
var mergeQueryObjectOutputDir = Directory (buildDir.Path + "/MergeQueryObjectUtility");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task ("Clean")
.Does (() => {
CleanDirectory (buildDir);
});
Task ("Restore-NuGet-Packages")
.IsDependentOn ("Clean")
.Does (() => {
NuGetRestore ("./src/MergeQueryObject.sln");
});
Task ("BuildSolution")
.IsDependentOn ("Restore-NuGet-Packages")
.Does (() => {
var settings = new MSBuildSettings ()
.SetConfiguration (configuration)
.SetVerbosity (Verbosity.Minimal)
.WithProperty ("OutDir", MakeAbsolute (solutionOutputDir).FullPath)
.WithProperty ("Version", version)
.WithProperty ("AssemblyVersion", version)
.WithProperty ("FileVersion", version);
MSBuild (sourceDir.Path + "/MergeQueryObject.sln", settings);
});
Task ("BuildIntegrationTests")
.IsDependentOn ("Restore-NuGet-Packages")
.Does (() => {
var settings = new MSBuildSettings ()
.SetConfiguration (configuration)
.SetVerbosity (Verbosity.Minimal)
.WithProperty ("OutDir", MakeAbsolute (integrationTestOutputDir).FullPath)
.WithProperty ("Version", version)
.WithProperty ("AssemblyVersion", version)
.WithProperty ("FileVersion", version);
MSBuild (sourceDir.Path + "/IntegrationTests/IntegrationTests.csproj", settings);
});
Task ("BuildMergeQueryObject")
.IsDependentOn ("Restore-NuGet-Packages")
.Does (() => {
var settings = new MSBuildSettings ()
.SetConfiguration (configuration)
.SetVerbosity (Verbosity.Minimal)
.WithProperty ("OutDir", MakeAbsolute (mergeQueryObjectOutputDir).FullPath)
.WithProperty ("Version", version)
.WithProperty ("AssemblyVersion", version)
.WithProperty ("FileVersion", version);
MSBuild (sourceDir.Path + "/ivaldez.SqlMergeQueryObject/ivaldez.Sql.SqlMergeQueryObject.csproj", settings);
});
Task ("Run-Unit-Tests")
.IsDependentOn ("BuildIntegrationTests")
.Does (() => {
Information ("Start Running Tests");
XUnit2 (integrationTestOutputDir.Path + "/*Tests.dll");
});
Task ("BuildPackages")
.IsDependentOn ("Restore-NuGet-Packages")
.IsDependentOn ("BuildMergeQueryObject")
.Does (() => {
var settings = new DotNetCorePackSettings {
Configuration = "Release",
OutputDirectory = buildDir.Path,
IncludeSource = true,
IncludeSymbols = true
};
var projectPath = sourceDir.Path + "/ivaldez.SqlMergeQueryObject/ivaldez.Sql.SqlMergeQueryObject.csproj";
var package_version = version;
if (releaseCandidate != "0"){
package_version = package_version + "-rc" + releaseCandidate;
}
XmlPoke(projectPath, "/Project/PropertyGroup/Version", package_version);
XmlPoke(projectPath, "/Project/PropertyGroup/AssemblyVersion", version);
DotNetCorePack (projectPath, settings);
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task ("Default")
.IsDependentOn ("BuildSolution")
.IsDependentOn ("BuildMergeQueryObject")
.IsDependentOn ("BuildIntegrationTests")
.IsDependentOn ("Run-Unit-Tests");
Task ("Package")
.IsDependentOn ("Default")
.IsDependentOn ("BuildPackages");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget (target);