cake-build / cake Goto Github PK
View Code? Open in Web Editor NEW:cake: Cake (C# Make) is a cross platform build automation system.
Home Page: https://cakebuild.net
License: MIT License
:cake: Cake (C# Make) is a cross platform build automation system.
Home Page: https://cakebuild.net
License: MIT License
Simplified task graph configuration.
Graph("Clean")
.Then("Build")
.Then("Run-Unit-Tests", If(() => runTests))
.Then("Copy-Files")
.Then("Zip-Files", If(c => c.HasArgument("zipFiles")))
.Then("Create-NuGet-Package")
.Then("Publish-NuGet-Package", If(publish))
.Then("All")
var outputAssembly = "./output/merged.exe";
var primaryAssembly = "./build/application.exe";
var assemblyPaths = GetFiles("/build/*.dll");
ILMerge(outputAssembly, primaryAssembly, assemblyPaths,
new ILMergeSettings {
TargetKind = TargetKind.Exe,
Internalize = true
}
);
When validating the graph, throw an exception with a friendly error message if a task with the same name as the one that is being added already exist.
Add option to add a description to a task.
Task("Magic")
.HasDescription("Performs magic")
.Does(() =>
{
DoMagic();
});
When starting Cake with the -showtasks
parameter, the following output should be shown.
Tasks Description
===============================
Magic Performs magic
The friendly name should be used when printing the task name in the output or presenting the task in the report.
Task("Unit-Tests")
.HasFriendlyName("Run unit tests")
.IsDependentOn("Build")
.Does(() =>
{
// Run unit tests.
XUnit("./src/**/bin/" + configuration + "/*.Tests.dll");
});
Should probably introduce script alias properties to make it cleaner and easier to use.
Script aliases:
// Detect if this is a team city build
bool IsTeamCityBuild();
// Set progress.
void SetTeamCityProgress("Building things");
// Start and finish progress scope.
void StartTeamCityProgress("Building things");
void FinishTeamCityProgress("Building thing");
// Set build version.
void SetTeamCityBuildVersion("1.0.0");
// Open and close message block.
void OpenTeamCityBlock("Run unit tests");
void CloseTeamCityBlock("Run unit tests");
// Publish artifact.
PublishTeamCityArtifact("./bin/**/*");
Convenience:
// Report progress
using(TeamCityProgress("Building things")
{
// Do magic
}
// Wrap operations in message block.
using(TeamCityBlock("Run unit tests"))
{
// Do magic
}
When launching a process, the parameters should be written to the log (with diagnostic verbosity).
A dependency is something that HAS to be run before something else. If it does not have to be run, it should allow the task to run anyway.
Task("First")
.WithCriteria(() => shouldDoStuff)
.Does(() =>
{
});
Task("Second")
.RunsAfter("First")
.Does(() =>
{
});
Task("Third")
.IsDependentOn("Second")
.Does(() =>
{
});
In the example before, the task Second
will be run regardless if shouldDoStuff
was true or not, Third
is dependent on Second
though, so if Second
did not run, an exception will be thrown.
By convention, all external tools are located under ./tools/thetool/
. All script extensions that uses external tools should have a tool path option, so the script can tell were to find them.
Task("NuGet")
.IsDependentOn("Pack")
.Does(() =>
{
// Create NuGet package.
NuGetPack("./Cake.nuspec", new NuGetPackSettings
{
Version = "0.1.0",
BasePath = "./src/Cake/bin/" + configuration,
OutputDirectory = "./build",
NoPackageAnalysis = true,
ToolPath = @"C:/NuGet.exe"
});
});
The Cake engine should return a benchmark report if the built went well.
Should be able to create AssemblyInfo files from build script.
Start out with minimal package support.
For example; files, references and release notes have to be added as part of nuspec file, but version information can be passed to method directly.
Task("Create-NuGet-Package")
.IsDependentOn("Build")
.Does(() =>
{
NuGetPack("./Cake.nuspec", new NuGetPackSettings {
BasePath = "./build/bin",
OutputDirectory = "./build",
Version = "1.0.1",
NoPackageAnalysis = true
});
});
Templating support should be added later on.
Features:
Versions:
Should use /m
if nothing is specified for MaxCpuCount.
void CopyFiles(IEnumerable<string> files, DirectoryPath target)
void CleanDirectories(IEnumerable<string> directories)
void DeleteDirectories(IEnumerable<string> directories, bool recursive = false)
void Zip(DirectoryPath root, FilePath output, IEnumerable<string> files)
void XUnit(IEnumerable<string> assemblies)
void XUnit(IEnumerable<string> assemblies, XUnitSettings settings)
void NUnit(IEnumerable<string> assemblies)
void NUnit(IEnumerable<string> assemblies, NUnitSettings settings)
At the moment, all script host methods exposing functionality from ICakeContext is hard coded. These should be generated before executing the script.
This will also eliminate the need for a separate script host (and a lot of redundant code).
Example
If this extension method is declared:
namespace MyStuff
{
public static class MyFunctionality
{
public static void DoMagic(this ICakeContext context, int value)
{
context.Log.Verbose("Hello: {0}", value)
}
}
}
We could add a using statement to namespace MyStuff
and generate a script method:
public void DoMagic(int value)
{
((ICakeContext)this).DoMagic(value);
}
Or call the extension method like a normal method:
public void DoMagic(int value)
{
MyStuff.MyFunctionality.DoMagic((ICakeContext)this, value);
}
The Print method will append a line break to the information written.
Print("Hello World {0}", 1);
By analyzing the syntax tree and look for #r
-directives, we can scan those assemblies for extension methods to ICakeContext
and automatically generate script methods for these.
They could also use operator overloading (+ and -) to make it easier to add and remove files. Globber should return these collections.
Examples
GetFiles("bin/**/*")
.Remove(GetFiles("bin/**/*.md"))
.Add(GetFiles("other/**/*.dll");
GetFiles("bin/**/*")
- GetFiles("bin/**/*.md")
+ GetFiles("other/**/*.dll");
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.