https://kotlinlang.org logo
#getting-started
Title
# getting-started
r

Ray Rahke

03/13/2024, 2:04 AM
Still stuck trying to do the simple task of making gradle expect tests in /test/* instead of /src/test/kotlin/* one guide gives this as an example
Copy code
sourceSets{
    footest {
        java {
            srcDirs("src/footest")
        }
    }
}
...what? I can't make sense of this so we are saying footest is a new sourceSet... which I guess we can just do for arbitrary names? and then saying that java is a sub source set? Or is it instead setting a configuration value java behavior, and so it must be a special keyword here and not something I can just invent? this is all so implicit and requires already knowing everything to get what is going on.
j

Joffrey

03/13/2024, 6:57 AM
This uses the groovy DSL, and indeed Gradle relies on this weird (horrible) Groovy feature to have user-defined strings look like regular function calls. If you use the Kotlin DSL this is made much clearer.
Also, if you need help with Gradle setup specifically, I think this is not the right Slack. This is about Kotlin, and we can also talk about Gradle configuration surrounding Kotlin. But it seems you are trying to set up a quite custom configuration by changing a bunch of Gradle conventions, and in that case you might get more help on the Gradle Slack instead.
👍 1
d

Douglas Ronne

03/19/2024, 7:48 PM
I did something similar in my github project where I try to set up testing and resource finding for tests in a kotlin multiplatform project. but it is in kotlin dsl: https://github.com/vextorspace/KotlinMultiplatformTesting (look at the composeApp/build.gradle.kts for the example if it helps)