Skip to content

Commit

Permalink
Fix single Log4j2Plugins.dat isn't included into fat jar (#1039)
Browse files Browse the repository at this point in the history
Co-authored-by: Przemysław Książek <[email protected]>
Co-authored-by: Zongle Wang <[email protected]>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent 5470da7 commit 0bb2bb0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/docs/changes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

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

**Fixed**

- Fix single Log4j2Plugins.dat isn't included into fat jar. ([#1039](https://github.com/GradleUp/shadow/issues/1039)).


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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ public open class Log4j2PluginsCacheFileTransformer : Transformer {
// This functionality matches the original plugin, however, I'm not clear what
// the exact logic is. From what I can tell temporaryFiles should be never be empty
// if anything has been performed.
val hasTransformedMultipleFiles = temporaryFiles.size > 1
val hasAtLeastOneFileAndRelocator = temporaryFiles.isNotEmpty() && relocators.isNotEmpty()
return hasTransformedMultipleFiles || hasAtLeastOneFileAndRelocator
return temporaryFiles.isNotEmpty() || relocators.isNotEmpty()
}

override fun modifyOutputStream(os: ZipOutputStream, preserveFileTimestamps: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class Log4j2PluginsCacheFileTransformerSpec extends Specification {
transformer = new Log4j2PluginsCacheFileTransformer()
}

void "should not transformer"() {
void "should transform for a single file"() {
when:
transformer.transform(new TransformerContext(PLUGIN_CACHE_FILE, getResourceStream(PLUGIN_CACHE_FILE)))

then:
!transformer.hasTransformedResource()
transformer.hasTransformedResource()
}

void "should transform"() {
Expand Down

0 comments on commit 0bb2bb0

Please sign in to comment.