Slackbot
01/09/2024, 8:58 PMChris Lee
01/09/2024, 9:00 PMpluginManagement is processed separately, it doesn’t see the rest of the script.Arimil
01/09/2024, 9:06 PMArimil
01/09/2024, 9:07 PMVampire
01/09/2024, 10:10 PMArimil
01/09/2024, 10:16 PMVampire
01/09/2024, 10:26 PMpluginManagement { ... } it would only be usable in there, so why not right away doing the logic in there directly? What do you need the enum for?Arimil
01/10/2024, 1:23 AMVampire
01/10/2024, 1:30 AMrepositories { ... } block in a settings script.Vampire
01/10/2024, 1:32 AMdependencyResolutionManagement { repositories { ... } },
yeah, well, that's probably your only solution.
As was said, the pluginManagement { ... } block is special and needs to be self-contained, and the Kotlin language does not allow you to have an enum in there.
But at least you can avoid repeating by also configuring the dRM repos inside the pM block like:
// the plugin management block is evaluated first separately, do not change this to
// listOf(pluginManagement.repositories, dependencyResolutionManagement.repositories)
// instead that would change the semantics
pluginManagement {
listOf(repositories, dependencyResolutionManagement.repositories).forEach { repositories ->
repositories.apply {
// configuration here
}
}
}Caleb Cushing
01/10/2024, 2:17 PMChris Lee
01/10/2024, 2:45 PMpluginManagement and plugins are special, due to lifecycle requirements - they need to be processed separately to determine the classpath, such that the rest of the script can be compiled. https://docs.gradle.org/8.0.2/userguide/plugins.html#sec:constrained_syntaxCaleb Cushing
01/10/2024, 2:55 PMChris Lee
01/10/2024, 2:57 PM