forked from jsmarcus/Iconize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cake
93 lines (79 loc) · 2.7 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
#addin nuget:?package=Cake.FileHelpers&version=1.0.3.2
#addin nuget:?package=Cake.Xamarin&version=1.3.0.3
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var version = EnvironmentVariable("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
var solution = "./src/Iconize.sln";
var nuspec = new List<FilePath> {
{ new FilePath("./nuget/Xam.Plugin.Iconize.nuspec") },
{ new FilePath("./nuget/Xam.FormsPlugin.Iconize.nuspec") },
{ new FilePath("./nuget/Xam.Plugin.Iconize.EntypoPlus.nuspec") },
{ new FilePath("./nuget/Xam.Plugin.Iconize.FontAwesome.nuspec") },
{ new FilePath("./nuget/Xam.Plugin.Iconize.Ionicons.nuspec") },
{ new FilePath("./nuget/Xam.Plugin.Iconize.Material.nuspec") },
{ new FilePath("./nuget/Xam.Plugin.Iconize.Meteocons.nuspec") },
{ new FilePath("./nuget/Xam.Plugin.Iconize.SimpleLineIcons.nuspec") },
{ new FilePath("./nuget/Xam.Plugin.Iconize.Typicons.nuspec") },
{ new FilePath("./nuget/Xam.Plugin.Iconize.WeatherIcons.nuspec") }
};
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Restore-NuGet-Packages")
.Does(() =>
{
NuGetRestore(solution);
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
if(IsRunningOnWindows())
{
// Use MSBuild
MSBuild(solution, settings =>
settings.SetConfiguration(configuration));
}
else
{
// Use XBuild
XBuild(solution, settings =>
settings.SetConfiguration(configuration));
}
});
Task("NuGet")
.IsDependentOn("Build")
.Does (() =>
{
if(!DirectoryExists("./build/nuget/"))
CreateDirectory("./build/nuget");
NuGetPack(nuspec, new NuGetPackSettings {
Version = version,
Verbosity = NuGetVerbosity.Detailed,
OutputDirectory = "./build/nuget/",
BasePath = "./",
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("NuGet");
Task("Clean")
.Does(() =>
{
CleanDirectory("./tools/");
CleanDirectories("./build/");
CleanDirectories("./**/bin");
CleanDirectories("./**/obj");
});
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);