Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin source dirs for Android modules aren't parsed #172

Closed
RBusarow opened this issue Sep 30, 2021 · 0 comments · Fixed by #173
Closed

Kotlin source dirs for Android modules aren't parsed #172

RBusarow opened this issue Sep 30, 2021 · 0 comments · Fixed by #173
Labels
bug Something isn't working

Comments

@RBusarow
Copy link
Member

RBusarow commented Sep 30, 2021

This refers to using src/main/kotlin instead of src/main/java.

This works just fine in java-library modules, whether the module in question is the dependent or the dependency.

For Android modules, the source dir needs to be added like this:

android {
  sourceSets {
    androidTest.java.srcDirs += 'src/androidTest/kotlin'
    main.java.srcDirs += 'src/main/kotlin'
    debug.java.srcDirs += 'src/debug/kotlin'
    release.java.srcDirs += 'src/release/kotlin'
    test.java.srcDirs += 'src/test/kotlin'
  }
}

This isn't hooking into the KotlinCompile task or anything like that, so it is included in the configuration when ModuleCheck tasks run.

The src/main/kotlin files are invisible to the parser, so anything which is only used inside that directory will be reported as unused. And if the Android module is a library, then anything which is declared inside that directory won't be counted.

@RBusarow RBusarow added the bug Something isn't working label Sep 30, 2021
RBusarow added a commit that referenced this issue Sep 30, 2021
@kodiakhq kodiakhq bot closed this as completed in #173 Sep 30, 2021
kodiakhq bot pushed a commit that referenced this issue Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant