GtkSharp/build.cake

143 lines
3.7 KiB
Plaintext
Raw Normal View History

2017-10-22 23:25:13 +00:00
#load CakeScripts\GAssembly.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;
2017-12-31 18:51:59 +00:00
Settings.Version = "3.22.24.18";
Settings.BuildTarget = Argument("BuildTarget", "Default");
Settings.Assembly = Argument("Assembly", "");
2017-10-22 23:25:13 +00:00
var msbuildsettings = new DotNetCoreMSBuildSettings();
var list = new List<GAssembly>();
2017-10-22 23:25:13 +00:00
// TASKS
Task("Init")
.Does(() =>
{
2017-10-29 14:28:44 +00:00
// Assign some common properties
2017-10-30 13:52:48 +00:00
msbuildsettings = msbuildsettings.WithProperty("Version", Settings.Version);
2017-10-29 14:28:44 +00:00
msbuildsettings = msbuildsettings.WithProperty("Authors", "'GtkSharp Contributors'");
msbuildsettings = msbuildsettings.WithProperty("PackageLicenseUrl", "'https://github.com/GtkSharp/GtkSharp/blob/cakecore/LICENSE'");
// 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)
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/Tools.sln");
DotNetCoreBuild("Source/Tools/Tools.sln", new DotNetCoreBuildSettings {
Verbosity = DotNetCoreVerbosity.Minimal,
Configuration = "Release"
2017-10-22 23:25:13 +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");
});
Task("GenerateLinuxStubs")
.IsDependentOn("Init")
.Does(() =>
{
CreateDirectory("BuildOutput/LinuxStubs");
2017-10-29 23:23:56 +00:00
System.IO.Directory.SetCurrentDirectory("BuildOutput/LinuxStubs");
FileWriteText("empty.c", "");
foreach(var gassembly in list)
gassembly.GenerateLinuxStubs();
2017-10-29 23:23:56 +00:00
System.IO.Directory.SetCurrentDirectory("../..");
DeleteDirectory("BuildOutput/LinuxStubs", new DeleteDirectorySettings { Recursive = true, Force = true });
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(() =>
{
var settings = new DotNetCoreBuildSettings
2017-10-22 23:25:13 +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);
else
{
foreach(var gassembly in list)
DotNetCoreBuild(gassembly.Csproj, settings);
}
});
Task("PackageNuGet")
.IsDependentOn("Build")
.Does(() =>
{
var settings = new DotNetCorePackSettings
{
MSBuildSettings = msbuildsettings,
Configuration = "Release",
OutputDirectory = "BuildOutput/NugetPackages",
NoBuild = true,
};
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
{
2017-10-30 13:52:48 +00:00
OutputDirectory = "BuildOutput/NugetPackages",
Version = Settings.Version
2017-10-28 23:35:22 +00:00
};
2017-11-07 19:12:11 +00:00
settings.BasePath = "Source/Templates/GtkSharp.Template.CSharp";
NuGetPack("Source/Templates/GtkSharp.Template.CSharp/GtkSharp.Template.CSharp.nuspec", settings);
2017-11-03 13:46:26 +00:00
2017-11-07 19:12:11 +00:00
settings.BasePath = "Source/Templates/GtkSharp.Template.VBNet";
NuGetPack("Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec", settings);
2017-10-28 23:35:22 +00:00
});
2017-10-22 23:25:13 +00:00
// TASK TARGETS
Task("Default")
.IsDependentOn("Build");
2017-11-12 01:32:36 +00:00
Task("FullBuild")
.IsDependentOn("PackageNuGet")
.IsDependentOn("PackageTemplates");
2017-10-22 23:25:13 +00:00
// EXECUTION
RunTarget(Settings.BuildTarget);