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
|
|
|
|
|
|
|
// TASKS
|
|
|
|
|
2017-10-25 23:42:57 +00:00
|
|
|
Task("Init")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
2017-10-29 14:28:44 +00:00
|
|
|
// Assign some common properties
|
2017-10-29 23:49:23 +00:00
|
|
|
msbuildsettings = msbuildsettings.WithProperty("Version", "3.22.24.9");
|
2017-10-29 14:28:44 +00:00
|
|
|
msbuildsettings = msbuildsettings.WithProperty("Authors", "'GtkSharp Contributors'");
|
|
|
|
msbuildsettings = msbuildsettings.WithProperty("PackageLicenseUrl", "'https://github.com/cra0zy/GtkSharp/blob/cakecore/LICENSE'");
|
2017-10-26 16:30:48 +00:00
|
|
|
|
2017-10-25 23:42:57 +00:00
|
|
|
// Add stuff to list
|
2017-10-29 14:28:44 +00:00
|
|
|
Settings.Init();
|
2017-10-28 22:57:52 +00:00
|
|
|
foreach(var gassembly in Settings.AssemblyList)
|
2017-10-25 23:42:57 +00:00
|
|
|
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");
|
2017-10-29 23:23:56 +00:00
|
|
|
System.IO.Directory.SetCurrentDirectory("BuildOutput/LinuxStubs");
|
|
|
|
FileWriteText("empty.c", "");
|
2017-10-26 16:30:48 +00:00
|
|
|
foreach(var gassembly in list)
|
|
|
|
gassembly.GenerateLinuxStubs();
|
2017-10-29 23:23:56 +00:00
|
|
|
System.IO.Directory.SetCurrentDirectory("../..");
|
2017-10-26 16:30:48 +00:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2017-10-28 22:57:52 +00:00
|
|
|
if (list.Count == Settings.AssemblyList.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
|
|
|
});
|
|
|
|
|
2017-10-28 23:35:22 +00:00
|
|
|
Task("PackageTemplates")
|
|
|
|
.IsDependentOn("Init")
|
|
|
|
.Does(() =>
|
|
|
|
{
|
|
|
|
var settings = new NuGetPackSettings
|
|
|
|
{
|
|
|
|
BasePath = "Source/Templates/NetCore/GtkSharp.Template.CSharp",
|
|
|
|
OutputDirectory = "BuildOutput/NugetPackages"
|
|
|
|
};
|
|
|
|
|
|
|
|
NuGetPack("Source/Templates/NetCore/GtkSharp.Template.CSharp/GtkSharp.Template.CSharp.nuspec", 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);
|