Cake build Flashcards
What is cake and what was it based on?
Cake is a scripting tool using C# DSL. Based in the famous make tool for unix systems (1976)
What is DSL?
Domain system language.
What is the dependency-tracking model (aka dependency-based programming)?
You tell which tasks the specific tasks depend on (instead of calling one after another).
What benefit the dependency-tracking model gives?
You can run specific jobs and the dependent jobs will be run naturally.
Why would I use Cake in a C# project? What other reason (which is actually more important) than the first one?
because you’ll be using a single language for everything. Rich ecosystem of integrations (built-in tools) - integrate with everything you need.
How to use a built-in tool? Is it difficult?
as simple as doing an using statement.
What tools integrate with cake?
see:
https://pasteboard.co/JH67c5r.png
How does cake work? which compiler does it use?
cake is a c# script which is parsed and compiled by Roslyn ON THE FLY.
Can I run regular .NET code in cake? Which namespaces are available to us by default?
yes. cake.core.dll and cake.common.dll are available by default to us.
How would we import an assembly if we did not have cake (think on powershell)? How does cake solve it?
We would need to store the dlls (and its dependencies) manually. Cake solve it by allowing referencing nuget packages (awesome).
What is a Task (Task = cake alias)? What does it execute?
meant to do one single thing (such as compile the application). Execute an anonymous function (aka lamba)
What is fluent interface?
Is when you can chain call to methods together (Task.DependsOn().Does(() =>)
Does the order of the fluent interface chaning methods matter?
Yes.. top down
What are the four basic building blocks of cake?
Task, IsDependentOn, RunTarget, Argument.
What does the WithCriteria alias do? What happens when not met?
Asserts a condition. halts and throw error if false.
Does cake allow error handling? What are the three aliases?
ContinueOnError, ReportError, OnError
How to manually halt a script?
just throw an exception.
What does the setup and teardown methods passes as parameters? When are they ran?
context and task information. Before the first task and after the last one.
How does the cake object model look like? What are the main concepts?
https://pasteboard.co/JIa6o1z.png
main concepts: Script inherits from script host (contains RunTarget, Task and other aliases), where Script encapsulates the Context object which contains environment variables and other handy stuff.
What do the information and verbose aliases do?
they log information
how to build a sln? what does it run behind the scenes?
DotNetBuild(), uses msbuild behind the scene.
Why not using directly MsBuild alias?
because DotNetBuild is multi platform (which in the past called xbuild, now i think they all call the same thing).
What does the bootstraper do?
downloads nuget and then downloads the cake packages.
What are the default arguments of the build.ps1?
FilePath, default to build.cake Target TaskName, Default to Default Configuration Name, default release Verbosity level, default verbose Experimental, allows using latest c# features DryRun do not actually execute anything Any custom argument, argument=value
Besides sending arguments to build.ps1, what are the other two options? What is the priority?
Argument > cake.config > EnvironmentVariables.
What are the versions of cake? which platforms does it run?
cake = framework / mono, Cake.CoreCLR = .NET Core
.NET CORE = DEFAULT TO USE.
What does the processor directive can do for cake? is it equal to c#?
can download tools or reference other cake scripts.
When the preprocessor directive is read?
before anything else.
What are the two most common tool directives?
tools and references to other libs.
Can I register a custom tool on cake, how’s that done?
yes, call context tools register file commands.
How to load another cake script? what’s the short version?
via preprocessor directive #load path to cake. #l
Can I load cake scripts from nuget packages?
yes, use the same load but with nuget
how to change the nuget_package source on cake?
change on config file
does cake has a FilePath type? why using it?
yes, brings convenience to deal with files.