This repository has been archived by the owner on Jun 11, 2022. It is now read-only.
/
build.cake
108 lines (89 loc) · 3.1 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
108
#tool "nuget:?package=GitVersion.CommandLine"
#tool "nuget:?package=gitlink"
var sln = new FilePath("TZStackView.sln");
var project = new FilePath("TZStackView/TZStackView.csproj");
var binDir = new DirectoryPath("TZStackView/bin/Release");
var nuspec = new FilePath("TZStackView.nuspec");
var outputDir = new DirectoryPath("artifacts");
var target = Argument("target", "Default");
var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor;
var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;
Task("Clean").Does(() =>
{
CleanDirectories("./**/bin");
CleanDirectories("./**/obj");
CleanDirectories(outputDir.FullPath);
});
GitVersion versionInfo = null;
Task("Version").Does(() => {
GitVersion(new GitVersionSettings {
UpdateAssemblyInfo = true,
OutputType = GitVersionOutput.BuildServer
});
versionInfo = GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json });
Information("VI:\t{0}", versionInfo.FullSemVer);
});
Task("Restore").Does(() => {
NuGetRestore(sln);
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Version")
.IsDependentOn("Restore")
.Does(() => {
DotNetBuild(project,
settings => settings.SetConfiguration("Release")
.WithTarget("Build")
);
});
Task("Package")
.IsDependentOn("Build")
.Does(() => {
if (IsRunningOnWindows()) //pdbstr.exe and costura are not xplat currently
GitLink(sln.GetDirectory(), new GitLinkSettings {
RepositoryUrl = "https://github.com/Cheesebaron/TZStackView",
ArgumentCustomization = args => args.Append("-ignore Sample")
});
EnsureDirectoryExists(outputDir);
var files = GetFiles(binDir + "/**/*")
- GetFiles(binDir + "/**/*.mdb"); // no mdb files please
var nugetContent = new List<NuSpecContent>();
foreach(var dll in files){
Information("File: {0}", dll.ToString());
nugetContent.Add(new NuSpecContent {
Target = "lib/Xamarin.iOS10",
Source = dll.ToString()
});
}
Information("File Count {0}", nugetContent.Count);
NuGetPack(nuspec, new NuGetPackSettings {
Authors = new [] { "Tomasz Cielecki" },
Owners = new [] { "Tomasz Cielecki" },
IconUrl = new Uri("http://i.imgur.com/V3983YY.png"),
ProjectUrl = new Uri("https://github.com/Cheesebaron/TZStackView"),
LicenseUrl = new Uri("https://github.com/Cheesebaron/TZStackView/blob/master/LICENSE"),
Copyright = "Copyright (c) Tomasz Cielecki",
RequireLicenseAcceptance = false,
Tags = new [] {"xamarin", "monotouch", "ios", "stackview"},
Version = versionInfo.NuGetVersion,
Symbols = false,
NoPackageAnalysis = true,
OutputDirectory = outputDir,
Verbosity = NuGetVerbosity.Detailed,
Files = nugetContent,
BasePath = "/.",
ReleaseNotes = ParseReleaseNotes("./releasenotes.md").Notes.ToArray()
});
});
Task("UploadAppVeyorArtifact")
.IsDependentOn("Package")
.WithCriteria(() => isRunningOnAppVeyor)
.Does(() => {
Information("Artifacts Dir: {0}", outputDir.FullPath);
foreach(var file in GetFiles(outputDir.FullPath + "/*")) {
Information("Uploading {0}", file.FullPath);
AppVeyor.UploadArtifact(file.FullPath);
}
});
Task("Default").IsDependentOn("UploadAppVeyorArtifact").Does(() => {});
RunTarget(target);