Giter Site home page Giter Site logo

cake-build / cake Goto Github PK

View Code? Open in Web Editor NEW
3.8K 135.0 722.0 11.31 MB

:cake: Cake (C# Make) is a cross platform build automation system.

Home Page: https://cakebuild.net

License: MIT License

C# 99.91% PowerShell 0.06% Shell 0.03%
c-sharp cake dotnet dotnetcore continuous-integration nuget xunit nunit unit-testing build-tool

cake's Introduction

Cake

Cake (C# Make) is a build automation system with a C# DSL to do things like compiling code, copy files/folders, running unit tests, compress files and build NuGet packages.

Runner Latest Released Latest Develop
Cake .NET Tool NuGet Azure Artifacts
Cake Frosting NuGet Azure Artifacts

Continuous integration

Build server Platform Build status Integration tests
Azure Pipelines MacOS Azure Pipelines Mac Build status
Azure Pipelines Windows Azure Pipelines Windows Build status
Azure Pipelines Debian Azure Pipelines Debian Build status
Azure Pipelines Fedora Azure Pipelines Fedora Build status
Azure Pipelines Centos Azure Pipelines Cake Centos status
Azure Pipelines Ubuntu Azure Pipelines Ubuntu Build status
AppVeyor Windows AppVeyor branch AppVeyor branch
TeamCity Windows TeamCity Build Status
Bitrise MacOS Build Status Build Status
Bitrise Debian Build Status Build Status
Bitbucket Pipelines Debian Build Status
GitLab Debian pipeline status  
GitHub Actions Windows / Ubuntu/ macOS Build Status  

Code Coverage

Coverage Status

Table of Contents

  1. Documentation
  2. Contributing
  3. Get in touch
  4. License

Documentation

You can read the latest documentation at https://cakebuild.net/.

For a simple example to get started see Setting up a new project.

Contributing

So you’re thinking about contributing to Cake? Great! It’s really appreciated.

Make sure you've read the contribution guidelines before sending that epic pull request. You'll also need to sign the contribution license agreement (CLA) for anything other than a trivial change. NOTE: The .NET Foundation CLA Bot will provide a link to this CLA within the PR that you submit if it is deemed as required.

  • Fork the repository.
  • Create a branch to work in.
  • Make your feature addition or bug fix.
  • Don't forget the unit tests.
  • Send a pull request.

Get in touch

Follow @cakebuildnet

Join the chat at https://github.com/cake-build/cake/discussions

License

Copyright © .NET Foundation, Patrik Svensson, Mattias Karlsson, Gary Ewan Park, Alistair Chapman, Martin Björkström, Dave Glick, Pascal Berger, Jérémie Desautels, Enrico Campidoglio, C. Augusto Proiete, Nils Andresen, and contributors.

Cake is provided as-is under the MIT license. For more information see LICENSE.

Thanks

A big thank you has to go to JetBrains who provide each of the Cake Developers with an Open Source License for ReSharper that helps with the development of Cake.

Sponsors

Our wonderful sponsors:

Sponsors

Backers

Our wonderful backers:

Backers

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.

Contribution License Agreement

By signing the CLA, the community is free to use your contribution to .NET Foundation projects.

.NET Foundation

This project is supported by the .NET Foundation.

cake's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cake's Issues

Add method to describe tasks

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

ILMerge support

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    
    }
);

xUnit support

  • Run unit tests
  • Shadow copying
  • Output directory
  • Xml report
  • Html report

MSBuild support

Features:

  • Properties
  • Targets
  • Configuration
  • 64 bit support (AMD64)
  • Platform target support

Versions:

  • Visual Studio 2013
  • Visual Studio 2012
  • Visual Studio 2010
  • Visual Studio 2008
  • Visual Studio 2005

Add tools path option

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"
    });
});

Generate script host methods

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);
}

Make a difference between running order and dependencies

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.

Unicorns.

Needs more unicorns. They are fabulous.

Steps to take

  • add unicorn
  • make sure it is fabulous
  • ???
  • profit

You can have mine.
unicorn

TeamCity support

Should probably introduce script alias properties to make it cleaner and easier to use.

  • Set build version
  • Block opened/closed
  • Progress message/start/finish
  • Publish artifact

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
}

Simplified task graph configuration

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")

Add script alias methods that accept strings

  • 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)

Custom collections for file and directory paths

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");

NuGet pack: Set nuspec metadata

  • id
  • title
  • version
  • authors
  • owners
  • description
  • summary
  • projectUrl
  • iconUrl
  • licenseUrl
  • copyright
  • requireLicenseAcceptance
  • releaseNotes
  • tags

Benchmark report

The Cake engine should return a benchmark report if the built went well.

Add friendly name to tasks

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");
});

NuGet packaging support

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.