how do I fix this, it doesn’t compile ``` tasks { ...
# gradle
x
how do I fix this, it doesn’t compile
Copy code
tasks {
    val dependsOnModules: Task.() -> Unit = {
            gradle.includedBuilds.forEach { dependsOn(it.task(":${this.name}")) }
    }
    "build" dependsOnModules
    "clean" dependsOnModules
    "wrapper" dependsOnModules
}
o
wrap the method calls with
()
i. e. "build"(dependsOnModules)
👍 1
g
What you exactly want to do? This is incorrect Kotlin syntax. Probably you just should add curly brackets and invoke this lambda:
Copy code
"build" { dependsOnModules() }
"build"(dependsOnModules) also incorrect, because signatures of method and lambda are incompatible
One more way:
Copy code
named("build").get().dependsOnModules()
Difference that it will be eager task configuration, first snippet is lazy
x
@gildor
"build"(dependsOnModules)
appears to work, I had the body of that val copied into all 3 and I was trying to deduplicate it