Having your Cake, and eating it too!
Gary Ewan Park
Email: gep13@gep13.co.uk
Twitter: @gep13
Web: http://www.gep13.co.uk
What is Cake?
A Definition…
“Cake (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.”
Reference
 http://cakebuild.net/
Okay, but why do I need it?
What are the main philosophies of Cake?
• Non intrusive
• It should “just” work
• Be highly configurable
• Replace the parts that you don’t like
• Easy to implement your own tools
• No tools should be checked into your repository
• Should behave the same way regardless of
• Operating System
• Environment
As an example…
Can’t I just use… MAKEFAKECMakeMSBuildNAntPsakeBau
Example Cake Script
Typical Build Workflow
Clean
Build
Unit Tests
(NUnit, xUnit,
MSTest)
Test Coverage
StyleCop FxCop
DupFinder InspectCode
Package Publish
Package Restore
Let’s bake some Cake!
Clean
Build
Unit Tests
(NUnit, xUnit,
MSTest)
Test Coverage
StyleCop FxCop
DupFinder InspectCode
Package Publish
Package Restore
Demo 1
NuGet Package Restore
Progress Check
Clean
Build
Unit Tests
(NUnit, xUnit,
MSTest)
Test Coverage
StyleCop FxCop
DupFinder InspectCode
Package Publish
Package Restore
Demo 2
Build the Solution
Progress Check
Clean
Build
Unit Tests
(NUnit, xUnit,
MSTest)
Test Coverage
StyleCop FxCop
DupFinder InspectCode
Package Publish
Package Restore
Demo 3
Unit Tests
Progress Check
Clean
Build
Unit Tests
(NUnit, xUnit,
MSTest)
Test Coverage
StyleCop FxCop
DupFinder InspectCode
Package Publish
Package Restore
Demo 4
Test Coverage
Progress Check
Clean
Build
Unit Tests
(NUnit, xUnit,
MSTest)
Test Coverage
StyleCop FxCop
DupFinder InspectCode
Package Publish
Package Restore
Demo 5
NuGet Pack
Progress Check
Clean
Build
Unit Tests
(NUnit, xUnit,
MSTest)
Test Coverage
StyleCop FxCop
DupFinder InspectCode
Package Publish
Package Restore
Questions?
Feel free to get in touch
Email: gep13@gep13.co.uk
Twitter: @gep13
Web: http://www.gep13.co.uk
Resources
• Cake Documentation
o http://cakebuild.net/docs
• MS Dev Show Podcast Episode
o http://msdevshow.com/2016/04/cakebuild-with-mattias-karlsson-and-gary-ewan-park/
• Motz Codes Live: Continuous Integration for Libraries with Jon Dick aka Redth
o https://www.youtube.com/watch?v=D0gWjHhJ3IU
• Source Code
o https://github.com/cake-build/cake
• Blog Posts
o Moving to Cake (C# Make) – Laurent Kempe
http://laurentkempe.com/2016/04/05/Moving-to-Cake-CSharp-Make/

Having your cake, and eating it too!

Editor's Notes

  • #2 Full disclosure, I am one of three maintainers of the Cake project on GitHub
  • #4 Sorry, but we are not here to talk about Cake of the edible form…
  • #5 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 addins
  • #6 Built using Roslyn, and the Mono Compiler, allowing execution on both Windows, OS X and Linux Script Processing to make sure things work the same on both
  • #7 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 increases
  • #10 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.
  • #11 Notice, how it is just C# We have a top level set of input arguments We setup some top level arguments that will be used in the rest of the script We start to define the Tasks that will make up the script
  • #12 - Directed acyclic graph