Open pascalberger opened 1 year ago
The Cake 3.0 dependency was added in https://github.com/dotnet/Nerdbank.GitVersioning/pull/867, reported as a problem in https://github.com/dotnet/Nerdbank.GitVersioning/issues/934, and reverted in https://github.com/dotnet/Nerdbank.GitVersioning/pull/938.
Earlier, the Cake dependency had been upgraded from 0.33 to 1.1 in https://github.com/dotnet/Nerdbank.GitVersioning/pull/575, to 2.2 in https://github.com/dotnet/Nerdbank.GitVersioning/pull/770, and to 2.3 in https://github.com/dotnet/Nerdbank.GitVersioning/pull/850. I don't know if anyone requested 2.0 before.
From a Cake perspective, if you want to support Cake 2.x best practice is to reference Cake 2.0. Expect you require some specific features only available in 2.x versions. See also Best practices for writing addins. If you reference specific Cake 2.x versions (e.g. 2.2) it might result in errors for people running earlier versions of Cake.
Please also note that Cake 3.0 is a breaking change compared to 2.x. If you reference Cake 2.x in your addin, there's no guarantee that it will work on Cake 3.0. You need to decide which version you want to support.
The source code in src/Cake.GitVersioning/ uses very little Cake API. The GitVersioningAliases class is decorated with CakeAliasCategoryAttribute, and its two methods are decorated with CakeMethodAliasAttribute and take an ICakeContext parameter; but they do not use the parameter. If these are now working OK in Cake 2.0 and 3.0, then I expect they won't break in future Cake 3.x versions.
Security Policy says Cake 2.x.x is supported. Does that mean all 2.x.x versions, or only the latest 2.x.x version? I mean, if it's only the latest, then users shouldn't run versions lower than 2.3.0, and that makes it less important to downgrade the dependency to 2.0.0.
Which releases has nothing todo with what version an addin is compatible with. Cake 3.0 is a breaking release. It's up to you what version of Cake you want to reference. And of course you can reference Cake 2.3, but I don't see the advantage in it, compared to reference Cake 2.0. Are there issues with referencing Cake 2.3, compared to 2.0? Maybe, maybe not.
@pascalberger We reference 2.x as @KalleOlaviNiemitalo said. Consider that our soft decision.
I don't use Cake myself. Cake support in this repo was added by a volunteer and no one has really maintained it. Dependabot suggests update which I tend to accept for Cake since I am not familiar with it. So as to the question of whether we want to support cake v2 or v3, I guess that should depend on the user count across those two versions. NB.GV should probably target whatever version of Cake will help the most users.
Version 3.6.133 of Cake.GitVersioning seems to be build against Cake 2.3, while version 3.6.128 was build against Cake 3.0 (see https://github.com/cake-build/website/pull/2629). Was there a specific reason for this?
Please note that it is recommended to build against the lowest API compatible version as long as no specific features are required (which would be 2.0 & 3.0).