Skip to content

Commit fedda88

Browse files
laeubimarcphilipp
andcommitted
Make jdk.jfr import optional in OSGi manifest (#5092)
For consistency with its module descriptor. --------- Co-authored-by: Marc Philipp <[email protected]> (cherry picked from commit 729fc28)
1 parent 68a09c2 commit fedda88

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

documentation/src/docs/asciidoc/release-notes/release-notes-6.0.1.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ repository on GitHub.
1616
[[release-notes-6.0.1-junit-platform-bug-fixes]]
1717
==== Bug Fixes
1818

19+
* The `jdk.jfr` package is now an optional import when using the `junit-platform-launcher`
20+
as an OSGi bundle.
1921
* Remove remnants of Java 8 compatibility from User Guide.
2022

2123
[[release-notes-6.0.1-junit-platform-deprecations-and-breaking-changes]]

gradle/plugins/common/src/main/kotlin/junitbuild.osgi-conventions.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ tasks.withType<Jar>().named {
1616

1717
val importAPIGuardian by extra { "org.apiguardian.*;resolution:=\"optional\"" }
1818
val importJSpecify by extra { "org.jspecify.*;resolution:=\"optional\"" }
19+
val importCommonsLogging by extra { "org.junit.platform.commons.logging;status=INTERNAL" }
1920

2021
extensions.create<BundleTaskExtension>(BundleTaskExtension.NAME, this).apply {
2122
properties.set(projectDescription.map {
@@ -38,15 +39,15 @@ tasks.withType<Jar>().named {
3839
Import-Package: \
3940
${importAPIGuardian},\
4041
${importJSpecify},\
41-
org.junit.platform.commons.logging;status=INTERNAL,\
42+
${importCommonsLogging},\
4243
kotlin.*;resolution:="optional",\
4344
*
4445
4546
# This tells bnd not to complain if a module doesn't actually import
4647
# the kotlin and apiguardian packages, but enough modules do to make it a default.
4748
-fixupmessages.kotlin.import: "Unused Import-Package instructions: \\[kotlin.*\\]";is:=ignore
4849
-fixupmessages.apiguardian.import: "Unused Import-Package instructions: \\[org.apiguardian.*\\]";is:=ignore
49-
-fixupmessages.jspecify.import: "Unused Import-Package instructions: \\[org.jspecify.*\\]";is:=ignore
50+
-fixupmessages.warningsAsErrors: ".*";restrict:=warning;is:=error
5051
5152
# Don't scan for Class.forName package imports.
5253
# See https://bnd.bndtools.org/instructions/noclassforname.html
@@ -86,10 +87,10 @@ val osgiProperties by tasks.registering(WriteProperties::class) {
8687
property("-runee", Callable { "JavaSE-${javaLibrary.mainJavaVersion.get()}" })
8788
}
8889
property("-runrequires", "osgi.identity;filter:='(osgi.identity=${project.name})'")
89-
property("-runsystempackages", "jdk.internal.misc,jdk.jfr,sun.misc")
90-
// API Guardian should be optional -> instruct resolver to ignore it
90+
property("-runsystempackages", "jdk.internal.misc,sun.misc")
91+
// API Guardian and JDK JFR should be optional -> instruct resolver to ignore them
9192
// during resolution. Resolve should still pass.
92-
property("-runblacklist", "org.apiguardian.api")
93+
property("-runblacklist", "org.apiguardian.api,jdk.jfr")
9394
}
9495

9596
val osgiVerification = configurations.dependencyScope("osgiVerification")

junit-jupiter-migrationsupport/junit-jupiter-migrationsupport.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ tasks {
2626
bundle {
2727
val importAPIGuardian: String by extra
2828
val importJSpecify: String by extra
29+
val importCommonsLogging: String by extra
2930
bnd("""
3031
# Import JUnit4 packages with a version
3132
Import-Package: \
3233
$importAPIGuardian,\
3334
$importJSpecify,\
35+
$importCommonsLogging,\
3436
org.junit;version="[${libs.versions.junit4Min.get()},5)",\
35-
org.junit.platform.commons.logging;status=INTERNAL,\
3637
org.junit.rules;version="[${libs.versions.junit4Min.get()},5)",\
3738
*
3839
""")

junit-platform-launcher/junit-platform-launcher.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,17 @@ javadocConventions {
2323
tasks {
2424
jar {
2525
bundle {
26+
val importAPIGuardian: String by extra
27+
val importJSpecify: String by extra
28+
val importCommonsLogging: String by extra
2629
val version = project.version
2730
bnd("""
31+
Import-Package: \
32+
${importAPIGuardian},\
33+
${importJSpecify},\
34+
${importCommonsLogging},\
35+
jdk.jfr;resolution:="optional",\
36+
*
2837
Provide-Capability:\
2938
org.junit.platform.launcher;\
3039
org.junit.platform.launcher='junit-platform-launcher';\

junit-vintage-engine/junit-vintage-engine.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,17 @@ tasks {
4848
val version = project.version
4949
val importAPIGuardian: String by extra
5050
val importJSpecify: String by extra
51+
val importCommonsLogging: String by extra
5152
bnd("""
5253
# Import JUnit4 packages with a version
5354
Import-Package: \
5455
${importAPIGuardian},\
5556
${importJSpecify},\
57+
${importCommonsLogging},\
5658
junit.runner;version="[${junit4Min},5)",\
5759
org.junit;version="[${junit4Min},5)",\
5860
org.junit.experimental.categories;version="[${junit4Min},5)",\
5961
org.junit.internal.builders;version="[${junit4Min},5)",\
60-
org.junit.platform.commons.logging;status=INTERNAL,\
6162
org.junit.runner.*;version="[${junit4Min},5)",\
6263
org.junit.runners.model;version="[${junit4Min},5)",\
6364
*

0 commit comments

Comments
 (0)