Repository navigation
fix: generated KMP JNI sources carry their producer - #15
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
addKmpJvmSources added the generated directory through a provider of its own, which carries no producer, and patched only the compile tasks with dependsOn. Any other reader of the source set raced generation: a published Android or jvm() sources jar failed Gradle's implicit-dependency check. The directory is now a file collection built by the generation task, so every reader depends on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lemcoder
added a commit
to lemcoder/MikroSoundFont
that referenced
this pull request
Nov 2, 2026
alpha04 orders its tasks after KGP's downloadKotlinNativeDistribution (lemcoder/KonanPlugin#16) and gives the generated JNI sources their producer (lemcoder/KonanPlugin#15), so the build script needs neither dependency. It also marshals JNI strings as real UTF-8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
KotlinGradlePlugin.addKmpJvmSourcesadds the generated JNI bindings to every JVM/Android main source set throughproject.provider { … }, which carries no producer, and only patches the compile tasks withdependsOn(generate). Any other reader of the source set races generation. Publishing a KMP library with an Android target (vanniktech maven-publish,androidSourcesJar) fails:Fix
The source directory is a
project.files(…).builtBy(generate)collection, so the compile, sources jars, lint and anything else reading the source set depend on generation. The compile-onlydependsOnis no longer needed.Tests
a multiplatform jvm() target's sources jar is built after its JNI bindings are generated. It fails without the fix and passes with it.a multiplatform jvm() target compiles after its JNI bindings are generatedstill passes.includeBuild:androidSourcesJarnow depends ongenerateJniTsfwithout the build-script workaround.🤖 Generated with Claude Code