-
Notifications
You must be signed in to change notification settings - Fork 7
/
buildconfig.cake
36 lines (31 loc) · 1.3 KB
/
buildconfig.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
public class BuildConfig
{
private const string Version = "2.2.0";
public readonly string SrcDir = "./src/";
public readonly string OutDir = "./build/";
public bool IsDefaultBranch { get; private set; }
public string Target { get; private set; }
public string SemVer { get; private set; }
public string BuildVersion { get; private set; }
public string BuildProfile { get; private set; }
public bool IsTeamCityBuild { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var branch = context.Argument("branch", "master");
var isDefaultBranch = branch.ToLower() == "master";
var buildRevision = context.Argument("buildrevision", "0");
return new BuildConfig
{
IsDefaultBranch = isDefaultBranch,
Target = context.Argument("target", "Default"),
SemVer = Version + (isDefaultBranch ? string.Empty : "-pre" + buildRevision),
BuildVersion = Version + "." + buildRevision,
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity
};
}
}