cake-contrib / Cake.AddinDiscoverer

Tool to aid with discovering information about Cake Addins
MIT License
5 stars 6 forks source link

TargetCakeVersion not set for modules #172

Closed pascalberger closed 3 years ago

pascalberger commented 3 years ago

For modules TargetCakeVersion version is not detected. See https://github.com/cake-build/website/pull/1529#issuecomment-772853704

Jericho commented 3 years ago

This is related to what you and I discussed earlier today: the discoverer is unable to figure out the assembly to analyse because the package contains multiple assemblies and none of them follow the naming convention and none of them contain a class or method decorated with one of the Cake aliases.

The consequence is that discoverer is unable to figure out the referenced version of cake.common, unable to include to name of the assembly when generating yaml, etc. (I'm sure there are other consequences, these are the two that became apparent today).

I made a quick update today to use "*.dll" instead of a blank string when generating yaml, but as far as the targeted cake version there's not quick fix in the short term for any other missing properties (other than manually editing the generated yaml, of course).

Longer term, the ultimate solution is two fold:

  1. Discoverer should handle NuGet packages containing multiple assemblies. We should be able to analyze more than one assembly, handle situations where more than one version of cake are referenced, etc.
  2. Discoverer should look for tell tale signs that an assembly contains a module to determine if it should be analyzed. During our discussion today you brought up the idea of looking for classes that implement the ICakeModule interface which sounds like a great idea to me.
augustoproiete commented 3 years ago

Re: (2), Another option would be to read the attributes of each assembly and look for the CakeModuleAttribute. AFAIK, this is mandatory for Cake to be able to load a module, so in theory every module must have exactly one of those.

[assembly: CakeModule(typeof(UsuallyAClassThatImplementsICakeModule))]