sdeleuze
05/25/2018, 10:46 AMval shadowJar by tasks.getting(ShadowJar::class) { ... }
to exclude files with the shadow plugin instead of using shadow { ... }
which provides a useless ShadowExtension
lambda? Is the shadow plugin badly designed ? I see this kind of issue in various plugins so I would like to know what is the rationale behind this and understand that kind of issue and at what level this should be fixed ...jlleitschuh
05/25/2018, 3:32 PMextension
is usually considered the wa that you configure the entire plugin. The configuration that you put on the extension
can cause the plugin to create various different tasks that are outside the scope of what any normal user would need to configure.
Additionally, things configured on an extension might do things like cause multiple tasks to be created depending upon how it's configured.
The configuration of the tasks with code like:
tasks.withType<ShadowJar> {
// Some config here
}
It's more about configuring the logic specific to one part of a plugin's task execution.
@eriwen any interest in chiming in here to add any additional information and/or a link to a Gradle doc that explains the differences better than I can?eriwen
05/25/2018, 3:42 PMval shadowJar by tasks.getting(ShadowJar::class)
is not intuitive? Jonathan has suggested an alternative that should work well.
That said, I’m sure John Engelman has a good reason for having folks configure ShadowJar tasks instead of using an extension.Czar
05/25/2018, 3:49 PMval shadowJar by...
approach will only configure task named "shadowJar". This may matter in multi-module projects.tasks {
val shadowJar: ShadowJar by getting
shadowJar {
// your config
}
}
Or if you do not want to have tasks {}
block: val shadowJar: ShadowJar by tasks.getting {
// your config
}
sdeleuze
05/28/2018, 11:56 AMshadow { ... }
like in Groovy ?shadow { .. }
is what they are going to use.gildor
05/31/2018, 11:21 AMsdeleuze
05/31/2018, 12:39 PMshadowJar { }
like in Groovygildor
05/31/2018, 1:52 PMOr do they have to copy these properties to the extension and get the tasks retrieve these properties ?Yes, this is possible, you can use extensions config as default values for task config. As I remember the latest versions of Gradle even have some API to reduce boilerplate in this case
sdeleuze
05/31/2018, 2:37 PM