Skip to content

Commit 0bb2bb0

Browse files
KurdTtPrzemysław KsiążekGoooler
authored
Fix single Log4j2Plugins.dat isn't included into fat jar (#1039)
Co-authored-by: Przemysław Książek <[email protected]> Co-authored-by: Zongle Wang <[email protected]>
1 parent 5470da7 commit 0bb2bb0

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/docs/changes/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
- **BREAKING CHANGE:** Remove Develocity integration. ([#1013](https://github.com/GradleUp/shadow/pull/1013))
1313

14+
**Fixed**
15+
16+
- Fix single Log4j2Plugins.dat isn't included into fat jar. ([#1039](https://github.com/GradleUp/shadow/issues/1039)).
17+
1418

1519
## [v8.3.5] (2024-11-03)
1620

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/Log4j2PluginsCacheFileTransformer.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ public open class Log4j2PluginsCacheFileTransformer : Transformer {
5353
// This functionality matches the original plugin, however, I'm not clear what
5454
// the exact logic is. From what I can tell temporaryFiles should be never be empty
5555
// if anything has been performed.
56-
val hasTransformedMultipleFiles = temporaryFiles.size > 1
57-
val hasAtLeastOneFileAndRelocator = temporaryFiles.isNotEmpty() && relocators.isNotEmpty()
58-
return hasTransformedMultipleFiles || hasAtLeastOneFileAndRelocator
56+
return temporaryFiles.isNotEmpty() || relocators.isNotEmpty()
5957
}
6058

6159
override fun modifyOutputStream(os: ZipOutputStream, preserveFileTimestamps: Boolean) {

src/test/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/Log4j2PluginsCacheFileTransformerSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class Log4j2PluginsCacheFileTransformerSpec extends Specification {
2525
transformer = new Log4j2PluginsCacheFileTransformer()
2626
}
2727

28-
void "should not transformer"() {
28+
void "should transform for a single file"() {
2929
when:
3030
transformer.transform(new TransformerContext(PLUGIN_CACHE_FILE, getResourceStream(PLUGIN_CACHE_FILE)))
3131

3232
then:
33-
!transformer.hasTransformedResource()
33+
transformer.hasTransformedResource()
3434
}
3535

3636
void "should transform"() {

0 commit comments

Comments
 (0)