Skip to content

Support relocating Kotlin module files#1539

Merged
Goooler merged 36 commits into
mainfrom
g/20250723/relocate-kotlin-metadata
Sep 21, 2025
Merged

Support relocating Kotlin module files#1539
Goooler merged 36 commits into
mainfrom
g/20250723/relocate-kotlin-metadata

Conversation

@Goooler

@Goooler Goooler commented Jul 23, 2025

Copy link
Copy Markdown
Member

@Goooler Goooler force-pushed the g/20250723/relocate-kotlin-metadata branch 2 times, most recently from 3be4b4f to cd8664e Compare July 28, 2025 01:18
@Goooler Goooler force-pushed the g/20250723/relocate-kotlin-metadata branch 9 times, most recently from c4c6449 to a0aa512 Compare August 14, 2025 09:09
@Goooler Goooler force-pushed the g/20250723/relocate-kotlin-metadata branch 4 times, most recently from be60ca4 to 8d3ffe7 Compare August 21, 2025 09:58
@Goooler Goooler force-pushed the g/20250723/relocate-kotlin-metadata branch from 8d3ffe7 to 8c9c78a Compare August 28, 2025 08:27
@Goooler Goooler force-pushed the g/20250723/relocate-kotlin-metadata branch from 9bd73e4 to 9c69246 Compare August 28, 2025 10:34
…otlin-metadata

# Conflicts:
#	src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowCopyAction.kt
@Goooler Goooler force-pushed the g/20250723/relocate-kotlin-metadata branch 2 times, most recently from 04f6055 to 10e9904 Compare September 2, 2025 11:07
@shanshin

shanshin commented Sep 12, 2025

Copy link
Copy Markdown

The current implementation of KotlinModuleMetadata.read method checks the version of the metadata in loaded kotlin_module. And if its minor version is greater by 1 than the kotlin-metadata-jvm version, an error will be thrown.
E.g. for your current implementation kotlin_modules with metadata 2.4.0 will not be able to be processed.

Is such a restriction acceptable?

@Goooler

Goooler commented Sep 12, 2025

Copy link
Copy Markdown
Member Author

Is such a restriction acceptable?

It's fair. The current relocation copies the original version, and the relocated module file will behave like the original one.

val newKmMetadata = KotlinModuleMetadata(newKmModule, kmMetadata.version)

@Goooler

Goooler commented Sep 18, 2025

Copy link
Copy Markdown
Member Author

Please take a look as soon as possible.

If the changes all look good to you, I'll merge this PR and release a new version.

@Goooler Goooler requested a review from Copilot September 19, 2025 05:31

This comment was marked as outdated.

Goooler and others added 3 commits September 19, 2025 13:35
…ks/ShadowCopyAction.kt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Goooler Goooler force-pushed the g/20250723/relocate-kotlin-metadata branch from 4ec8ec7 to 22fc945 Compare September 19, 2025 05:52
@Goooler Goooler enabled auto-merge (squash) September 21, 2025 07:35
@Goooler Goooler requested a review from Copilot September 21, 2025 07:37

This comment was marked as outdated.

…shadow/RelocationTest.kt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Goooler Goooler merged commit 036feec into main Sep 21, 2025
10 checks passed
@Goooler Goooler deleted the g/20250723/relocate-kotlin-metadata branch September 21, 2025 07:50
@Goooler

Goooler commented Jun 29, 2026

Copy link
Copy Markdown
Member Author

I'm planning the deprecation of #1875 and split the built-in . kotlin_module file relocation into a new transformer in #2073. Users can apply it if they want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants