-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathbuild.cake
79 lines (65 loc) · 2.02 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
#tool dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=5.12.0
#addin nuget:https://api.nuget.org/v3/index.json?package=Cake.Figlet&version=2.0.1
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var sln = new FilePath("./BTProgressHUD.sln");
var artifactsDir = new DirectoryPath("./artifacts");
var gitVersionLog = new FilePath("./gitversion.log");
GitVersion versionInfo = null;
Setup(context =>
{
versionInfo = context.GitVersion(new GitVersionSettings
{
UpdateAssemblyInfo = true,
OutputType = GitVersionOutput.Json,
LogFilePath = gitVersionLog.MakeAbsolute(context.Environment)
});
var cakeVersion = typeof(ICakeContext).Assembly.GetName().Version.ToString();
Information(Figlet("BTProgressHUD"));
Information("Building version {0}, ({1}, {2}) using version {3} of Cake.",
versionInfo.SemVer,
configuration,
target,
cakeVersion);
});
Task("Clean")
.Does(() =>
{
CleanDirectories("./BTProgressHUD/bin");
CleanDirectories("./BTProgressHUD/obj");
EnsureDirectoryExists(artifactsDir);
});
Task("Restore")
.Does(() =>
{
DotNetRestore(sln.ToString());
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
var msBuildSettings = new DotNetMSBuildSettings
{
Version = versionInfo.SemVer,
PackageVersion = versionInfo.SemVer,
InformationalVersion = versionInfo.InformationalVersion
};
var settings = new DotNetBuildSettings
{
Configuration = configuration,
MSBuildSettings = msBuildSettings
};
DotNetBuild(sln.ToString(), settings);
});
Task("CopyArtifacts")
.IsDependentOn("Build")
.Does(() =>
{
var nugetFiles = GetFiles("BTProgressHUD/bin/" + configuration + "/**/*.nupkg");
CopyFiles(nugetFiles, artifactsDir);
CopyFileToDirectory(gitVersionLog, artifactsDir);
});
Task("Default")
.IsDependentOn("CopyArtifacts");
RunTarget(target);