Migrate ShadowJar to using lazy properties#1044
Merged
Conversation
This reverts commit 6d4f3aa.
a314424 to
fe90f43
Compare
Contributor
There was a problem hiding this comment.
Copilot reviewed 3 out of 11 changed files in this pull request and generated no suggestions.
Files not reviewed (8)
- api/shadow.api: Language not supported
- lint-baseline.xml: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.kt: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/AbstractDependencyFilter.kt: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/UnusedTracker.kt: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/Utils.kt: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt: Language not supported
- src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ConfigureShadowRelocationSpec.groovy: Language not supported
…to-lazy-properties // Conflicts: // src/docs/changes/README.md // src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt
Contributor
There was a problem hiding this comment.
Copilot reviewed 3 out of 11 changed files in this pull request and generated no suggestions.
Files not reviewed (8)
- api/shadow.api: Language not supported
- lint-baseline.xml: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.kt: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/AbstractDependencyFilter.kt: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/UnusedTracker.kt: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/Utils.kt: Language not supported
- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt: Language not supported
- src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ConfigureShadowRelocationSpec.groovy: Language not supported
Goooler
commented
Feb 19, 2025
Comment on lines
-330
to
+283
| val packages = mutableSetOf<String>() | ||
| // Must cast configurations to List<FileCollection> to fix type mismatch in runtime. | ||
| (configurations as List<FileCollection>).forEach { configuration -> | ||
| configuration.files.forEach { jarFile -> | ||
| JarFile(jarFile).use { jf -> | ||
| jf.entries().asSequence().forEach { entry -> | ||
| if (entry.name.endsWith(".class") && entry.name != "module-info.class") { | ||
| packages.add(entry.name.substringBeforeLast('/').replace('/', '.')) | ||
| } | ||
| private val packageRelocators: List<SimpleRelocator> | ||
| get() { | ||
| if (!enableRelocation.get()) return emptyList() | ||
|
|
||
| val prefix = relocationPrefix.get() | ||
| // Must cast configurations to List<FileCollection> to fix type mismatch in runtime. | ||
| return (configurations.get() as List<FileCollection>).flatMap { configuration -> | ||
| configuration.files.flatMap { file -> | ||
| JarFile(file).use { jarFile -> | ||
| jarFile.entries().toList() | ||
| .filter { it.name.endsWith(".class") && it.name != "module-info.class" } | ||
| .map { it.name.substringBeforeLast('/').replace('/', '.') } | ||
| .map { SimpleRelocator(it, "$prefix.$it") } |
Member
Author
There was a problem hiding this comment.
This is a regression, we have to reduce duplicates before creating relocators, fixed in #1271.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1036.