Skip to content

Commit 21a7450

Browse files
committed
build: simplify log4j patching
With release 2.25.0 this can now be done properly, as it includes apache/logging-log4j2#3450 Signed-off-by: Jendrik Johannes <[email protected]>
1 parent 66d3bf8 commit 21a7450

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

src/main/kotlin/org.hiero.gradle.base.jpms-modules.gradle.kts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,12 @@ plugins {
44
id("org.gradlex.extra-java-module-info")
55
}
66

7-
// Dependencies that are missing in metadata because the 'compileOnlyApi' scope is not supported by
8-
// POM. We add these dependencies with a version to avoid maintaining versions in every single
9-
// project. These are "only" annotation libraries that are not included in the runtime classpath.
10-
// Because of this, they are not automatically visible to the consistent resolution. Therefore, we
11-
// need to explicitly add them to the version-providing Configuration (called mainRuntimeClasspath).
12-
val additionalTransitiveCompileOnlyApiDependencies =
13-
listOf(
14-
"biz.aQute.bnd:biz.aQute.bnd.annotation:7.1.0",
15-
"com.google.errorprone:error_prone_annotations:2.36.0",
16-
"org.jspecify:jspecify:1.0.0",
17-
)
18-
197
// Fix or enhance the metadata of third-party Modules. This is about the metadata in the
208
// repositories: '*.pom' and '*.module' files.
219
jvmDependencyConflicts.patch {
2210
// WORKAROUND: https://github.com/hyperledger/besu/pull/8443
2311
module("org.hyperledger.besu:bom") { removeDependency("javax.inject:javax.inject") }
2412

25-
// WORKAROUND: https://github.com/apache/logging-log4j2/issues/3437
26-
module("org.apache.logging.log4j:log4j-api") {
27-
additionalTransitiveCompileOnlyApiDependencies.forEach { addCompileOnlyApiDependency(it) }
28-
}
29-
module("org.apache.logging.log4j:log4j-core") {
30-
additionalTransitiveCompileOnlyApiDependencies.forEach { addCompileOnlyApiDependency(it) }
31-
}
32-
3313
// Register JARs with classifier as features
3414
module("io.netty:netty-transport-native-epoll") {
3515
addFeature("linux-x86_64") // refer to as 'io.netty.transport.epoll.linux.x86_64'
@@ -308,6 +288,8 @@ extraJavaModuleInfo {
308288
)
309289
module("org.hdrhistogram:HdrHistogram", "org.hdrhistogram")
310290
module("org.latencyutils:LatencyUtils", "org.latencyutils")
291+
module("org.osgi:org.osgi.annotation.bundle", "org.osgi.annotation.bundle")
292+
module("org.osgi:org.osgi.annotation.versioning", "org.osgi.annotation.versioning")
311293

312294
// Annotation processing only
313295
module("com.google.auto.service:auto-service-annotations", "com.google.auto.service")
@@ -416,10 +398,5 @@ configurations.getByName("mainRuntimeClasspath") {
416398
attributes.attribute(consistentResolutionAttribute, "global")
417399
}
418400

419-
// WORKAROUND: https://github.com/apache/logging-log4j2/issues/3437
420-
additionalTransitiveCompileOnlyApiDependencies.forEach {
421-
dependencies.add("mainRuntimeClasspath", it)
422-
}
423-
424401
// In case published versions of a module are also available, always prefer the local one
425402
configurations.all { resolutionStrategy.preferProjectModules() }

src/test/kotlin/org/hiero/gradle/test/JpmsPatchTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class JpmsPatchTest {
1616
configurations.all { attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21) }
1717
dependencies.components.withModule("com.goterl:resource-loader") { this.status = "release" }
1818
dependencies.components.withModule("com.goterl:lazysodium-java") { this.status = "release" }
19-
dependencies.components.all { if(listOf("alpha", "beta", "rc", "cr").any { id.version.lowercase().contains(it) }) status = "integration" }
19+
dependencies.components.all { if(listOf("alpha", "beta", "rc", "cr", ".m").any { id.version.lowercase().contains(it) }) status = "integration" }
2020
"""
2121
p.aggregationBuildFile(
2222
"""plugins { id("org.hiero.gradle.base.lifecycle") }

0 commit comments

Comments
 (0)