desktop - support prebuilt JNI binaries via Maven Central to skip C++ build#768
Closed
jamesarich wants to merge 1 commit into
Closed
desktop - support prebuilt JNI binaries via Maven Central to skip C++ build#768jamesarich wants to merge 1 commit into
jamesarich wants to merge 1 commit into
Conversation
… build Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
|
How did you validate these changes? On which platforms? |
Collaborator
|
Oh, we don't want to build against the prebuilt JNI adapter -- we want to build our JNI module against the prebuilt MapLibre Native. |
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.
Implements the "prebuilt binaries" suggestion from @sargunv in sargunv/maplibre-native#2 (comment) to improve the desktop contributor experience.
Problem
Contributing to the desktop JVM target currently requires a full C++ build of maplibre-native (~20 min, needs cmake/ninja/bazelisk). This is a friction point for contributors making Kotlin-only changes.
Solution
Add a
prebuiltJniVersionGradle property. When set, the build downloads the pre-builtmaplibre-native-bindings-jniartifact from Maven Central instead of compiling the C++ submodule.Usage — add to your
~/.gradle/gradle.properties:Then
./gradlew :demo-app:runworks without any C++ toolchain.Changes
settings.gradle.kts: conditionally excludes:lib:maplibre-native-bindings-jniwhenprebuiltJniVersionis setlib/maplibre-native-bindings/build.gradle.kts: makes the KSP header output path conditional — writes to own build dir in prebuilt mode (no C++ compilation), or to the jni project build dir in source mode (current behavior)demo-app/build.gradle.kts: switches theruntimeOnlydependency betweenproject(...)and Maven coordinates based on the property; emits alogger.warnin prebuilt mode as an ABI safety remindergradle.properties: documents the option with a commented-out exampleSafety
Prebuilt mode is only safe when your changes are outside
lib/maplibre-native-bindingsandlib/maplibre-native-bindings-jni(i.e., no JNI interface changes). The build emits a warning to that effect. The property is intentionally documented as a personal~/.gradle/gradle.propertiessetting to avoid it being accidentally committed.