dependsOn in kotlinSourceSet (multiplatform) now t...
# gradle
a
dependsOn in kotlinSourceSet (multiplatform) now throw an error in 1.9.20-Beta:
e: commonMain can't declare dependsOn on other source sets
I've got this code:
Copy code
sourceSets {
        val commonAntlr by creating {
            dependencies {
                implementation(kotlin("stdlib"))
                // add antlr-kotlin-runtime otherwise, the generated sources will not compile
                implementation(project(":3rdparty:antlr-kotlin:antlr-kotlin-runtime"))
            }

            // you have to add the generated sources the to the kotlin compiler source directory list
            // this is not required if you use src/commonAntlr/kotlin and want to add the generated sources to version control
            kotlin.srcDir("build/generated-src/commonAntlr/kotlin")
        }

        val commonMain by getting {
            dependsOn(commonAntlr)

            kotlin.srcDir("build/generated-src/commonMain/kotlin")

            dependencies {
                ....
            }
        }
    }
How to migrate this?
👀 1
m
Put everything in
commonMain
?
Copy code
sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(kotlin("stdlib"))
                // add antlr-kotlin-runtime otherwise, the generated sources will not compile
                implementation(project(":3rdparty:antlr-kotlin:antlr-kotlin-runtime"))
            }

            // you have to add the generated sources the to the kotlin compiler source directory list
            // this is not required if you use src/commonAntlr/kotlin and want to add the generated sources to version control
            kotlin.srcDir("build/generated-src/commonAntlr/kotlin")
        }
}
2
👌 1
t
Related YT-issue - error is only produced for
common
source set
1
thank you color 1
👍 1
a
It actually works; I had done this before, but I forgot to make the change
Copy code
kotlin.srcDir("build/generated-src/commonMain/kotlin")
with
Copy code
kotlin.srcDir("build/generated-src/commonAntlr/kotlin")
Thank you!