Could not find method srcDirs() for arguments on SourceSet container of type org.gradle.api.internal.tasks.DefaultSourceSetContainer
Asked Answered
C

1

0

I'm trying to compile my Kotlin app and set of Kotlin libraries to JavaScript. I've got that working well, but when I try to run it, it can't find kotlin.js. To remedy this, I tried changing my build.gradle to be more like this example on GitHub.

In mine, I defined source sets like this: (which works but doesn't output kotlin.js)

sourceSets {
    main {
        kotlin {
            srcDirs 'src/main/kotlin'
        }
    }
}

to something like this: (which doesn't even sync)

sourceSets {
    main.kotlin.srcDirs += "src/main/kotlin"
}

which gives me this error:

Could not find method srcDirs() for arguments [lib/Blue-Base/src/main/kotlin] on SourceSet container of type org.gradle.api.internal.tasks.DefaultSourceSetContainer.

How do I resolve this error? I know one issue is I don't quite grok Groovy/Gradle, but I feel like what I did should at least sync...


Here's a link to the code and project in question: https://github.com/BlueHuskyStudios/Decision-Cruncher/blob/SO/53576840/build.gradle

Curtsey answered 2/12, 2018 at 2:36 Comment(0)
A
-1

Looks like you have written srcDirs instead of main.kotlin.srcDirs.

Askja answered 12/12, 2018 at 17:24 Comment(2)
Where? inside main { kotlin {? I think it's implied in there. When I flatten it, I write it out...Curtsey
My suggestion is to replace srcDirs with main.kotlin.srcDirs += here github.com/BlueHuskyStudios/Decision-Cruncher/blob/… and other.Askja

© 2022 - 2024 — McMap. All rights reserved.