forked from luberda-molinet/FFImageLoading
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
91 lines (77 loc) · 2.42 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
#addin nuget:?package=Cake.Android.SdkManager
var TARGET = Argument ("target", Argument ("t", "Default"));
var TAG = EnvironmentVariable ("APPVEYOR_REPO_TAG") == "true";
var BUILD_NUMBER = EnvironmentVariable ("APPVEYOR_BUILD_NUMBER");
var VERSION = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");
var NUGET_VERSION = TAG ? VERSION : (VERSION + "-pre");
var CONFIG = Argument("configuration", EnvironmentVariable ("CONFIGURATION") ?? "Release");
var SLN = "./FFImageLoading.sln";
var ANDROID_HOME = EnvironmentVariable ("ANDROID_HOME") ?? Argument ("android_home", "");
Task("RestoreNuGet")
.ContinueOnError()
.Does(() =>
{
var settings = new NuGetRestoreSettings()
{
Verbosity = NuGetVerbosity.Quiet
};
NuGetRestore(SLN, settings);
});
Task("Libraries")
.IsDependentOn("RestoreNuGet")
.Does(()=>
{
MSBuild(SLN, settings => settings
.SetConfiguration(CONFIG)
.UseToolVersion(MSBuildToolVersion.VS2017)
.SetMSBuildPlatform(Cake.Common.Tools.MSBuild.MSBuildPlatform.x86)
.SetVerbosity(Verbosity.Minimal)
.WithProperty("TreatWarningsAsErrors", false.ToString())
.WithProperty("NoWarn", "1591") /* 1701","1702","1705","1591","1587","NU1605" */
);
});
Task ("AndroidSDK")
.Does (() =>
{
Information ("ANDROID_HOME: {0}", ANDROID_HOME);
var androidSdkSettings = new AndroidSdkManagerToolSettings {
SdkRoot = ANDROID_HOME,
SkipVersionCheck = true
};
try { AcceptLicenses (androidSdkSettings); } catch { }
AndroidSdkManagerInstall (new [] {
"platforms;android-26"
}, androidSdkSettings);
});
Task ("NuGet")
.IsDependentOn("AndroidSDK")
.IsDependentOn ("Libraries")
.Does (() =>
{
if(!DirectoryExists("./Build/nuget/"))
CreateDirectory("./Build/nuget");
var nuspecFiles = GetFiles("./nuget/*.nuspec");
foreach(var file in nuspecFiles)
{
var updatedNuspec = System.IO.File.ReadAllText(file.FullPath)
.Replace("@version", NUGET_VERSION);
System.IO.File.WriteAllText(file.FullPath, updatedNuspec);
NuGetPack (file.FullPath, new NuGetPackSettings {
Version = NUGET_VERSION,
OutputDirectory = "./Build/nuget/",
BasePath = "./source"
});
}
});
Task ("Default")
.IsDependentOn("Clean")
.IsDependentOn("NuGet");
Task ("Clean")
.Does (() =>
{
// CleanDirectory ("./component/tools/");
CleanDirectories ("./Build/");
CleanDirectories ("./**/bin");
CleanDirectories ("./**/obj");
});
RunTarget (TARGET);