This message was deleted.
# community-support
s
This message was deleted.
v
You do not add your plugin after the `include`s.
Just like with build scripts, the
plugins { ... }
block is extracted, and evaluated upfront.
So even if you write it down there, the plugins get applied first.
j
hummm
v
Do the renaming in a
gradle.settingsEvaluated { ... }
j
ahh great
I will check that
v
It is not really better than
afterEvaluate { ... }
in build scripts, but the chance that it leads to problems is muuuuuch much smaller
That is one version I use:
Copy code
private fun setBuildFileNames() {
    gradle.settingsEvaluated {
        rootProject.setBuildFileNameRecursively()
    }
}

private fun ProjectDescriptor.setBuildFileNameRecursively() {
    setBuildFileName()
    children.forEach {
        it.setBuildFileNameRecursively()
    }
}

private fun ProjectDescriptor.setBuildFileName() {
    buildFileName = listOf(
        "$name.gradle.kts",
        "$name.gradle",
        "build.gradle.kts",
        "build.gradle"
    ).firstOrNull {
        (projectDir / it).isFile
    } ?: "$name.gradle.kts"
}
j
thank you
👌 1