Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule to suggest using a global variable for supported cake version #79

Open
AdmiringWorm opened this issue Feb 15, 2021 · 5 comments

Comments

@AdmiringWorm
Copy link
Member

I would like to suggest to add a new rule suggestion (not a warning) to recommend users to use a global variable with the version of cake being targeted/supported.

This variable could then be re-used in the documentation, and for the PackageReference to Cake.Core.

As an example, see my commit here: cake-contrib/Cake.Transifex@31ded53

If it gets added, it may be something that needs to be done in conjunction with the project @Jericho is working on/maintaining.

@pascalberger
Copy link
Member

We need to be careful. If we make a suggestion for guidelines for Cake-Contrib addins, this won't be something which we can use for documentation, as there are a lot of addins which are not part of cake-contrib. But detection of target Cake version is something which we already have implemented in addin discoverer and website (through reference).

@AdmiringWorm
Copy link
Member Author

We need to be careful. If we make a suggestion for guidelines for Cake-Contrib addins, this won't be something which we can use for documentation, as there are a lot of addins which are not part of cake-contrib.

I understand. I am not suggestion it should be part of the guidelines itself though, but more of an informational suggestion to the addin developer, especially if the cake version is used in several places (like in the PackageReference and the description).
So more like a helpful information, than an actual warning.

But detection of target Cake version is something which we already have implemented in addin discoverer and website (through reference).

Correct me if I am wrong, but I believe the addin discoverer detects the Cake version by directly parsing the csproj file, so if a variable is being used it may not detect the correct version specified (I do not know about the website though).

@Jericho
Copy link
Member

Jericho commented Feb 15, 2021

Correct me if I am wrong, but I believe the addin discoverer detects the Cake version by directly parsing the csproj file, so if a variable is being used it may not detect the correct version specified (I do not know about the website though).

There was a time when the addin discoverer indeed parsed .csproj to detect the referenced version of Cake.Core and Cake.Common but it's no longer the case (the logic changed some time during the summer of 2018 if I remember correctly).

The currently logic is to use reflection on the addin assembly and inspect the referenced assemblies.

@augustoproiete
Copy link
Member

@AdmiringWorm The issue with having a specific version hard-coded inside of the addin is that it doesn't age well when new versions of Cake are released. For example, your Cake.Transifex addin referencing Cake.Core v1.0.0 is likely to be compatible with a future Cake v1.8.6 without having to do a new release to target the newer API unless you need to.

On the website we already handle compatibility ranges for you based on the Cake reference that your addin has and we show it to the user - and this is updated as Cake versions are released.

image

@nils-a
Copy link
Contributor

nils-a commented Feb 15, 2021

While I can certainly test for the existence of such a variable, I'm not sure I could detect it's usage (not easily, anyways..)
What I certainly could try is to check whether Cake.Core and Cake.Common (probably Cake.Testing, too) are referenced in the same version. Would that help?

nils-a added a commit to nils-a/CakeContrib.Guidelines that referenced this issue Mar 19, 2021
for cake.core, cake.common and cake.testing
nils-a added a commit that referenced this issue Mar 19, 2021
(GH-79) suggest using the same cake versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants