diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-6.0.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-6.0.1.adoc index 6e7ced558c02..03dc184bc04b 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-6.0.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-6.0.1.adoc @@ -16,6 +16,8 @@ repository on GitHub. [[release-notes-6.0.1-junit-platform-bug-fixes]] ==== Bug Fixes +* The `jdk.jfr` package is now an optional import when using the `junit-platform-launcher` + as an OSGi bundle. * Remove remnants of Java 8 compatibility from User Guide. [[release-notes-6.0.1-junit-platform-deprecations-and-breaking-changes]] diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.osgi-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.osgi-conventions.gradle.kts index 3dd9a2b7ee15..6040ad6663af 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.osgi-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.osgi-conventions.gradle.kts @@ -16,6 +16,7 @@ tasks.withType().named { val importAPIGuardian by extra { "org.apiguardian.*;resolution:=\"optional\"" } val importJSpecify by extra { "org.jspecify.*;resolution:=\"optional\"" } + val importCommonsLogging by extra { "org.junit.platform.commons.logging;status=INTERNAL" } extensions.create(BundleTaskExtension.NAME, this).apply { properties.set(projectDescription.map { @@ -38,7 +39,7 @@ tasks.withType().named { Import-Package: \ ${importAPIGuardian},\ ${importJSpecify},\ - org.junit.platform.commons.logging;status=INTERNAL,\ + ${importCommonsLogging},\ kotlin.*;resolution:="optional",\ * @@ -46,7 +47,7 @@ tasks.withType().named { # the kotlin and apiguardian packages, but enough modules do to make it a default. -fixupmessages.kotlin.import: "Unused Import-Package instructions: \\[kotlin.*\\]";is:=ignore -fixupmessages.apiguardian.import: "Unused Import-Package instructions: \\[org.apiguardian.*\\]";is:=ignore - -fixupmessages.jspecify.import: "Unused Import-Package instructions: \\[org.jspecify.*\\]";is:=ignore + -fixupmessages.warningsAsErrors: ".*";restrict:=warning;is:=error # Don't scan for Class.forName package imports. # See https://bnd.bndtools.org/instructions/noclassforname.html @@ -86,10 +87,10 @@ val osgiProperties by tasks.registering(WriteProperties::class) { property("-runee", Callable { "JavaSE-${javaLibrary.mainJavaVersion.get()}" }) } property("-runrequires", "osgi.identity;filter:='(osgi.identity=${project.name})'") - property("-runsystempackages", "jdk.internal.misc,jdk.jfr,sun.misc") - // API Guardian should be optional -> instruct resolver to ignore it + property("-runsystempackages", "jdk.internal.misc,sun.misc") + // API Guardian and JDK JFR should be optional -> instruct resolver to ignore them // during resolution. Resolve should still pass. - property("-runblacklist", "org.apiguardian.api") + property("-runblacklist", "org.apiguardian.api,jdk.jfr") } val osgiVerification = configurations.dependencyScope("osgiVerification") diff --git a/junit-jupiter-migrationsupport/junit-jupiter-migrationsupport.gradle.kts b/junit-jupiter-migrationsupport/junit-jupiter-migrationsupport.gradle.kts index a6fcef2c2756..bb8073b415fd 100644 --- a/junit-jupiter-migrationsupport/junit-jupiter-migrationsupport.gradle.kts +++ b/junit-jupiter-migrationsupport/junit-jupiter-migrationsupport.gradle.kts @@ -25,13 +25,14 @@ tasks { bundle { val importAPIGuardian: String by extra val importJSpecify: String by extra + val importCommonsLogging: String by extra bnd(""" # Import JUnit4 packages with a version Import-Package: \ $importAPIGuardian,\ $importJSpecify,\ + $importCommonsLogging,\ org.junit;version="[${libs.versions.junit4Min.get()},5)",\ - org.junit.platform.commons.logging;status=INTERNAL,\ org.junit.rules;version="[${libs.versions.junit4Min.get()},5)",\ * """) diff --git a/junit-platform-launcher/junit-platform-launcher.gradle.kts b/junit-platform-launcher/junit-platform-launcher.gradle.kts index 87f74cca330d..f20a4b784050 100644 --- a/junit-platform-launcher/junit-platform-launcher.gradle.kts +++ b/junit-platform-launcher/junit-platform-launcher.gradle.kts @@ -22,8 +22,17 @@ javadocConventions { tasks { jar { bundle { + val importAPIGuardian: String by extra + val importJSpecify: String by extra + val importCommonsLogging: String by extra val version = project.version bnd(""" + Import-Package: \ + ${importAPIGuardian},\ + ${importJSpecify},\ + ${importCommonsLogging},\ + jdk.jfr;resolution:="optional",\ + * Provide-Capability:\ org.junit.platform.launcher;\ org.junit.platform.launcher='junit-platform-launcher';\ diff --git a/junit-vintage-engine/junit-vintage-engine.gradle.kts b/junit-vintage-engine/junit-vintage-engine.gradle.kts index a994acfc935a..b314f7823478 100644 --- a/junit-vintage-engine/junit-vintage-engine.gradle.kts +++ b/junit-vintage-engine/junit-vintage-engine.gradle.kts @@ -47,16 +47,17 @@ tasks { val version = project.version val importAPIGuardian: String by extra val importJSpecify: String by extra + val importCommonsLogging: String by extra bnd(""" # Import JUnit4 packages with a version Import-Package: \ ${importAPIGuardian},\ ${importJSpecify},\ + ${importCommonsLogging},\ junit.runner;version="[${junit4Min},5)",\ org.junit;version="[${junit4Min},5)",\ org.junit.experimental.categories;version="[${junit4Min},5)",\ org.junit.internal.builders;version="[${junit4Min},5)",\ - org.junit.platform.commons.logging;status=INTERNAL,\ org.junit.runner.*;version="[${junit4Min},5)",\ org.junit.runners.model;version="[${junit4Min},5)",\ *