How to Prepare Cake Using Only Frosting

So Cake . Many have heard, many wanted to try, but put it off. Of course, if you've been working for TeamCity or Jenkins all the time and keep doing it , then why reinvent something that already works great? Love your life and be happy. But, let's say, a new project has appeared in your beloved life, a new deadline, at least storypoints before release, but you have no experience with a new collector? In this case, Cake came in handy for me .





I'll make a reservation right away that this article will not immediately push you to use Cake , like me, and many of my colleagues were not pushed by articles that came out earlier. Mostly because it doesn't make sense to switch to it on a project that doesn't hurt and that works consistently. Collect in your favorite Jenkins and everything goes fine. But after this article, let it rest in my head that Cake exists. Once again, he has not gone anywhere, he already knows a lot and it is getting easier to work with him. Much easier than it used to be.





What is Cake like? Probably, any developer who is not mired in the .Net world will find his analogy: gradle, gulp, golang make . Make systems are not a revelation in 2020. It has always been convenient, which means it is necessary and correct. The .Net world has long been deprived of such means. In fact, there was and still is MSBuild , but it has a lot of shortcomings. The main one is who even knows how to use it from ordinary developers? And what is the expediency of its development? Some basic and necessary things for everyone are clearly easier to do on the build server. Probably, it is convenient for someone, but I am sure that a significant part of the community will prefer MSBuild to master the new build server. Write a config once and forget it like a bad dream.





But what if there was a make system with a DSL in C #, autocomplete and other features of a typed language? Yes, I'm talking about Cake . In particular, now we will talk about the Cake.Frosting library , which is one of the runners of the make-system.





You can read more about the available runners here: Cake Runners





With Frosting, everything is familiar - the self-documenting Api with which you almost immediately find a common language. Extension methods loaded from Nuget - for every occasion, a project structure like a mixture of tests or benchmarks and an Asp host . All decisions are guessed at once, everything is at home.





Frosting Cake , , , solution . . , Cake.Frosting, Build- .





dotnet run
      
      



, . - Mac OS, Linux Windows, SDK, . dotnet CLI, .





: Frosting Bootstraping





, , . โ€” Lifetime: Setup TearDown. .





โ€” Tasks. - FrostingTask<Context>.





IoC , Asp. , Frosting DI IServiceCollection, .





- . , Default. , , ,





[Dependency(typeof(MyPreviousTask))]
      
      



MyPreviousTask โ€” , .







, :





  1. .





  2. .





  3. unit-.





  4. Publish.





  5. .





, docker, โ€” , C#.





, , , , . , , . .





โ€” IntelliSense , ?





.Net core โ€“ self-contained . , , dotnet, , , , ยซ ยป. , - . Cake.





, , TS Jenkins





dotnet run ./Build/Build.csproj
      
      



( ) , . Frosting , -, .





, . - dotnet Frosting. , โ€” .





โ€” .









  1. . / -;





  2. . -. -.





  3. . . .





  4. . - -, , . .





  5. . IntelliSense, , senior.





The problem can be the lack of necessary integrations in Cake with linters, sonars, etc. This issue should be clarified before using the system. Or add your extensions, upload to Nuget and be a very, very good person.





Bonus - an example of using Cake.Frosting on github . For the "seed" so to speak: Link





Link to the Cake project website








All Articles