-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
executable file
·95 lines (80 loc) · 2.83 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
#addin "Cake.ExtendedNuGet"
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("Configuration", "Release");
var outputDir = Directory("./Output");
var iOSProjectDir = Directory("./CYRTextViewXamariniOS");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectories ("./**/bin");
CleanDirectories ("./**/obj");
if(DirectoryExists("./CYRTextViewXamariniOS/CYRTextViewKit.framework"))
{
DeleteDirectory ("./CYRTextViewXamariniOS/CYRTextViewKit.framework", recursive:true);
}
});
// Task("Restore-NuGet-Packages")
// .IsDependentOn("Clean")
// .Does(() =>
// {
// NuGetRestore(solutionFilePath);
// });
Task("Build-CYRTextView")
.IsDependentOn("Clean")
.Does(() =>
{
IEnumerable<string> redirectedStandardOutput;
IEnumerable<string> redirectedErrorOutput;
var exitCodeWithArgument =
StartProcess(
"make",
new ProcessSettings {
WorkingDirectory = iOSProjectDir,
RedirectStandardOutput = true
},
out redirectedStandardOutput,
out redirectedErrorOutput
);
// Output last line of process output.
Information("Last line of output: {0}", redirectedStandardOutput.LastOrDefault());
// Throw exception if anything was written to the standard error.
if (redirectedErrorOutput!=null && redirectedErrorOutput.Any())
{
throw new Exception(
string.Format(
"Errors ocurred: {0}",
string.Join(", ", redirectedErrorOutput)));
}
});
Task("Build-XamarinBindingLibrary")
.IsDependentOn("Build-CYRTextView")
.Does(() =>
{
MSBuild($"{iOSProjectDir}/CYRTextViewXamariniOS.sln", settings =>
settings.SetConfiguration(configuration)
.WithTarget("CYRTextViewXamariniOS")
);
});
Task("General-NuGet-Packages")
.IsDependentOn("Build-XamarinBindingLibrary")
.Does(() =>
{
NuGetPack("./CYRTextView.Xamarin.iOS.nuspec", new NuGetPackSettings());
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build-XamarinBindingLibrary")
.IsDependentOn("General-NuGet-Packages")
;
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);