• 5
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

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'
}
    • @SimulantI have /src folder, where i keep/main(productive code) and /tests. So it seems like in this guide i have a similar structure
    • What's the actual path for **/myTests/**? As @Simulant suggests, your source sets could be optimised or it might be possible, that you don't need this configuration in the end.
      • 2
    • I just firgured out, that it's possible to optimised my configuration with moving /myTests folder out of the /src. So it would be a solution and seems like i will do the same. But i think that's a little bit strange that android-kotlin plugin doesn't contain api for excluding. Also it's seems like possible to do with Kotlin DSL: kotlin.sourceSets { main {kotlin.exclude('...')} }
java {
    srcDir 'src'
    exclude '**/myTests/*.kt'
}

There is no Kotlin related configuration.

Why I am saying this, I have all the kotlin files into kotlin directory and java files into java directory. But while configuring, I have put

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

this means that with src/main/java add source files from src/main/kotlin also while compiling.

This should solve your issue.

  • 1
Reply Report
    • exclude '/myTests/*.kt' will not exclude kt files from compile[flavourName]Kotlin gradle task. Also i have a mixed folder with kotlin and java, so i don't need to define dir for kotlin package