Skip to content

Commit

Permalink
follow up of junit-team#2544 to enable a fully resolveable OSGi solution
Browse files Browse the repository at this point in the history
What this means is that merely by consuming the Jupiter client APIs results in requiring a fully fleshed out runtime including launcher as follows
- junit-jupiter-api & junit-jupiter-params Requires a org.junit.platform.engine=junit-jupiter
- junit-jupiter-engine Provides org.junit.platform.engine=junit-jupiter
- junit-vintage-engine Provides org.junit.platform.engine=junit-vintage
- junit-jupiter-engine & junit-vintage-engine Requires org.junit.platform.launcher=junit-platform-launcher
- junit-platform-launcher Provides org.junit.platform.launcher=junit-platform-launcher

The solution is solvable by consuming junit-jupiter-api & junit-jupiter-params in your tests OR in the case of vintage
having @requirement(namespace = "org.junit.platform.engine", name = "junit-vintage")

Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
  • Loading branch information
rotty3000 committed Jul 3, 2021
1 parent bb83427 commit 5ef1f23
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
15 changes: 15 additions & 0 deletions junit-jupiter-api/junit-jupiter-api.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import aQute.bnd.gradle.BundleTaskConvention

plugins {
`kotlin-library-conventions`
`java-test-fixtures`
Expand All @@ -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
""")
}
}
}
4 changes: 4 additions & 0 deletions junit-jupiter-engine/junit-jupiter-engine.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
""")
}
}
Expand Down
15 changes: 15 additions & 0 deletions junit-jupiter-params/junit-jupiter-params.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import aQute.bnd.gradle.BundleTaskConvention

plugins {
`kotlin-library-conventions`
`shadow-conventions`
Expand All @@ -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")
Expand Down
15 changes: 15 additions & 0 deletions junit-platform-launcher/junit-platform-launcher.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import aQute.bnd.gradle.BundleTaskConvention

plugins {
`java-library-conventions`
`java-test-fixtures`
Expand All @@ -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}}"
""")
}
}
}
4 changes: 4 additions & 0 deletions junit-vintage-engine/junit-vintage-engine.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
""")
}
}
Expand Down

0 comments on commit 5ef1f23

Please sign in to comment.