conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.96k stars 952 forks source link

Experiment with a way to constrain options in `config_options` #16570

Open AbrilRBS opened 6 days ago

AbrilRBS commented 6 days ago

Changelog: TODO Docs: TODO

Very early draft, some issues still remain, experimental and ee may not wanto to go this route, but wanted to push it to have something to show the team.

The most useful use-case for this would be something similar to this CCI recipe PR, in which old versions deprecate option values in favour of new ones (As their value is directly passed to the build system)

The current solution goes the validate() route, which although it lets the recipe present nicer errors to the users, it could quickly grow unmanageable after a few changes like that.

There might be an alternative approach: The init method might run early enough to be able to redefine the self.options dict-like value before it gets converted to a _PackageOptions object