Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions src/docs/changes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
Some public `List` parameters are also changed to `Set`.
- Replace deprecated `SelfResolvingDependency` with `FileCollectionDependency`. ([#1114](https://github.com/GradleUp/shadow/pull/1114))

**Fixed**

- Fail builds if processing bad jars. ([#1146](https://github.com/GradleUp/shadow/pull/1146))


## [v9.0.0-beta4] (2024-12-06)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.jengelman.gradle.plugins.shadow

import assertk.all
import assertk.assertThat
import assertk.assertions.contains
import assertk.assertions.isEqualTo
Expand All @@ -18,6 +19,7 @@ import kotlin.io.path.readText
import kotlin.io.path.writeText
import org.gradle.api.plugins.JavaPlugin
import org.gradle.testfixtures.ProjectBuilder
import org.gradle.testkit.runner.TaskOutcome.FAILED
import org.gradle.testkit.runner.TaskOutcome.SUCCESS
import org.gradle.testkit.runner.TaskOutcome.UP_TO_DATE
import org.junit.jupiter.api.Disabled
Expand Down Expand Up @@ -830,6 +832,33 @@ class ShadowPluginTest : BasePluginTest() {
assertThat(result.output).contains("Reusing configuration cache.")
}

@Issue(
"https://github.com/GradleUp/shadow/issues/915",
)
@Test
fun failBuildIfProcessingBadJar() {
val badJarPath = path("bad.jar").apply {
writeText("A bad jar.")
}.toUri().toURL().path

projectScriptPath.appendText(
"""
dependencies {
implementation files('$badJarPath')
}
""".trimIndent(),
)

val result = runWithFailure(shadowJarTask)

assertThat(result).all {
taskOutcomeEquals(shadowJarTask, FAILED)
transform { it.output }.contains(
"java.util.zip.ZipException: archive is not a ZIP archive",
)
}
}

private fun writeShadowedClientAndServerModules() {
writeClientAndServerModules()
path("client/build.gradle").appendText(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ public open class ShadowCopyAction internal constructor(
"See: ${documentationRegistry.getDslRefForProperty(Zip::class.java, "zip64")}",
)
}
// Rethrow the exception like `java.util.zip.ZipException: archive is not a ZIP archive`.
throw e
}
return WorkResults.didWork(true)
}
Expand Down
Loading