conan-io / examples

Conan 1.x examples
MIT License
124 stars 66 forks source link

Create a set of common-use templates as python_requires #15

Open Minimonium opened 5 years ago

Minimonium commented 5 years ago

We have a nice feature to provide templated recipes: https://docs.conan.io/en/latest/extending/python_requires.html#python-requires

It would ease the bootstrapping experience for users if we would have a set of common-use templates (cmake_template, b2_template, msbuild_template, etc) in the default remote.

memsharded commented 5 years ago

Maybe using the new conan new --file=xxxx functionality? It is in develop branch, to be released in Conan 1.16

Minimonium commented 5 years ago

That's quite a handy thing! In my case, I thought about a more dynamic approach. The idea is to allow users create, share and use base recipes with some field of versioning and such. The template feature conan new --file=xxx seems to allow to generate recipes, without any field to update previously generated ones, while python_requires would allow injecting additional functionality depending on the version of their base class provider which is a quite different use case.

jgsogo commented 5 years ago

Right now python_requires is an experimental feature and probably it is not a good idea to add more functionalities on top of it, that's also the reason why we are not accepting recipes using python_requires into conan-center... I agree with you that the python_requires approach and the template one doesn't have the same objective, and I also agree that it could be very useful to have some standard recipes for header-only libraries, tools or c-libraries,...

This is something we have already talked about (not sure if there is an issue in the Conan repo) and there are other options on the table like having a hierarchy of abstract classes inheriting from ConanFile or even having some kind of special options that translates to some predefined implementations under the hood... but all these approaches are just ideas to look into it.

Minimonium commented 5 years ago

Thanks for the info! I see. It's indeed shaky because the feature is experimental. There are interesting use-cases like this one: https://gitlab.com/grisumbras/conan-b2-helper