Currently, any function that returns something lik...
# declarative-gradle
j
Currently, any function that returns something like provider or property cannot be assigned to a value. For CLI or environment variables this is not a problem. But I am wondering about my integration with other plugins without having to support them manually. My plugin assigns the
project.version
using a lazy property as it is currently
Any
. If the Android plugin support a
Property<String>
for the version name, I can't assign or reuse the
project.version
or expose a function that just return a lazy property to avoid using it in configuration phase. Obviously, I can support all third party plugins implementations manually in my plugin, but that would be pretty annoying/not scalable. Any workaround for this?
In the past, the user can just do
versionName = project.version
I guess this is somehow the same about this: https://github.com/gradle/gradle/issues/37727
there is no Providers support,
Provider
is marked as
HiddenInDefinition
too
p
But that's for the name/version example. I agree for the general provider use-case
j
Yep, I know about that but that wouldn't solve the fact in DCL you cannot do
prop<T> = prop<T>
, but
prop<T> =  T
, something can lead to manually support trivial assignments if you do not want to call
get()
eagerly. I think both cases should be supported as I think it is normal in a build to not have hard coded values 100% times.
I think you have another issue to register functions "globally", I mean, avoiding having to manually expose your APIs in other APIs explicitly but just point your API as a general purpose method that can be used inside of any feature.
If
providers.gradleProperty(...)
is exposed, being able to do that but in a general way, not only want Gradle wants to expose.