File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
plugins/dependencies/src/main/kotlin/de/fayard/refreshVersions Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import org.gradle.api.DefaultTask
1010import org.gradle.api.Plugin
1111import org.gradle.api.Project
1212import org.gradle.api.initialization.Settings
13+ import org.gradle.api.invocation.Gradle
1314import org.gradle.kotlin.dsl.*
1415
1516open class RefreshVersionsPlugin : Plugin <Any > {
@@ -32,15 +33,21 @@ open class RefreshVersionsPlugin : Plugin<Any> {
3233
3334
3435 override fun apply (target : Any ) {
35- when (target) {
36- is Settings -> bootstrap(target)
37- is Project -> error(
38- """
39- Gradle plugins.id("de.fayard.refreshVersions") must be configured in settings.gradle(.kts), not in build.gradle(.kts)
40- See https://jmfayard.github.io/refreshVersions/setup/
41- """ .trimIndent()
42- )
36+ require(target is Settings ) {
37+ val notInExtraClause: String = when (target) {
38+ is Project -> when (target) {
39+ target.rootProject -> " , not in build.gradle(.kts)"
40+ else -> " , not in a build.gradle(.kts) file."
41+ }
42+ is Gradle -> " , not in an initialization script."
43+ else -> " "
44+ }
45+ """
46+ plugins.id("de.fayard.refreshVersions") must be configured in settings.gradle(.kts)$notInExtraClause .
47+ See https://jmfayard.github.io/refreshVersions/setup/
48+ """ .trimIndent()
4349 }
50+ bootstrap(target)
4451 }
4552
4653 private fun bootstrap (settings : Settings ) {
You can’t perform that action at this time.
0 commit comments