-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.cake
executable file
·99 lines (80 loc) · 2.85 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
// Tools needed by cake addins
#tool nuget:?package=ILRepack&version=2.0.13
#tool nuget:?package=Cake.MonoApiTools&version=3.0.1
#tool nuget:?package=Microsoft.DotNet.BuildTools.GenAPI&version=1.0.0-beta-00081
#tool nuget:?package=vswhere
// Cake Addins
#addin nuget:?package=Cake.FileHelpers&version=3.1.0
#addin nuget:?package=Cake.Compression&version=0.1.6
#addin nuget:?package=Cake.MonoApiTools&version=3.0.1
#addin nuget:?package=Xamarin.Nuget.Validator&version=1.1.1
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var VERSION = "2.0.4";
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
var slnFile = "./Naxam.Ittianyu.BottomNavExtension.sln";
var downloadUrl = string.Format("https://jitpack.io/com/github/ittianyu/BottomNavigationViewEx/{0}/BottomNavigationViewEx-{0}.aar", VERSION);
var downloadTarget = string.Format("./Naxam.Ittianyu.BottomNavExtension/Jars/BottomNavigationViewEx.aar", VERSION);
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Downloads")
.Does(() =>
{
DownloadFile(downloadUrl, downloadTarget);
});
Task("Clean")
.Does(() =>
{
var nugetPackages = GetFiles("./*.nupkg");
foreach (var package in nugetPackages)
{
DeleteFile(package);
}
//CleanDirectory("./packages");
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore(slnFile);
});
Task("Build")
.IsDependentOn("Downloads")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
MSBuild(slnFile, settings => {
settings.ToolVersion = MSBuildToolVersion.VS2019;
settings.SetConfiguration(configuration);
});
});
Task("UpdateVersion")
.Does(() =>
{
var assemblyInfoPath = "./Naxam.Ittianyu.BottomNavExtension/Properties/AssemblyInfo.cs";
ReplaceRegexInFiles(assemblyInfoPath, "\\[assembly\\: AssemblyVersion([^\\]]+)\\]", string.Format("[assembly: AssemblyVersion(\"{0}\")]", VERSION));
});
Task("Pack")
.IsDependentOn("UpdateVersion")
.IsDependentOn("Build")
.Does(() =>
{
NuGetPack("./bottom-nav-ex.nuspec", new NuGetPackSettings {
Version = VERSION
});
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Pack");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);