Skip to content

Commit 0a1e6ab

Browse files
Copilotlaeubi
authored andcommitted
Make jdk.jfr import optional in OSGi manifest
Co-authored-by: laeubi <[email protected]>
1 parent 976af17 commit 0a1e6ab

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 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 importJdkJfr by extra { "jdk.jfr;resolution:=\"optional\"" }
1920

2021
extensions.create<BundleTaskExtension>(BundleTaskExtension.NAME, this).apply {
2122
properties.set(projectDescription.map {
@@ -38,6 +39,7 @@ tasks.withType<Jar>().named {
3839
Import-Package: \
3940
${importAPIGuardian},\
4041
${importJSpecify},\
42+
${importJdkJfr},\
4143
org.junit.platform.commons.logging;status=INTERNAL,\
4244
kotlin.*;resolution:="optional",\
4345
*
@@ -47,6 +49,7 @@ tasks.withType<Jar>().named {
4749
-fixupmessages.kotlin.import: "Unused Import-Package instructions: \\[kotlin.*\\]";is:=ignore
4850
-fixupmessages.apiguardian.import: "Unused Import-Package instructions: \\[org.apiguardian.*\\]";is:=ignore
4951
-fixupmessages.jspecify.import: "Unused Import-Package instructions: \\[org.jspecify.*\\]";is:=ignore
52+
-fixupmessages.jdkjfr.import: "Unused Import-Package instructions: \\[jdk.jfr\\]";is:=ignore
5053
5154
# Don't scan for Class.forName package imports.
5255
# See https://bnd.bndtools.org/instructions/noclassforname.html
@@ -86,8 +89,8 @@ val osgiProperties by tasks.registering(WriteProperties::class) {
8689
property("-runee", Callable { "JavaSE-${javaLibrary.mainJavaVersion.get()}" })
8790
}
8891
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
92+
property("-runsystempackages", "jdk.internal.misc,sun.misc")
93+
// API Guardian and JDK JFR should be optional -> instruct resolver to ignore them
9194
// during resolution. Resolve should still pass.
9295
property("-runblacklist", "org.apiguardian.api")
9396
}

0 commit comments

Comments
 (0)