2017-10-22 23:25:13 +00:00
|
|
|
#load CakeScripts\GAssembly.cs
|
2017-10-25 23:42:57 +00:00
|
|
|
#load CakeScripts\Settings.cs
|
2017-10-22 23:25:13 +00:00
|
|
|
#addin "Cake.FileHelpers"
|
2017-10-25 23:42:57 +00:00
|
|
|
#addin "Cake.Incubator"
|
2017-10-22 23:25:13 +00:00
|
|
|
|
|
|
|
// VARS
|
|
|
|
|
2017-10-25 23:42:57 +00:00
|
|
|
Settings.Cake = Context;
|
|
|
|
Settings.BuildTarget = Argument("BuildTarget", "Default");
|
|
|
|
Settings.Assembly = Argument("Assembly", "");
|
2017-10-22 23:25:13 +00:00
|
|
|
|
2017-10-26 16:30:48 +00:00
|
|
|
var msbuildsettings = new DotNetCoreMSBuildSettings();
|
2017-10-25 23:42:57 +00:00
|
|
|
var list = new List<GAssembly>();
|
2017-10-22 23:25:13 +00:00
|
|
|
var glist = new List<GAssembly>()
|
|
|
|
{
|
2017-10-26 16:30:48 +00:00
|
|
|
new GAssembly("GLibSharp")
|
|
|
|
{
|
|
|
|
NativeDeps = new[] {
|
|
|
|
"libglib-2.0.so.0", "libglib-2.0-0",
|
|
|
|
"libgobject-2.0.so.0", "libgobject-2.0-0",
|
|
|
|
"libgthread-2.0.so.0", "libgthread-2.0-0"
|
|
|
|
}
|
|
|
|
},
|
2017-10-22 23:25:13 +00:00
|
|
|
new GAssembly("GioSharp")
|
|
|
|
{
|
2017-10-26 16:30:48 +00:00
|
|
|
Deps = new[] { "GLibSharp" },
|
|
|
|
NativeDeps = new[] { "libgio-2.0.so.0", "libgio-2.0-0" }
|
2017-10-22 23:25:13 +00:00
|
|
|
},
|
|
|
|
new GAssembly("AtkSharp")
|
|
|
|
{
|
2017-10-25 23:42:57 +00:00
|
|
|
Deps = new[] { "GLibSharp" },
|
2017-10-26 16:30:48 +00:00
|
|
|
NativeDeps = new[] { "libatk-1.0.so.0", "libatk-1.0-0" },
|
2017-10-22 23:25:13 +00:00
|
|
|
ExtraArgs = "--abi-cs-usings=Atk,GLib"
|
|
|
|
},
|
2017-10-28 22:52:28 +00:00
|
|
|
new GAssembly("CairoSharp")
|
2017-10-26 16:30:48 +00:00
|
|
|
{
|
|
|
|
NativeDeps = new[] { "libcairo.so.2", "libcairo-2" }
|
|
|
|
},
|
2017-10-22 23:25:13 +00:00
|
|
|
new GAssembly("PangoSharp")
|
|
|
|
{
|
2017-10-28 22:52:28 +00:00
|
|
|
Deps = new[] { "GLibSharp", "CairoSharp" },
|
2017-10-26 16:30:48 +00:00
|
|
|
NativeDeps = new[] { "libpango-1.0.so.0", "libpango-1.0-0" }
|
2017-10-22 23:25:13 +00:00
|
|
|
},
|
|
|
|
new GAssembly("GdkSharp")
|
|
|
|
{
|
2017-10-28 22:52:28 +00:00
|
|
|
Deps = new[] { "GLibSharp", "GioSharp", "CairoSharp", "PangoSharp" },
|
2017-10-26 16:30:48 +00:00
|
|
|
NativeDeps = new[] {
|
|
|
|
"libgdk-3.so.0", "libgdk-3-0",
|
|
|
|
"libgdk_pixbuf-2.0.so.0", "libgdk_pixbuf-2.0-0"
|
|
|
|
}
|
2017-10-22 23:25:13 +00:00
|
|
|
},
|
|
|
|
new GAssembly("GtkSharp")
|
|
|
|
{
|
2017-10-28 22:52:28 +00:00
|
|
|
Deps = new[] { "GLibSharp", "GioSharp", "AtkSharp", "CairoSharp", "PangoSharp", "GdkSharp" },
|
2017-10-26 16:30:48 +00:00
|
|
|
NativeDeps = new[] { "libgtk-3.so.0", "libgtk-3-0" },
|
2017-10-22 23:25:13 +00:00
|
|
|
ExtraArgs = "--abi-cs-usings=Gtk,GLib"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// TASKS
|
|
|
|
|
2017-10-25 23:42:57 +00:00
|
|
|
Task("Init")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
2017-10-26 16:30:48 +00:00
|
|
|
// Assign version
|
|
|
|
msbuildsettings = msbuildsettings.WithProperty("Version", "3.0.0.0");
|
|
|
|
msbuildsettings = msbuildsettings.WithProperty("Authors", "'GLibSharp Team'");
|
|
|
|
|
2017-10-25 23:42:57 +00:00
|
|
|
// Add stuff to list
|
|
|
|
foreach(var gassembly in glist)
|
|
|
|
if(string.IsNullOrEmpty(Settings.Assembly) || Settings.Assembly == gassembly.Name)
|
|
|
|
list.Add(gassembly);
|
|
|
|
});
|
|
|
|
|
2017-10-22 23:25:13 +00:00
|
|
|
Task("Prepare")
|
2017-10-25 23:42:57 +00:00
|
|
|
.IsDependentOn("Clean")
|
2017-10-22 23:25:13 +00:00
|
|
|
.Does(() =>
|
|
|
|
{
|
2017-10-26 16:30:48 +00:00
|
|
|
// Build tools
|
|
|
|
DotNetCoreRestore("Source/Tools/Tools.sln");
|
|
|
|
MSBuild("Source/Tools/Tools.sln", new MSBuildSettings {
|
2017-10-22 23:25:13 +00:00
|
|
|
Verbosity = Verbosity.Minimal,
|
|
|
|
Configuration = "Release",
|
|
|
|
});
|
|
|
|
|
2017-10-25 23:42:57 +00:00
|
|
|
// Generate code and prepare libs projects
|
|
|
|
foreach(var gassembly in list)
|
2017-10-22 23:25:13 +00:00
|
|
|
gassembly.Prepare();
|
2017-10-28 22:52:28 +00:00
|
|
|
DotNetCoreRestore("Source/Libs/GtkSharp.sln");
|
2017-10-25 23:42:57 +00:00
|
|
|
});
|
|
|
|
|
2017-10-26 16:30:48 +00:00
|
|
|
Task("GenerateLinuxStubs")
|
|
|
|
.IsDependentOn("Init")
|
2017-10-25 23:42:57 +00:00
|
|
|
.Does(() =>
|
|
|
|
{
|
2017-10-26 16:30:48 +00:00
|
|
|
CreateDirectory("BuildOutput/LinuxStubs");
|
|
|
|
FileWriteText("BuildOutput/LinuxStubs/empty.c", "");
|
|
|
|
foreach(var gassembly in list)
|
|
|
|
gassembly.GenerateLinuxStubs();
|
|
|
|
DeleteDirectory("BuildOutput/LinuxStubs", new DeleteDirectorySettings { Recursive = true, Force = true });
|
2017-10-22 23:25:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
Task("Clean")
|
2017-10-25 23:42:57 +00:00
|
|
|
.IsDependentOn("Init")
|
2017-10-22 23:25:13 +00:00
|
|
|
.Does(() =>
|
|
|
|
{
|
2017-10-25 23:42:57 +00:00
|
|
|
foreach(var gassembly in list)
|
2017-10-22 23:25:13 +00:00
|
|
|
gassembly.Clean();
|
|
|
|
});
|
|
|
|
|
2017-10-25 23:42:57 +00:00
|
|
|
Task("FullClean")
|
|
|
|
.IsDependentOn("Clean")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
DeleteDirectory("BuildOutput", true);
|
|
|
|
});
|
|
|
|
|
2017-10-22 23:25:13 +00:00
|
|
|
Task("Build")
|
|
|
|
.IsDependentOn("Prepare")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
2017-10-26 16:30:48 +00:00
|
|
|
var settings = new DotNetCoreBuildSettings
|
2017-10-22 23:25:13 +00:00
|
|
|
{
|
2017-10-26 16:30:48 +00:00
|
|
|
Configuration = "Release",
|
|
|
|
MSBuildSettings = msbuildsettings
|
|
|
|
};
|
|
|
|
|
|
|
|
if (list.Count == glist.Count)
|
2017-10-28 22:52:28 +00:00
|
|
|
DotNetCoreBuild("Source/Libs/GtkSharp.sln", settings);
|
2017-10-25 23:42:57 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
foreach(var gassembly in list)
|
2017-10-26 16:30:48 +00:00
|
|
|
DotNetCoreBuild(gassembly.Csproj, settings);
|
2017-10-25 23:42:57 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Task("PackageNuGet")
|
|
|
|
.IsDependentOn("Build")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var settings = new DotNetCorePackSettings
|
|
|
|
{
|
2017-10-26 16:30:48 +00:00
|
|
|
MSBuildSettings = msbuildsettings,
|
2017-10-25 23:42:57 +00:00
|
|
|
Configuration = "Release",
|
|
|
|
OutputDirectory = "BuildOutput/NugetPackages",
|
2017-10-26 16:30:48 +00:00
|
|
|
NoBuild = true,
|
|
|
|
|
2017-10-25 23:42:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
foreach(var gassembly in list)
|
|
|
|
DotNetCorePack(gassembly.Csproj, settings);
|
2017-10-22 23:25:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// TASK TARGETS
|
|
|
|
|
|
|
|
Task("Default")
|
|
|
|
.IsDependentOn("Build");
|
|
|
|
|
|
|
|
// EXECUTION
|
|
|
|
|
2017-10-25 23:42:57 +00:00
|
|
|
RunTarget(Settings.BuildTarget);
|