Skip to content

Commit

Permalink
TODO and cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Feb 7, 2025
1 parent 2d399fa commit 66e849c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/docs/changes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
**Added**

- Sync `ShadowApplicationPlugin` with `ApplicationPlugin`. ([#1224](https://github.com/GradleUp/shadow/pull/1224))
- Inject `Multi-Release` attribute if any dependency contains it. ([#1239](https://github.com/GradleUp/shadow/pull/1239))
- Inject `Multi-Release` manifest attribute if any dependency contains it. ([#1239](https://github.com/GradleUp/shadow/pull/1239))

**Changed**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import assertk.assertions.single
import com.github.jengelman.gradle.plugins.shadow.ShadowJavaPlugin.Companion.SHADOW_JAR_TASK_NAME
import com.github.jengelman.gradle.plugins.shadow.internal.classPathAttributeKey
import com.github.jengelman.gradle.plugins.shadow.internal.mainClassAttributeKey
import com.github.jengelman.gradle.plugins.shadow.internal.multiReleaseAttributeKey
import com.github.jengelman.gradle.plugins.shadow.legacy.LegacyShadowPlugin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.util.BooleanParameterizedTest
Expand Down Expand Up @@ -193,13 +194,13 @@ class JavaPluginTest : BasePluginTest() {
"https://github.com/GradleUp/shadow/issues/449",
)
@Test
fun containsMultiReleaseAttrIfAnyDependencyContains() {
fun containsMultiReleaseAttrIfAnyDependencyContainsIt() {
writeClientAndServerModules()
path("client/build.gradle").appendText(
"""
jar {
manifest {
attributes 'Multi-Release': 'true'
attributes '$multiReleaseAttributeKey': 'true'
}
}
""".trimIndent() + System.lineSeparator(),
Expand All @@ -209,7 +210,7 @@ class JavaPluginTest : BasePluginTest() {

assertThat(outputServerShadowJar).useAll {
transform { it.manifest.mainAttributes }.isNotEmpty()
getMainAttr("Multi-Release").isEqualTo("true")
getMainAttr(multiReleaseAttributeKey).isEqualTo("true")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public abstract class ShadowJar :
@TaskAction
override fun copy() {
from(includedDependencies)
findAndAppendMultiReleaseAttr()
injectMultiReleaseAttrIfPresent()
super.copy()
logger.info(stats.toString())
}
Expand Down Expand Up @@ -328,7 +328,8 @@ public abstract class ShadowJar :
}
}

private fun findAndAppendMultiReleaseAttr() {
private fun injectMultiReleaseAttrIfPresent() {
// TODO: https://github.com/GradleUp/shadow/pull/1239#discussion_r1946064032.
val includeMultiReleaseAttr = includedDependencies.files.filter { it.extension == "jar" }
.any {
try {
Expand Down

0 comments on commit 66e849c

Please sign in to comment.