-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cake
107 lines (81 loc) · 3.19 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
100
101
102
103
104
105
106
107
//############################################################
var _applicatioName = "FileUploadDemo";
var _target = Argument("target", "Default");
var _version = "1.0.0";
var _configuration = Argument("configuration", "Release");
var _srcDir = "./src/";
var _buildDir = "./build/";
var _slnPath = _srcDir + "FileUploadDemo.sln";
var _testProjectPattern = _srcDir + "**/*Tests.csproj";
var _testOutputDir = _buildDir + "tests/";
//############################################################
//############################################################
var buildMsg = @"
_____ _ _ _ _ _ _ ____
| ___(_) | ___| | | |_ __ | | ___ __ _ __| | _ \ ___ _ __ ___ ___
| |_ | | |/ _ \ | | | '_ \| |/ _ \ / _` |/ _` | | | |/ _ \ '_ ` _ \ / _ \
| _| | | | __/ |_| | |_) | | (_) | (_| | (_| | |_| | __/ | | | | | (_) |
|_| |_|_|\___|\___/| .__/|_|\___/ \__,_|\__,_|____/ \___|_| |_| |_|\___/
|_| ";
Setup(ctx => {
Information(buildMsg);
Information("Settings");
Information("_applicatioName:" + _applicatioName);
Information("_target: " + _target);
Information("_configuration: " + _configuration);
Information("_srcDir: " + _srcDir);
Information("_buildDir: " + _buildDir);
Information("_slnPath: " + _slnPath);
});
Teardown(ctx => {
Information("AsyncFileUploadDemo App Suite Build Completed!");
});
//############################################################
//############################################################
// Utility/ Housekeeping tasks
Task("Clean")
.Does(() =>
{
if (DirectoryExists(_buildDir))
{
DeleteDirectory(_buildDir, new DeleteDirectorySettings { Recursive = true, Force = true});
}
EnsureDirectoryExists(_buildDir);
});
//############################################################
//############################################################
// Build/ Compile Tasks
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
Information("Restoring {0}", _slnPath);
NuGetRestore(_slnPath);
});
Task("BuildAssemblyInfo")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() => {
var file = _srcDir + "SolutionInfo.cs";
var buildNo = Bamboo.IsRunningOnBamboo ? Bamboo.Environment.Build.Number : 0 ;
var version = string.Format("{0}.{1}", _version, buildNo);
var semVersion = string.Format("{0}-{1}", _version, buildNo);
CreateAssemblyInfo(file, new AssemblyInfoSettings {
Product = _applicatioName,
Version = version,
FileVersion = version,
InformationalVersion = semVersion,
Copyright = string.Format("Copyright (c) Buzzuti 2015 - {0}", DateTime.Now.Year)
});
});
Task("Build")
.IsDependentOn("BuildAssemblyInfo")
.Does(() => {
MSBuild(_slnPath, settings =>
settings.SetConfiguration(_configuration)
.WithTarget("Build"));
});
//############################################################
Task("Default")
.IsDependentOn("Build")
.Does(() => { });
RunTarget(_target);