forked from GtkSharp/GtkSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGAssembly.cake
More file actions
80 lines (66 loc) · 2.39 KB
/
GAssembly.cake
File metadata and controls
80 lines (66 loc) · 2.39 KB
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
using System;
using P = System.IO.Path;
using F = System.IO.File;
public class GAssembly
{
private ICakeContext Cake;
public bool Init { get; private set; }
public string Name { get; private set; }
public string Dir { get; private set; }
public string GDir { get; private set; }
public string Csproj { get; private set; }
public string RawApi { get; private set; }
public string Metadata { get; private set; }
public string[] Deps { get; set; }
public string ExtraArgs { get; set; }
public GAssembly(string name)
{
Cake = Settings.Cake;
Deps = new string[0];
Name = name;
Dir = P.Combine("Source", "Libs", name);
GDir = P.Combine(Dir, "Generated");
var temppath = P.Combine(Dir, name);
Csproj = temppath + ".csproj";
RawApi = temppath + "-api.xml";
Metadata = temppath + ".metadata";
}
public void Prepare()
{
Cake.CreateDirectory(GDir);
var tempapi = P.Combine(GDir, Name + "-api.xml");
Cake.CopyFile(RawApi, tempapi);
// Metadata file found, time to generate some stuff!!!
if (Cake.FileExists(Metadata))
{
// Fixup API file
var symfile = P.Combine(Dir, Name + "-symbols.xml");
Cake.DotNetCoreExecute("BuildOutput/Tools/GapiFixup.dll",
"--metadata=" + Metadata + " " + "--api=" + tempapi +
(Cake.FileExists(symfile) ? " --symbols=" + symfile : string.Empty)
);
var extraargs = ExtraArgs + " ";
// Locate APIs to include
foreach(var dep in Deps)
{
var ipath = P.Combine("Source", "Libs", dep, "Generated", dep + "-api.xml");
if (Cake.FileExists(ipath))
extraargs += " --include=" + ipath + " ";
}
// Generate code
Cake.DotNetCoreExecute("BuildOutput/Tools/GapiCodegen.dll",
"--outdir=" + GDir + " " +
"--schema=Source/Libs/Shared/Gapi.xsd " +
extraargs + " " +
"--assembly-name=" + Name + " " +
"--generate=" + tempapi
);
}
Init = true;
}
public void Clean()
{
if (Cake.DirectoryExists(GDir))
Cake.DeleteDirectory(GDir, new DeleteDirectorySettings { Recursive = true, Force = true });
}
}