How to exclude kotlin files from compiling with gradle

With Java, we are excluding like this:

java {
    srcDir 'src'
    exclude '**/myTests/**'
}

I want to make the same thing with kotlin.
Trying to find some docs on this in official documentation configuring kotlin with no success.
What i’ve expected and already tried (and of course with no success):

kotlin {
    srcDir 'src'
    exclude '**/myTests/*.kt'
}
2 Likes

Same problems.
It happens when I apply the kotlin-android plugin and I have no idea how to fix this.