i guess there is no way to change `versionFor` to...
# refreshversions
n
i guess there is no way to change
versionFor
to add
Project
as a receiver in groovy code without changes to usages ? or some way to extract which buildscript the call came from with reflection ?
l
Wait, there's a way to have receiver syntax in Groovy DSL?
Regardless, we can do a lot of magic as a settings plugin, including automatically migrating.
n
well this is code that would be in your
build.gradle
file
1
but honestly.. maybe just marking the old function as
@Deprecated
wit ha proper
ReplaceWith
might be enough
not sure how good the IDE integration is for groovy code.. i only know it never worked for me
l
Wait, there's a way to have receiver syntax in Groovy DSL?
n
aparently there is such a language feature in groovy.. but not sure if we have access to it..
l
I think it only works within classes.
n
https://dzone.com/articles/groovy-goodness-adding-extra
An extension module is a JAR file with classes that provide extra methods to existing other classes like in the JDK or third-party libraries. Groovy uses this mechanism to add for example extra methods to the
File
class.
so.. if we set this up right.. maybe we can provide
versionFor
extensions on
Project
seems like it needs a service entry in META-INF for discovery
l
Far from high priority for refreshVersions, but if you want and think you can make it work without drawbacks, feel free to send a PR.
n
i am only considering this because it would not break existing
0.10.0
groovy buildscripts
but .. all of that might not work on gradle buildscripts anyways..