1

Kotlin internal visibility is scoped to the "module" including the helpful statement that it may be:

a Gradle source set (with the exception that the test source set can access the internal declarations of main)

... so you can unit-test internal methods.

My Gradle build holds performance tests in a sub-project. How can I make those also "see" internal items of the parent?

The standard import doesn't do this

dependencies {
  compile project(':myParentName')`
}

If it's impossible from a sub-project, how can a custom source-set (i.e. not test) in the main project have the same exception?

PS. It is quite common to see JMH performance tests put into a sub-project to keep configuration from polluting from the main build.gradle. This doesnt mean they are only tests of public interfaces (see the M in JMH).

drekbour
  • 2,895
  • 18
  • 28
  • Duplicate of https://stackoverflow.com/questions/57050889/kotlin-internal-members-not-accessible-from-alternative-test-source-set-in-gradl? – gaiazov Dec 10 '19 at 04:03
  • 57050889 is specifically for a custom sourceSet. I don't think that will help here either because of a validation check that appears to force `associateWith` to be quite localised. https://github.com/JetBrains/kotlin/blob/45ab07654eaecab82236133fa33135632f142534/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/kotlinCompilations.kt#L205 – drekbour Dec 10 '19 at 14:31

0 Answers0