forked from xamarin/SignaturePad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
112 lines (94 loc) · 4.16 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
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var CURRENT_PACKAGE_VERSION = "3.0.0";
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var packageVersion = Argument("packageVersion", CURRENT_PACKAGE_VERSION);
var majorVersion = $"{packageVersion.Substring(0, packageVersion.IndexOf("."))}.0.0.0";
var buildVersion = Argument("buildVersion", EnvironmentVariable("BUILD_NUMBER") ?? "");
if (!string.IsNullOrEmpty(buildVersion)) {
buildVersion = $"-{buildVersion}";
}
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("libs")
.Does(() =>
{
var sln = IsRunningOnWindows() ? "./src/SignaturePad.sln" : "./src/SignaturePad.Mac.sln";
MSBuild(sln, new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Configuration = configuration,
PlatformTarget = PlatformTarget.MSIL,
MSBuildPlatform = MSBuildPlatform.x86,
ArgumentCustomization = args => args.Append("/restore"),
Properties = {
{ "AssemblyVersion", new [] { majorVersion } },
{ "Version", new [] { packageVersion } },
},
});
EnsureDirectoryExists("./output/android/");
EnsureDirectoryExists("./output/ios/");
EnsureDirectoryExists("./output/uwp/");
EnsureDirectoryExists("./output/uwp/Themes");
EnsureDirectoryExists("./output/netstandard/");
CopyFiles($"./src/SignaturePad.Android/bin/{configuration}/SignaturePad.*", "./output/android/");
CopyFiles($"./src/SignaturePad.iOS/bin/{configuration}/SignaturePad.*", "./output/ios/");
CopyFiles($"./src/SignaturePad.UWP/bin/{configuration}/SignaturePad.*", "./output/uwp/");
CopyFiles($"./src/SignaturePad.UWP/bin/{configuration}/Themes/*", "./output/uwp/Themes");
CopyFiles($"./src/SignaturePad.Forms.Droid/bin/{configuration}/SignaturePad.Forms.*", "./output/android/");
CopyFiles($"./src/SignaturePad.Forms.iOS/bin/{configuration}/SignaturePad.Forms.*", "./output/ios/");
CopyFiles($"./src/SignaturePad.Forms.UWP/bin/{configuration}/SignaturePad.Forms.*", "./output/uwp/");
CopyFiles($"./src/SignaturePad.Forms.UWP/bin/{configuration}/Themes/*", "./output/uwp/Themes");
CopyFiles($"./src/SignaturePad.Forms/bin/{configuration}/SignaturePad.Forms.*", "./output/netstandard/");
});
Task("nuget")
.IsDependentOn("libs")
.WithCriteria(IsRunningOnWindows())
.Does(() =>
{
var nuget = Context.Tools.Resolve("nuget.exe");
var nuspecs = GetFiles("./nuget/*.nuspec");
var settings = new NuGetPackSettings {
BasePath = ".",
OutputDirectory = "./output",
Properties = new Dictionary<string, string> {
{ "configuration", configuration },
{ "version", packageVersion },
},
};
EnsureDirectoryExists("./output");
NuGetPack(nuspecs, settings);
settings.Properties["version"] = $"{packageVersion}-preview{buildVersion}";
NuGetPack(nuspecs, settings);
});
Task("samples")
.IsDependentOn("libs")
.Does(() =>
{
var settings = new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Configuration = configuration,
PlatformTarget = PlatformTarget.MSIL,
MSBuildPlatform = MSBuildPlatform.x86,
ArgumentCustomization = args => args.Append("/restore"),
};
if (IsRunningOnWindows()) {
MSBuild("./samples/Sample.Android/Sample.Android.sln", settings);
MSBuild("./samples/Sample.iOS/Sample.iOS.sln", settings);
MSBuild("./samples/Sample.UWP/Sample.UWP.sln", settings);
MSBuild("./samples/Sample.Forms/Sample.Forms.sln", settings);
} else {
MSBuild("./samples/Sample.Android/Sample.Android.sln", settings);
MSBuild("./samples/Sample.iOS/Sample.iOS.sln", settings);
MSBuild("./samples/Sample.Forms/Sample.Forms.Mac.sln", settings);
}
});
Task("Default")
.IsDependentOn("libs")
.IsDependentOn("nuget")
.IsDependentOn("samples");
Task("CI")
.IsDependentOn("Default");
RunTarget(target);