This message was deleted.
# plugin-development
s
This message was deleted.
e
afaik those blocks run outside of buildscript classpath, but if you're making a custom distribution anyway, you could update the core Gradle classes
e
How do you mean update the core gradle classes? šŸ¤”
t
Without updating the core classes (i.e. actually patching the gradle-core-api.jar/gradle-core.jar), wouldn't it be possible to put the JAR in a place such that it will be added to the classpath without the need for your init script? (and hopefully they'll work for the kotlin dsl plugins/pluginManagement specific compilations)
e
Hmmm, thats an interesting pov. I have no idea actually.
I can try putting them in
lib
folder of the dist. I’ll report if that works but I doubt it.
Didnt work šŸ˜ž
Gradle looks for jars in that folder based on some predefined modules (and their dependencies)
e
if you're building your own Gradle distribution anyway, it shouldn't be much more work to build your own custom Gradle entirely
e
Its definietely a lot more work to build custom gradle šŸ˜…. The custom gradle distro is light work really.
I’m just surprised that even using ā€œ_publicly internalā€_ APIs there is no supported ā€œhookā€ into the system to add custom API.
t
How about adding your classes to, e.g. gradle-kotlin-dsl-XX.jar?
e
it's a little tricky since you also have to merge the
.kotlin_module
metadata to make extensions usable
e
If I could figure out a way to change the contents of one of the jars then it’d be better to just update the /gradle-plugins.properties. Those are auto added to the classpath (looks like its supposed to be built in gradle plugins etc)
e
you can do that by modifying the gradle source code and building it
e
I know but thats not what I want and its a much bigger commitment than just downloading and adding a few files.
e
distribution-wise it ends up being the same as a custom distribution, and building gradle is simple and relatively fast (remote caches are set up)
e
Its just unfortunate that ā€œadding a few filesā€ is not sufficient to include custom DSL that will target pluginManagement blocks (its more than sufficient for DSL in general, just the plugin management use case thats sad)
e
special blocks are special… and becoming more so, https://docs.gradle.org/current/userguide/plugins.html#sec:constrained_syntax
e
Yeah I know, hence why I asked here in the first place hoping someone knew ā€œsome type of wayā€. Its a niche use case, but since its the recommended way of adding plugins, I still want a way to support it.
e
your initial question is fairly similar to the request https://github.com/gradle/gradle/issues/26212
e
Ah yeah, exactly that! It started out trying to add in an init script just like the issue but looking at the source, I see it wont work. Now I’m looking more into how I can include the extensions in the parent/root classpath instead (which I believe is used to actually compile those blocks). Looks like I have one final option šŸ˜ž . I really wish there was an easier, supported, way. tbh,