This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
141 lines (118 loc) · 4.21 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#tool nuget:?package=GitVersion.CommandLine
#tool nuget:?package=vswhere
#addin nuget:?package=Cake.Incubator
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var artifactsDirectory = new DirectoryPath("./artifacts");
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectories("./src/**/bin");
CleanDirectories("./src/**/obj");
CleanDirectories(artifactsDirectory.FullPath);
EnsureDirectoryExists(artifactsDirectory);
});
GitVersion versionInfo = null;
Task("Version").Does(() => {
versionInfo = GitVersion(new GitVersionSettings {
UpdateAssemblyInfo = true,
OutputType = GitVersionOutput.Json
});
Information("GitVersion -> {0}", versionInfo.Dump());
});
Task("UpdateAppVeyorBuildNumber")
.IsDependentOn("Version")
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
AppVeyor.UpdateBuildVersion(AppVeyor.Environment.JobId +
versionInfo.InformationalVersion);
});
FilePath msBuildPath;
Task("ResolveBuildTools")
.Does(() =>
{
var vsLatest = VSWhereLatest();
msBuildPath = (vsLatest == null)
? null
: vsLatest.CombineWithFilePath("./MSBuild/15.0/Bin/MSBuild.exe");
});
Task("Build")
.IsDependentOn("ResolveBuildTools")
.IsDependentOn("Clean")
.IsDependentOn("UpdateAppVeyorBuildNumber")
.Does(() =>
{
var settings = new MSBuildSettings
{
Configuration = configuration,
ToolPath = msBuildPath,
Verbosity = Verbosity.Minimal,
ArgumentCustomization = args => args.Append("/m")
};
settings = settings.WithProperty("DebugSymbols", "True").
WithProperty("DebugType", "Full");
MSBuild("./src/RadialMenu/RadialMenu.sln", settings);
});
Task("Package")
.IsDependentOn("Build")
.Does(() =>
{
var nugetContent = new List<NuSpecContent>();
var binDir = "./src/RadialMenu/RadialMenu/bin/iPhone/" + configuration;
var files = GetFiles(binDir + "/*.dll") + GetFiles(binDir + "/*.pdb");
foreach(var dll in files)
{
Information("File: {0}", dll.ToString());
nugetContent.Add(new NuSpecContent
{
Target = "lib/Xamarin.iOS10",
Source = dll.ToString()
});
}
var nugetSettings = new NuGetPackSettings {
Id = "ALRadialMenu",
Title = "RadialMenu for Xamarin.iOS",
Authors = new [] { "Tomasz Cielecki" },
Owners = new [] { "Tomasz Cielecki" },
IconUrl = new Uri("http://i.imgur.com/V3983YY.png"),
ProjectUrl = new Uri("https://github.com/Cheesebaron/ALRadialMenu"),
LicenseUrl = new Uri("https://raw.githubusercontent.com/Cheesebaron/ALRadialMenu/master/LICENSE"),
Copyright = "Copyright (c) Tomasz Cielecki",
Tags = new [] { "menu", "radial", "ios", "xamarin", "alradialmenu", "radialmenu" },
Description = "A Radial Menu for Xamarin.iOS.",
RequireLicenseAcceptance = false,
Version = versionInfo.NuGetVersion,
Symbols = false,
NoPackageAnalysis = true,
OutputDirectory = artifactsDirectory,
Verbosity = NuGetVerbosity.Detailed,
Files = nugetContent,
BasePath = "./"
};
NuGetPack(nugetSettings);
});
Task("UploadAppVeyorArtifact")
.IsDependentOn("Package")
.WithCriteria(() => !AppVeyor.Environment.PullRequest.IsPullRequest)
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
.Does(() => {
Information("Artifacts Dir: {0}", artifactsDirectory.FullPath);
var uploadSettings = new AppVeyorUploadArtifactsSettings {
ArtifactType = AppVeyorUploadArtifactType.NuGetPackage
};
foreach(var file in GetFiles(artifactsDirectory.FullPath + "/*.nupkg"))
{
Information("Uploading {0}", file.FullPath);
AppVeyor.UploadArtifact(file.FullPath, uploadSettings);
}
});
Task("Default")
.IsDependentOn("UploadAppVeyorArtifact");
RunTarget(target);