Parallelize bytecode remapping in ShadowCopyAction - #2302
Open
Goooler wants to merge 9 commits into
Open
Conversation
Goooler
force-pushed
the
g/20260912/parallel
branch
from
September 12, 2026 15:47
f5a4186 to
6ce4373
Compare
Goooler
force-pushed
the
g/20260912/parallel
branch
2 times, most recently
from
September 13, 2026 04:56
e47542a to
de331c0
Compare
Goooler
marked this pull request as ready for review
September 13, 2026 04:56
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Address cancellation handling, relocator thread safety, and non-class resource buffering.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request parallelizes bytecode remapping while preserving ZIP entry order.
Changes:
- Adds coroutine-based remapping and serialized ZIP writing.
- Refactors remapping and file reading to use byte arrays.
- Adds functional tests, dependency configuration, and a changelog entry.
Review findings:
- Critical, 3 votes: Cancellation can leave channel sends blocked after remapping failure.
- Moderate, 2 votes: User-provided relocators may not be thread-safe when invoked concurrently.
- Critical, 3 votes: Buffering complete non-class resources can cause memory spikes or OOM.
File summaries
| File | Description |
|---|---|
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowCopyAction.kt |
Parallel remapping and queued ZIP writes |
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/RelocatorRemapper.kt |
Byte-array remapping support |
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/GradleCompat.kt |
File-reading helper |
src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ParallelRelocationTest.kt |
Parallelism, determinism, and failure tests |
gradle/libs.versions.toml |
Coroutines dependency version |
CHANGELOG.md |
Unreleased change entry |
build.gradle.kts |
Compile-only coroutine dependency |
Review details
- Files reviewed: 6/7 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+246
to
+250
| val rawBytes = fileDetails.readBytes() | ||
| sendEntry( | ||
| entryName = relocated, | ||
| fileDetails = fileDetails, | ||
| deferredBytes = CompletableDeferred(rawBytes), |
Comment on lines
+261
to
+262
| runBlocking { | ||
| channel.send( |
Comment on lines
+232
to
+234
| val deferred = | ||
| scope.async(Dispatchers.Default) { | ||
| rawBytes.remapClass(relocators = relocators, path = path) |
Goooler
force-pushed
the
g/20260912/parallel
branch
from
September 13, 2026 08:14
de331c0 to
7d8fe17
Compare
# Conflicts: # src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowCopyAction.kt
Goooler
force-pushed
the
g/20260912/parallel
branch
from
September 13, 2026 08:55
3dc4f9e to
bd7b680
Compare
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.
No description provided.