This message was deleted.
# community-support
s
This message was deleted.
m
If you're using Kotlin you can always add extension functions:
Copy code
fun RepositoryHandler.myAwesomeRepo()
d
You're right, but what to do if i'm not using Kotlin at this moment? With
DependencyHandler
I can create some useful wrappers even to be used in Groovy, but not with
RepositoryHandler
. Also, extension functions can't be scoped per-module, as Gradle Extensions allow you to do.
v
The least classes formally are
ExtensionAware
but actually practically all domain objects and also all other objects created by Gradle with means like
objects.newInstance
or
container.register
or
container.create
or similar are on-the-fly decorated to be
ExtensionAware
.
You just have to cast most things to
ExtensionAware
to use the interface methods.
You will not get type-safe accessors for usage in Kotlin DSL for some of them. But for
RepositoryHandler
you indeed should get them by now.
Since Gradle 7.4 that is
d
Oh, that's nice! Yes, this is what I see when debug build file, did you consider making ExtensionAware as part of public API for this particular class?
v
I don't consider anything, I'm just a user like you. I'm not even a Gradle Fellow or in any way affiliated to Gradle.
But as far as I know, it is pretty awkward to formally make a class
ExtensionAware
which is the cause most are not
d
Oh, sorry, my mistake. I think casting is the way to go for now. Thank you for your support!
👌 1
v
But here you can find a discussion about the very topic: https://github.com/gradle/gradle/issues/7547