-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.cake
67 lines (59 loc) · 2.02 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
// Cake Addins
#addin nuget:?package=Cake.FileHelpers&version=7.0.0
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
var ARTIFACT = Argument<string>("artifact");
var DOTNET_VERSION = Argument<string>("dotnet", "8.0");
var TASK = Argument<string>("task", Argument<string>("t", "Default"));
Task("Setup Global.json")
.Does(() =>
{
// var globalJsonFile = DOTNET_VERSION.StartsWith("8.0")
// ? "global.8.json"
// : "global.7.json";
// CopyFile($"./{globalJsonFile}", $"./global.json");
});
Task("Create BindingHost.props")
.Does(() =>
{
Information ($"ARTIFACT : {ARTIFACT}");
var props = $@"<Project>
<ItemGroup>
<GradleImplementation Include=""{ARTIFACT}""></GradleImplementation>
</ItemGroup>
</Project>
";
FileWriteText("./src/libs/BindingHost/BindingHost.props", props);
});
Task("Copy group maven.props")
.Does(() =>
{
var artifactParts = ARTIFACT.Split(new [] { ":" }, StringSplitOptions.RemoveEmptyEntries);
var groupPropsPath = $"./src/android/{artifactParts[0]}/maven.props";
if (FileExists(groupPropsPath))
{
Information ($"Maven for group : {groupPropsPath}");
CopyFile(groupPropsPath, $"./src/libs/BindingHost/{artifactParts[0]}_maven.props");
} else {
Information ($"Maven for group : N/A");
}
var artifactPropsPath = $"./src/android/{artifactParts[0]}/{artifactParts[1]}/maven.props";
if (FileExists(artifactPropsPath))
{
Information ($"Maven for artifact : {artifactPropsPath}");
CopyFile(artifactPropsPath, $"./src/libs/BindingHost/{artifactParts[0]})_{artifactParts[1]}_maven.props");
} else {
Information ($"Maven for artifact : N/A");
}
});
Task("Default")
.IsDependentOn("Setup Global.json")
.IsDependentOn("Create BindingHost.props")
.IsDependentOn("Copy group maven.props")
.Does(() => {
Information ($"DONE");
});
RunTarget (TASK);