Jon Bayle
11/08/2024, 1:49 PMinternal class, then I get this error:
Cannot access 'UserCreationContext': it is internal in 'UserCreateService'
According to Kotlin's doc, this behaviour is normal, only SourceSet test can access internal members of SourceSet main
https://kotlinlang.org/docs/visibility-modifiers.html#modules
This is what I tried so far:
testing {
suites {
val test by getting(JvmTestSuite::class) {
useJUnitJupiter() // JUnit 5 only
}
register<JvmTestSuite>("integrationTest") {
testType = TestSuiteType.INTEGRATION_TEST
dependencies {
implementation(project())
}
sources {
kotlin {
srcDirs("src/integration-test/kotlin")
// ITs depends on Factories that are in UTs
compileClasspath += sourceSets.test.get().output
runtimeClasspath += sourceSets.test.get().output
}
}
}
}
}
// ITs inherit classpath of UT (transitively inherits classpath of main)
val integrationTestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.testImplementation.get())
}
Thanks for your help 🙏Thomas Broyer
11/08/2024, 2:04 PMinternal members of the main one.
I, for one, use the following to allow it: https://github.com/tbroyer/gradle-errorprone-plugin/blob/2edcdf943bf4c6dd8b539446dbd1e1f3aff9087d/build.gradle.kts#L77-L80
// associate with main Kotlin compilation to access internal constants
kotlin.target.compilations.named(name) {
associateWith(kotlin.target.compilations["main"])
}Jon Bayle
11/08/2024, 2:26 PM