Skip to content

Commit b8c0424

Browse files
committed
build(cli-test-launcher): Do not tap into the file-system to get funTests
Better check for the configuration created by `registerFeature()`. Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.io>
1 parent b47dff4 commit b8c0424

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

cli-test-launcher/build.gradle.kts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,20 @@ application {
2828
}
2929

3030
val Project.hasFunTests
31-
// Do not dig into sourceSets to avoid coupling between projects.
32-
get() = projectDir.resolve("src/funTest").isDirectory
31+
// Registering a feature automatically creates several configurations, see
32+
// https://docs.gradle.org/current/userguide/how_to_create_feature_variants_of_a_library.html#sec::declare_feature_variants
33+
get() = configurations.findByName("funTestRuntimeElements") != null
3334

34-
dependencies {
35-
rootProject.subprojects.filter { it.hasFunTests }.forEach {
36-
implementation(project(it.path)) {
37-
capabilities {
38-
// Note that this uses kebab-case although "registerFeature()" uses camelCase, see
39-
// https://github.com/gradle/gradle/issues/31362.
40-
@Suppress("UnstableApiUsage")
41-
requireFeature("fun-test")
35+
gradle.projectsEvaluated {
36+
dependencies {
37+
rootProject.subprojects.filter { it.hasFunTests }.forEach {
38+
runtimeOnly(project(it.path)) {
39+
capabilities {
40+
// Note that this uses kebab-case although "registerFeature()" uses camelCase, see
41+
// https://github.com/gradle/gradle/issues/31362.
42+
@Suppress("UnstableApiUsage")
43+
requireFeature("fun-test")
44+
}
4245
}
4346
}
4447
}

0 commit comments

Comments
 (0)