Skip to content

Allow repackaging Service file classes with R8 - #2174

Merged
Goooler merged 1 commit into
mainfrom
g/20260810/allowrepackage-for-service-files
Aug 10, 2026
Merged

Allow repackaging Service file classes with R8#2174
Goooler merged 1 commit into
mainfrom
g/20260810/allowrepackage-for-service-files

Conversation

@Goooler

@Goooler Goooler commented Aug 10, 2026

Copy link
Copy Markdown
Member

Follow up #2173 (comment).


  • CHANGELOG's "Unreleased" section has been updated, if applicable.

Base automatically changed from g/20260810/note-relocation to main August 10, 2026 08:41
@Goooler
Goooler force-pushed the g/20260810/allowrepackage-for-service-files branch from 1ac38e0 to 95d438a Compare August 10, 2026 08:42
@Goooler
Goooler force-pushed the g/20260810/allowrepackage-for-service-files branch from 95d438a to 22f9ddc Compare August 10, 2026 08:51
@Goooler
Goooler requested a lite review from Copilot August 10, 2026 08:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR follows up on prior R8 relocation documentation work by adjusting Shadow’s generated R8 keep rules so that classes referenced from META-INF/services/** can still be repackaged when -repackageclasses is used, while keeping ServiceLoader wiring intact.

Changes:

  • Update R8 minimizer service keep rules to permit repackaging of service interfaces/providers.
  • Simplify and tighten functional tests around service file relocation and R8 repackaging behavior.
  • Add a CHANGELOG entry for the new behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/R8Minimizer.kt Adjusts generated ProGuard/R8 rules for service descriptor classes/providers during minimization.
src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt Updates functional tests to validate relocated service entries and R8 repackaging results.
docs/changes/README.md Documents the change in the Unreleased changelog section.
Suppressed comments (1)

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/R8Minimizer.kt:217

  • Same issue here: allowrepackage should be allowrepackaging to correctly permit R8 repackaging while still keeping the service provider class.
            .forEach { provider -> rules += "-keep,allowrepackage class $provider { *; }" }

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Goooler
Goooler merged commit 92e3899 into main Aug 10, 2026
9 checks passed
@Goooler
Goooler deleted the g/20260810/allowrepackage-for-service-files branch August 10, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants