Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tasks.withType<Jar>().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>(BundleTaskExtension.NAME, this).apply {
properties.set(projectDescription.map {
Expand All @@ -38,15 +39,15 @@ tasks.withType<Jar>().named {
Import-Package: \
${importAPIGuardian},\
${importJSpecify},\
org.junit.platform.commons.logging;status=INTERNAL,\
${importCommonsLogging},\
kotlin.*;resolution:="optional",\
*

# This tells bnd not to complain if a module doesn't actually import
# 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
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)",\
*
""")
Expand Down
9 changes: 9 additions & 0 deletions junit-platform-launcher/junit-platform-launcher.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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';\
Expand Down
3 changes: 2 additions & 1 deletion junit-vintage-engine/junit-vintage-engine.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)",\
*
Expand Down
Loading