GtkSharp/build.cake

138 lines
3 KiB
Plaintext
Raw Normal View History

2017-10-22 23:25:13 +00:00
#load CakeScripts\GAssembly.cs
#load CakeScripts\GapiFixup.cs
#load CakeScripts\Settings.cs
2017-10-22 23:25:13 +00:00
#addin "Cake.FileHelpers"
#addin "Cake.Incubator"
2017-10-22 23:25:13 +00:00
// VARS
Settings.Cake = Context;
Settings.BuildTarget = Argument("BuildTarget", "Default");
Settings.Assembly = Argument("Assembly", "");
2017-10-22 23:25:13 +00:00
var configuration = Argument("Configuration", "Release");
var list = new List<GAssembly>();
2017-10-22 23:25:13 +00:00
var glist = new List<GAssembly>()
{
new GAssembly("GLibSharp"),
new GAssembly("GioSharp")
{
Deps = new[] { "GLibSharp" }
2017-10-22 23:25:13 +00:00
},
new GAssembly("AtkSharp")
{
Deps = new[] { "GLibSharp" },
2017-10-22 23:25:13 +00:00
ExtraArgs = "--abi-cs-usings=Atk,GLib"
},
new GAssembly("CairoSharp"),
new GAssembly("PangoSharp")
{
Deps = new[] { "GLibSharp", "CairoSharp" }
2017-10-22 23:25:13 +00:00
},
new GAssembly("GdkSharp")
{
Deps = new[] { "GLibSharp", "GioSharp", "CairoSharp", "PangoSharp" }
2017-10-22 23:25:13 +00:00
},
new GAssembly("GtkSharp")
{
Deps = new[] { "GLibSharp", "GioSharp", "AtkSharp", "CairoSharp", "PangoSharp", "GdkSharp" },
2017-10-22 23:25:13 +00:00
ExtraArgs = "--abi-cs-usings=Gtk,GLib"
}
};
// TASKS
Task("Init")
.Does(() =>
{
// 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")
.IsDependentOn("Clean")
2017-10-22 23:25:13 +00:00
.Does(() =>
{
// Build Tools
DotNetCoreRestore("Source/Tools/GapiCodegen/GapiCodegen.csproj");
2017-10-22 23:25:13 +00:00
MSBuild("Source/Tools/GapiCodegen/GapiCodegen.csproj", new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Configuration = "Release",
});
// Generate code and prepare libs projects
foreach(var gassembly in list)
2017-10-22 23:25:13 +00:00
gassembly.Prepare();
DotNetCoreRestore("Source/Libs/GLibSharp.sln");
});
Task("Test")
.Does(() =>
{
2017-10-22 23:25:13 +00:00
});
Task("Clean")
.IsDependentOn("Init")
2017-10-22 23:25:13 +00:00
.Does(() =>
{
foreach(var gassembly in list)
2017-10-22 23:25:13 +00:00
gassembly.Clean();
});
Task("FullClean")
.IsDependentOn("Clean")
.Does(() =>
{
DeleteDirectory("BuildOutput", true);
});
2017-10-22 23:25:13 +00:00
Task("Build")
.IsDependentOn("Prepare")
.Does(() =>
{
if (list.Count == glist.Count)
2017-10-22 23:25:13 +00:00
{
MSBuild("Source/Libs/GLibSharp.sln", new MSBuildSettings {
2017-10-22 23:25:13 +00:00
Verbosity = Verbosity.Minimal,
Configuration = "Release",
});
}
else
{
foreach(var gassembly in list)
{
MSBuild(gassembly.Csproj, new MSBuildSettings {
Verbosity = Verbosity.Minimal,
Configuration = "Release",
});
}
}
});
Task("PackageNuGet")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
Configuration = "Release",
OutputDirectory = "BuildOutput/NugetPackages",
NoBuild = true
};
foreach(var gassembly in list)
DotNetCorePack(gassembly.Csproj, settings);
2017-10-22 23:25:13 +00:00
});
// TASK TARGETS
Task("Default")
.IsDependentOn("Build");
// EXECUTION
RunTarget(Settings.BuildTarget);