conventionMapping is an internal API that are used in a number of plugins. IIRC someone mentioned that conventionMapping are deprecated. Also I believe in the same context it was said that plugin authors should rather use extension objects,
Thus some questions:
What is the roadmap to conventionMapping? Deprecated or going public?
What is the recommendation we should give to plugin authors to use instead (if it is deprecated)?
Are there use-cases where afterEvaluate could be a viable alternative?
Technically since it’s internal we would probably not deprecate it, rather we would likely remove it or replace it with something else. That said, there are currently no plans to do either since it’s used extensively in Gradle core.
There’s really not a good alternative. Model rules would be the recommended approach going forward but there is still a bit to do before many plugins can migrate.
Using afterEvaluate is typically a viable alternative in most every use case. That said, it’s not quite as good as convention mappings because technically further configuration could still be done in a subsequent afterEvaluate closure or worse, by a task at execution time. Convention mappings are evaluated when read (typically in the task action) so they are more likely to be correct.
In summary, feel free to use convention mappings (despite it being an internal feature). It’s not going anywhere anytime soon and is in many cases the best option for plugin authors.