Skip to content

Offers a Code based approach to Cake builder system. Contains the Code.Cake.dll.

License

Notifications You must be signed in to change notification settings

borovskyav/CodeCake

 
 

Repository files navigation

Code.Cake

Code-based approach to the Cake (C# Make) build system. Provides a C# build host to use Cake methods, utilities and addins in a .NET application.

This project is not affiliated with Cake, nor supported by the Cake contributors.

Using Code.Cake

  1. Create or open a NET framework C# project
  2. Install the Code.Cake NuGet package: Install-Package Code.Cake
  3. Create a build host class:
// Cake extension methods and utilities are split into many different namespaces, which all need to be specified.
// They're all on https://cakebuild.net/api/ if you're looking for them.
using Cake.Common.Build;
using Cake.Common.Diagnostics;
using Cake.Common.IO;
using Cake.Common.Tools.NuGet;
using Cake.Common.Tools.MSBuild;

// AddPathAttribute will add directories to the process' PATH environment variable.
// Use it if you have external executables like nuget.exe, octo.exe, etc.
[AddPath("packages/**/tools*")]
public class Build : CodeCakeHost
{
    public Build()
    {
        // The Cake property has all Cake properties, tools and extension methods on it
        Cake.Log.Verbosity = Verbosity.Diagnostic;

        var binDir = Cake.Directory("bin");
        var solutionFile = Cake.File("MySolution.sln");

        // Task example
        Task("Clean")
            .Does(() =>
            {
                Cake.CleanDirectories(binDir);
            });

        // Tasks can depend on other tasks, which will be executed before
        Task("Build")
            .IsDependentOn("Clean");
            .Does(() =>
            {
                Cake.NuGetRestore(solutionFile);
                Cake.MSBuild(solutionFile);
            });

        // If no task is specified when you execute Code.Cake, the "Default" task will be executed
        Task("Default")
            .IsDependentOn("Build");
    }
}
  1. In your code, call Code.Cake;
string[] cakeArgs;
var app = new CodeCakeApplication();
app.Run(cakeArgs);

Build instructions

  1. Clone the repository
  2. Using Powershell, execute CodeCakeBuilder/Bootstrap.ps1
  3. Execute CodeCakeBuilder/bin/Release/CodeCakeBuilder.exe

NuGet packages

Feed Code.Cake
NuGet stable NuGet
NuGet prerelease NuGet Pre Release
MyGet preview MyGet Pre Release
MyGet CI MyGet Pre Release

Build status

Branch Visual Studio 2017
latest AppVeyor
master AppVeyor

Contributing

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.

License

Assets in this repository are licensed with the MIT License. For more information, please see LICENSE.txt.

Open-source licenses

This repository and its components use the following open-source projects:

About

Offers a Code based approach to Cake builder system. Contains the Code.Cake.dll.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 97.5%
  • PowerShell 2.5%