diff --git a/cli-helper/build.gradle.kts b/cli-helper/build.gradle.kts index 8bc63d4f2a124..08ad98a1c310b 100644 --- a/cli-helper/build.gradle.kts +++ b/cli-helper/build.gradle.kts @@ -22,6 +22,7 @@ plugins { id("ort-application-conventions") } +// See https://docs.gradle.org/current/userguide/declaring_configurations.html#sec:configuration-flags-roles. configurations.dependencyScope("pluginClasspath") configurations["runtimeOnly"].extendsFrom(configurations["pluginClasspath"]) diff --git a/cli-test-launcher/build.gradle.kts b/cli-test-launcher/build.gradle.kts index ff120679a91ea..d0cbc75eefd9f 100644 --- a/cli-test-launcher/build.gradle.kts +++ b/cli-test-launcher/build.gradle.kts @@ -28,17 +28,20 @@ application { } val Project.hasFunTests - // Do not dig into sourceSets to avoid coupling between projects. - get() = projectDir.resolve("src/funTest").isDirectory + // Registering a feature automatically creates several configurations, see + // https://docs.gradle.org/current/userguide/how_to_create_feature_variants_of_a_library.html#sec::declare_feature_variants + get() = configurations.findByName("funTestRuntimeElements") != null -dependencies { - rootProject.subprojects.filter { it.hasFunTests }.forEach { - implementation(project(it.path)) { - capabilities { - // Note that this uses kebab-case although "registerFeature()" uses camelCase, see - // https://github.com/gradle/gradle/issues/31362. - @Suppress("UnstableApiUsage") - requireFeature("fun-test") +gradle.projectsEvaluated { + dependencies { + rootProject.subprojects.filter { it.hasFunTests }.forEach { + runtimeOnly(project(it.path)) { + capabilities { + // Note that this uses kebab-case although "registerFeature()" uses camelCase, see + // https://github.com/gradle/gradle/issues/31362. + @Suppress("UnstableApiUsage") + requireFeature("fun-test") + } } } } diff --git a/cli/build.gradle.kts b/cli/build.gradle.kts index 2d986a98059df..64f2c8ab71b07 100644 --- a/cli/build.gradle.kts +++ b/cli/build.gradle.kts @@ -24,6 +24,7 @@ plugins { id("ort-application-conventions") } +// See https://docs.gradle.org/current/userguide/declaring_configurations.html#sec:configuration-flags-roles. configurations.dependencyScope("pluginClasspath") configurations["runtimeOnly"].extendsFrom(configurations["pluginClasspath"])