This message was deleted.
# plugin-development
s
This message was deleted.
j
If I understand correctly, I think using
addProvider()
instead of
add()
can help you. Then you can determine the version lazily (i.e. late) in the configuration phase. @melix wrote a detailed post about this topic: https://melix.github.io/blog/2022/03/gradle-conditional-dependencies.html
👀 1
m
hmmm I read the article, played a bit with
addProvider
/
Copy code
add("kspCommonMainMetadata", provider { "com.example:${version}" })
etc, but I don't think that's the problem. When this gradle plugin is used in a project, things like
version
,
project.ersion
/
rootProject.version
don't apply to the plugin, but rather to the project that applies it. Is there anything that holds the plugin version?
j
Sorry, I misunderstood what you are trying to achieve.
m
the article you sent was very interesting anyway. gave me some insight, but tbh I still can't figure out the "lifecycle" of gradle plugin, e.g. tried using the Providers for resolving extension parameters but eventually I end up using afterEvaluate every time đŸ€·
j
Yes it can be challenging, in particular because the Provider/Property API is not yet used consistently in many plugins and Gradle itself. 😐 Usually it is possible to do for almost all thing by now (I think) but I can understand that it is frustrating if it is too hard to figure out and you then use
afterEvaluate
because it is just more straight forward to use for some cases.
🎯 1