Having your cake, and eating it too!

Download Having your cake, and eating it too!

Post on 11-Jan-2017

309 views

Category:

Software

0 download

TRANSCRIPT

Having your Cake, and eating it too!

Having your Cake, and eating it too!

Gary Ewan ParkEmail: gep13@gep13.co.ukTwitter: @gep13Web: http://www.gep13.co.uk

Full disclosure, I am one of three maintainers of the Cake project on GitHub1

What is Cake?

Sorry, but we are not here to talk about Cake of the edible form3

Instead, we are here to talk about Cake, the cross platform build and orchestration tool.

- Supports the most common tools out of the box- Cross Platform (Windows OS X Linux)- Open Source- Small but slowly growing - 387+ Pull Requests - 50 Contributors - About 38 third party addins4

A DefinitionCake (C# Make) is a cross platform 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.

Referencehttp://cakebuild.net/

Built using Roslyn, and the Mono Compiler, allowing execution on both Windows, OS X and LinuxScript Processing to make sure things work the same on both5

Okay, but why do I need it?

Talk about compiling directly out of Visual Studio - You might run some Unit Tests after the build has completed - You might run some static analysis tools within Visual Studio - You might manually create and deploy a package once you know that everything works

This is prone to human error, and not repeatable or maintainable as the complication of the application increases6

What are the main philosophies of Cake?Non intrusiveIt should just workBe highly configurableReplace the parts that you dont likeEasy to implement your own toolsNo tools should be checked into your repositoryShould behave the same way regardless ofOperating SystemEnvironment

7

As an example

8

Cant I just useMAKEFAKECMakeMSBuildNAntPsakeBau

You can use any of these that you want.Fully agree with the concept of a polyglot developer, but from a strictly pragmatic point of view, writing a build script in the same language as you are developing, makes a lot of sense.9

Example Cake Script

Notice, how it is just C#

We have a top level set of input argumentsWe setup some top level arguments that will be used in the rest of the scriptWe start to define the Tasks that will make up the script10

Typical Build Workflow

CleanBuildUnit Tests(NUnit, xUnit, MSTest)Test CoverageStyleCopFxCopDupFinderInspectCodePackagePublishPackage Restore

- Directed acyclic graph11

Lets bake some Cake!

CleanBuildUnit Tests(NUnit, xUnit, MSTest)Test CoverageStyleCopFxCopDupFinderInspectCodePackagePublishPackage Restore

Demo 1NuGet Package Restore

Progress Check

CleanBuildUnit Tests(NUnit, xUnit, MSTest)Test CoverageStyleCopFxCopDupFinderInspectCodePackagePublishPackage Restore

Demo 2Build the Solution

Progress Check

CleanBuildUnit Tests(NUnit, xUnit, MSTest)Test CoverageStyleCopFxCopDupFinderInspectCodePackagePublishPackage Restore

Demo 3Unit Tests

Progress Check

CleanBuildUnit Tests(NUnit, xUnit, MSTest)Test CoverageStyleCopFxCopDupFinderInspectCodePackagePublishPackage Restore

Demo 4Test Coverage

Progress Check

CleanBuildUnit Tests(NUnit, xUnit, MSTest)Test CoverageStyleCopFxCopDupFinderInspectCodePackagePublishPackage Restore

Demo 5NuGet Pack

Progress Check

CleanBuildUnit Tests(NUnit, xUnit, MSTest)Test CoverageStyleCopFxCopDupFinderInspectCodePackagePublishPackage Restore

Questions?Feel free to get in touchEmail: gep13@gep13.co.ukTwitter: @gep13Web: http://www.gep13.co.uk

ResourcesCake Documentationhttp://cakebuild.net/docs

MS Dev Show Podcast Episodehttp://msdevshow.com/2016/04/cakebuild-with-mattias-karlsson-and-gary-ewan-park/

Motz Codes Live: Continuous Integration for Libraries with Jon Dick aka Redthhttps://www.youtube.com/watch?v=D0gWjHhJ3IU

Source Codehttps://github.com/cake-build/cake

Blog PostsMoving to Cake (C# Make) Laurent Kempe http://laurentkempe.com/2016/04/05/Moving-to-Cake-CSharp-Make/

Recommended

View more >