Allow overriding BUNDLING_ATTRIBUTE in GMM#1773
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowExtension.kt
Outdated
Show resolved
Hide resolved
74ea7a2 to
d50fb88
Compare
|
After thinking on your comments, I went ahead with a different approach, one that defaults to |
```kotlin
tasks.shadow {
// Unsetting automatically uses `Bundling.EMBEDDED` attribute if and only if there is no relocation.
bundlingAttribute = null
// Setting manually forces that attribute to be used instead.
bundlingAttribute = 'embedded'
}
```
8299e1e to
167e94b
Compare
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt
Outdated
Show resolved
Hide resolved
You can add a new test ref the others in Also needs an extra check in |
Co-authored-by: Zongle Wang <wangzongler@gmail.com>
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt
Outdated
Show resolved
Hide resolved
Bundling.EMBEDDED for non-relocating shadow JARsBUNDLING_ATTRIBUTE in GMM
There was a problem hiding this comment.
Pull Request Overview
Adds support for overriding the BUNDLING_ATTRIBUTE in Gradle Module Metadata (GMM) for shadow JARs through a new bundlingAttribute property in the ShadowExtension.
- Introduces a new
bundlingAttributeproperty inShadowExtensionwith default valueBundling.SHADOWED - Updates the attribute setting logic to use
attributeProviderwith lazy evaluation - Adds comprehensive tests and documentation for the new feature
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowExtension.kt | Adds the new bundlingAttribute property definition |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowBasePlugin.kt | Sets the default convention value for the bundling attribute |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.kt | Updates attribute configuration to use the new property with lazy evaluation |
| src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowPropertiesTest.kt | Adds test assertion for the default bundling attribute value |
| src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/PublishingTest.kt | Adds functional test for overriding the bundling attribute |
| docs/publishing/README.md | Documents the new feature with usage examples |
| docs/changes/README.md | Updates changelog with the new feature |
| api/shadow.api | Updates public API surface with new method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
33e682c to
3d71dc5
Compare
3d71dc5 to
6b1d10e
Compare
|
Thanks for finishing this up for me. I ended up having a busy start to my week. |
Bundling.EMBEDDED#1767.Adds a new property to the
ShadowJartask that dictates the bundling type to be used for the consumable configuration. I'm adding the bundling attribute usingAttributeContainer#attributeProvideras lazily-added attribute aren't computed until they're needed, which is after project evaluation.Once again looking for help with tests and code cleanup like last time. Kotlin is not my primary language 😅
tasks.shadowJar { bundlingAttribute = 'embedded' }