Slackbot
07/27/2022, 10:08 PMJavi
07/27/2022, 10:53 PMgrossws
07/27/2022, 10:53 PMtasks.names.filter { .. }) and then use tasks.withType<AbstractPublishToMaven>().configureEach { dependsOn(signTaskList) }grossws
07/27/2022, 10:55 PMgrossws
07/27/2022, 10:56 PMJavi
07/27/2022, 10:56 PMpublic inline fun <reified T : Task> TaskContainer.namedLazily(
name: String,
action: Action<in T>? = null,
): TaskCollection<T> {
val collection: TaskCollection<T> = withType<T>().matching { it.name == name }
if (action != null) collection.configureEach(action)
return collection
}Javi
07/27/2022, 10:56 PMEli Graber
07/27/2022, 10:59 PMgrossws
07/27/2022, 11:00 PMmatching? I surely hope not but am not sure about it.Javi
07/27/2022, 11:00 PMJavi
07/27/2022, 11:01 PMEli Graber
07/27/2022, 11:02 PMval signingTasks = tasks.withType<Sign>()
tasks.withType<AbstractPublishToMaven>().configureEach {
dependsOn(signingTasks)
}
which at least doesn't have any errors with a dry run. Now to actually test it.grossws
07/27/2022, 11:03 PMpublish(PublicationName)To(RepositoryName)RepositoryJavi
07/27/2022, 11:03 PMEli Graber
07/27/2022, 11:04 PMJavi
07/27/2022, 11:04 PMgrossws
07/27/2022, 11:10 PMtasks.withType<T>().matching { .. } would only realize tasks of type T as expected.Eli Graber
07/28/2022, 1:50 AMval signingTasks = tasks.withType<Sign>()
tasks.withType<AbstractPublishToMaven>().configureEach {
dependsOn(signingTasks)
}
did the trick 😄Vampire
07/28/2022, 7:04 AMVampire
07/28/2022, 7:06 AMif in the configuration block if you don't need the actual collection, but want to configure depending on name. :-)