Templates icon indicating copy to clipboard operation
Templates copied to clipboard

Update build scripts in Templates to leverage the Cake.MinVer add-in for Cake

Open augustoproiete opened this issue 3 years ago • 5 comments

@RehanSaeed As per our conversation over email. Took me a little while to get to this one but here it is :smile:

augustoproiete avatar Dec 03 '20 10:12 augustoproiete

ps: I see a couple of builds failed but doesn't seem to be related to the contents of the PR.

augustoproiete avatar Dec 03 '20 11:12 augustoproiete

@RehanSaeed I'm obviously biased of course :upside_down_face:, but I would argue that given that you decided to use Cake to orchestrate the build of the templates, leveraging Cake plugins is the logical next step and one of the things that makes Cake such a great tool, and that the plugin definitely makes the build script simpler.

I hear you re: breaking changes, and as with any dependency that can happen. I use Cake.MinVer myself on several projects so you can expect it to be kept up-to-date with new Cake versions.

The Cake website now shows you which Cake versions an add-in is compatible with, so that is something you can check before updating Cake, to make sure any plugins you use are compatible with the new version (and, of course, update the plugins to the latest version as well).

image

https://cakebuild.net/extensions/cake-minver/

Lastly, the Cake plugin now belongs to the Cake Contrib organization and the core team can make new releases, if I get hit by a bus or something :smiley: so there's a good chance it won't be abandoned.

augustoproiete avatar Dec 03 '20 11:12 augustoproiete

@RehanSaeed @augustoproiete

I like it. +1 for Cake MinVer Plugin.

  • Lastly, the Cake plugin now belongs to the Cake Contrib organization and the core team can make new releases, if I get hit by a bus or something 😃 so there's a good chance it won't be abandoned.

    • This is really good to know, and will help a lot with cake versions breaking. If they/you ship the CLI tool and the Cake CLI, and the Cake MinVer plugin all at the same time, it will be pretty unlikely we see breaking changes.
  • I've used the Cake.Docker plugin before and had my CI build fail because a new version of Cake made breaking changes which broke the plugin.

    • Luckily this is super easy to fix and its all self contained within the cake script, we could just throw in SimpleExec and be done.
  • leveraging Cake plugins is the logical next step and one of the things that makes Cake such a great tool

    • Totally agree. Cake will resolve the nuget package at runtime which replaces dotnet tool restore.

Currently we can run MinVer without invoking cake, but cake allows running a specific task so this should not be an issue right? Do we even care to do that?

VictorioBerra avatar Jan 04 '21 18:01 VictorioBerra

Cheers @VictorioBerra

Currently we can run MinVer without invoking cake, but cake allows running a specific task so this should not be an issue right?

Cake.MinVer effectively runs the minver-cli from anywhere it can find (Cake tools path, dotnet local tool, dotnet global tool, custom path, ...) and parses its content to make it available to the Cake build, so you don't "need" to abandon your current approach of installing the local tool + dotnet tool restore in order to use Cake.MinVer - unless you want to.

This PR assumes that you want to continue with using minver as a local tool + dotnet tool restore, and only replaces the execution and parsing of MinVer from within the Cake scripts that do that, to leverage Cake.MinVer.

If you do decide to go the route of using Cake to install the minver-cli nuget package instead, then yes you could create a target inside the Cake script that you can run to execute MinVer exclusively.

augustoproiete avatar Jan 04 '21 19:01 augustoproiete

I see, I like leaving the process execution, argument passing, output wrangling to a cake addon vs baking it into our cake file. Even though we have a minimal approach.

VictorioBerra avatar Jan 04 '21 19:01 VictorioBerra