project isolation issue: Is `settings.gradle.allp...
# configuration-cache
j
project isolation issue: Is
settings.gradle.allprojects
(and all APIs like it) incompatible with project isolation? I was thinking it was a valid API 🤔
The code is only registering a task on each project, nothing special
v
settings.gradle.lifecycle.beforeProject { ... }
?
j
I am gonna try that, currently on 8.7 so I was not having access to those APIs
Is there a way to write this in a project isolation compatible way?
Copy code
private fun Settings.configureKoverMergeReports() {
    gradle.allprojects { allprojects ->
        val rootProject: Project = allprojects.rootProject
        rootProject.pluginManager.withPlugin(JetbrainsKotlinxKover.id) {
            allprojects.pluginManager.withPlugin(JetbrainsKotlinxKover.id) {
                rootProject.dependencies { "kover"(project(allprojects.path)) }
            }
        }
    }
}
I was thinking something like
Copy code
private fun Settings.configureKoverMergeReports() {
    val rootProject: Project = gradle.rootProject
    gradle.lifecycle.beforeProject { project ->
        rootProject.pluginManager.withPlugin(JetbrainsKotlinxKover.id) {
            project.pluginManager.withPlugin(JetbrainsKotlinxKover.id) {
                rootProject.dependencies { "kover"(project(project.path)) }
            }
        }
    }
}
But it is looking really weird to me calling
rootProject
inside
beforeProject
lambda.