This repository was archived by the owner on Oct 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuildconfig.cake
39 lines (34 loc) · 1.48 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
37
38
39
public class BuildConfig
{
private const string Version = "0.3.2";
public readonly string SrcDir = "./src/";
public readonly string OutDir = "./build/";
public bool IsPreRelease { 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 string OctoServer { get; private set; }
public string OctoApiKey { get; private set; }
public static BuildConfig Create(
ICakeContext context,
BuildSystem buildSystem)
{
if (context == null)
throw new ArgumentNullException("context");
var isPreRelease = bool.Parse(context.Argument("prerelease", "False"));
var buildRevision = context.Argument("buildrevision", "0");
return new BuildConfig
{
IsPreRelease = isPreRelease,
Target = context.Argument("target", "Default"),
SemVer = Version + (isPreRelease ? "-pre" + buildRevision : string.Empty),
BuildVersion = Version + "." + buildRevision,
BuildProfile = context.Argument("configuration", "Release"),
IsTeamCityBuild = buildSystem.TeamCity.IsRunningOnTeamCity,
OctoServer = context.Argument("octoserver", string.Empty),
OctoApiKey = context.Argument("octoapikey", string.Empty)
};
}
}