I'm looking into the first EAP article. And have a...
# declarative-gradle
a
I'm looking into the first EAP article. And have a bit of idea to discuss. The fact that we don't have plugins{} block in build.gradle.dcl looks great, but now I see settings.gradle.dcl has it, and actually uses for
defaults
Did the team discussed the idea to finally break this tradition of mixing plugins declaration and plugin usages and have a separate plugins.gradle.dcl (or any other appropriate name, maybe even have plugins.gradle.tml or other toml-based convention, similar to versions) separately from settings.gradle.dcs, so have a separate file to declare plugins used in the project. My main concern, that even with declarative and IDE-friendly declarations to have this strange experience, when I updated plugins block and I'm in a strange situation when
defaults{}
block doesn't work until compilation of it completed,. At least when I add/remove/update plugins it's separated from
defaults
block
Maybe even step further, and have this dependencies declaration toml integrated with dcl by default, which also works for plugins declaration
p
In any case Gradle would need to resolve the plugins before being able to provide the schema for the defaults/software-type. The fact that this could be externalized to a separate file wouldn't change much.
FWIW we did not consider externalizing the declaration of the set of plugins.
a
I agree, it indeed doesn't change it much technically, but I'm talking more from a user's mental model perspective, you change file (like import something) and expect it to work in this file It's like with dependencies and standard programming code. I do not declare dependencies on level of my code, I have a separate build file with dependencies, I press "sync" and after this I expect my code to have completion and work. I also have experience with kotlin.dsl and kotlin.main.kts (where you declare dependencies on the script level), and it always a bit frustrating, maybe just from the fact that I'm on the same file and wait when IDE will catch up with my changes I think having a bit less magic about plugins application wouldn't be too bad. Also on practice, I hope we will have support of version catalogs or similar mechanics to declare dependencies in a single place
Just trying to play with this idea, maybe I was burn too many times by plugins block and mismatch between plugins declaration, IDE and build From logical perspective, have plugins and have defaults in the same file for sure makes sense, but if I will declare plugins version one more time in another file maybe it's just too many references
p
I understand where you are coming from. Thank you for articulating your point of view. We will experiment with this and see how the IDE experience is with declarative. Our hope is that a separate file will not be needed with proper IDE support given the turnaround should be quick enough. Let's see.
šŸ™ 1
a
Thank you! Very appreciate it
j
Is it not possible to extract the settings defaults block to individual files? It can become really huge. What about picking the plugins directly from files, something like: •
my-convention-1.defaults.gradle.dcl
a
It's a good point. Often, I don't want to mix defaults for a few very different software types