Slackbot
01/25/2023, 5:57 PMThomas Broyer
01/25/2023, 6:04 PMfunctionalTest compilation as a associated with the main compilation:
kotlin.target.compilations.named("functionalTest") {
associateWith(kotlin.target.compilations["main"])
}
The Kotlin plugin does that automatically for the test source set, but you have to do it manually for any other source set (e.g. testing suites)Javi
01/25/2023, 6:12 PMcompilations exist outside of KMP?Javi
01/25/2023, 6:13 PMKotlinJvmProjectExtension too, but not on KotlinProjectExtensionJavi
01/25/2023, 6:24 PMtestFixtures by default has the same problem, I guess it is an intended behavior, right?Javi
01/25/2023, 6:51 PMtestFixtures but no luck 🤷
kotlin.target.compilations.named("functionalTest") {
associateWith(kotlin.target.compilations["testFixtures"])
}Javi
01/25/2023, 7:22 PMTest runtime classpath does not contain plugin metadata file 'plugin-under-test-metadata.properties'
org.gradle.testkit.runner.InvalidPluginMetadataException: Test runtime classpath does not contain plugin metadata file 'plugin-under-test-metadata.properties'
val testPluginClasspath: Configuration =
configurations.create("testPluginClasspath")
dependencies {
for (dependency in pluginUnderTestDependencies) {
testPluginClasspath(dependency)
}
}
tasks.withType<PluginUnderTestMetadata>().configureEach { metadata ->
metadata.pluginClasspath.from(testPluginClasspath)
}Javi
01/25/2023, 7:22 PMtest source set, but fails on functionalTest oneephemient
01/25/2023, 7:24 PMkotlin.target.compilations {
val main by getting
val testFixtures by getting {
associateWith(main)
}
named("functionalTest") {
associateWith(main)
associateWith(testFixtures)
}
}
compiles fine for me with access to internal across source sets, the only problem is the IDE not recognizing itephemient
01/25/2023, 7:38 PM@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") to bypass internal protection as well. the IDE won't help with auto-complete but it'll stop showing red errorsThomas Broyer
01/25/2023, 8:39 PMgradlePlugin {
testSourceSets(project.sourceSets["functionalTest"])
}Javi
01/26/2023, 12:16 AMJavi
01/26/2023, 12:17 AM--rerun-tasks it passes 🤔Javi
01/26/2023, 12:22 AMThomas Broyer
01/26/2023, 7:31 AMJavi
01/26/2023, 9:14 AM