diff --git a/junit-jupiter-api/junit-jupiter-api.gradle.kts b/junit-jupiter-api/junit-jupiter-api.gradle.kts index a356601ca00b..ee35c1197325 100644 --- a/junit-jupiter-api/junit-jupiter-api.gradle.kts +++ b/junit-jupiter-api/junit-jupiter-api.gradle.kts @@ -1,3 +1,5 @@ +import aQute.bnd.gradle.BundleTaskConvention + plugins { `kotlin-library-conventions` `java-test-fixtures` @@ -14,3 +16,16 @@ dependencies { compileOnly(kotlin("stdlib")) } + +tasks { + jar { + withConvention(BundleTaskConvention::class) { + bnd(""" + Require-Capability:\ + org.junit.platform.engine;\ + filter:='(&(org.junit.platform.engine=junit-jupiter)(version>=${'$'}{version_cleanup;${rootProject.property("version")!!}})(!(version>=${'$'}{versionmask;+;${'$'}{version_cleanup;${rootProject.property("version")!!}}})))';\ + effective:=active + """) + } + } +} diff --git a/junit-jupiter-engine/junit-jupiter-engine.gradle.kts b/junit-jupiter-engine/junit-jupiter-engine.gradle.kts index e3cf2f0d363e..3bdf72443d46 100644 --- a/junit-jupiter-engine/junit-jupiter-engine.gradle.kts +++ b/junit-jupiter-engine/junit-jupiter-engine.gradle.kts @@ -39,6 +39,10 @@ tasks { org.junit.platform.engine;\ org.junit.platform.engine='junit-jupiter';\ version:Version="${'$'}{version_cleanup;${project.version}}" + Require-Capability:\ + org.junit.platform.launcher;\ + filter:='(&(org.junit.platform.launcher=junit-platform-launcher)(version>=${'$'}{version_cleanup;${rootProject.property("platformVersion")!!}})(!(version>=${'$'}{versionmask;+;${'$'}{version_cleanup;${rootProject.property("platformVersion")!!}}})))';\ + effective:=active """) } } diff --git a/junit-jupiter-params/junit-jupiter-params.gradle.kts b/junit-jupiter-params/junit-jupiter-params.gradle.kts index 54f37c90dc81..2c712c9afde0 100644 --- a/junit-jupiter-params/junit-jupiter-params.gradle.kts +++ b/junit-jupiter-params/junit-jupiter-params.gradle.kts @@ -1,3 +1,5 @@ +import aQute.bnd.gradle.BundleTaskConvention + plugins { `kotlin-library-conventions` `shadow-conventions` @@ -23,6 +25,19 @@ dependencies { testImplementation(kotlin("stdlib")) } +tasks { + jar { + withConvention(BundleTaskConvention::class) { + bnd(""" + Require-Capability:\ + org.junit.platform.engine;\ + filter:='(&(org.junit.platform.engine=junit-jupiter)(version>=${'$'}{version_cleanup;${rootProject.property("version")!!}})(!(version>=${'$'}{versionmask;+;${'$'}{version_cleanup;${rootProject.property("version")!!}}})))';\ + effective:=active + """) + } + } +} + tasks { shadowJar { relocate("com.univocity", "org.junit.jupiter.params.shadow.com.univocity") diff --git a/junit-platform-launcher/junit-platform-launcher.gradle.kts b/junit-platform-launcher/junit-platform-launcher.gradle.kts index 0a154bef093d..216ce4877198 100644 --- a/junit-platform-launcher/junit-platform-launcher.gradle.kts +++ b/junit-platform-launcher/junit-platform-launcher.gradle.kts @@ -1,3 +1,5 @@ +import aQute.bnd.gradle.BundleTaskConvention + plugins { `java-library-conventions` `java-test-fixtures` @@ -11,3 +13,16 @@ dependencies { compileOnlyApi(libs.apiguardian) } + +tasks { + jar { + withConvention(BundleTaskConvention::class) { + bnd(""" + Provide-Capability:\ + org.junit.platform.launcher;\ + org.junit.platform.launcher='junit-platform-launcher';\ + version:Version="${'$'}{version_cleanup;${project.version}}" + """) + } + } +} diff --git a/junit-vintage-engine/junit-vintage-engine.gradle.kts b/junit-vintage-engine/junit-vintage-engine.gradle.kts index 0cb2a01717cb..d4f5c906646f 100644 --- a/junit-vintage-engine/junit-vintage-engine.gradle.kts +++ b/junit-vintage-engine/junit-vintage-engine.gradle.kts @@ -53,6 +53,10 @@ tasks { org.junit.platform.engine;\ org.junit.platform.engine='junit-vintage';\ version:Version="${'$'}{version_cleanup;${project.version}}" + Require-Capability:\ + org.junit.platform.launcher;\ + filter:='(&(org.junit.platform.launcher=junit-platform-launcher)(version>=${'$'}{version_cleanup;${rootProject.property("platformVersion")!!}})(!(version>=${'$'}{versionmask;+;${'$'}{version_cleanup;${rootProject.property("platformVersion")!!}}})))';\ + effective:=active """) } }