Repository navigation
feat: experimental Kotlin Multiplatform support (clustering, library, heatmaps) #1774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kikoso
wants to merge
14
commits into
main
Choose a base branch
from
feat/experimental-kmp-clustering
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
85db3ab
feat: experimental KMP support for clustering module
kikoso e75f03e
feat: enable mavenLocal publishing of KMP modules and bump AGP to 9.4.0
kikoso 4526aab
fix: publish KMP modules under public android-maps-utils artifactIds
kikoso 56aab16
feat: migrate library and heatmaps modules to Kotlin Multiplatform
kikoso deb93a2
ci: lint remaining Android modules instead of the KMP library module
kikoso 2e45ae0
Merge main (6.0.0) into the Kotlin Multiplatform branch
kikoso e69e76a
ci: publish from macOS and add a snapshot publishing workflow
kikoso 7536f63
ci: lint the library module again now that it has lint tasks
kikoso 2b11b26
docs: describe the experimental Kotlin Multiplatform modules
kikoso 0a43d0c
fix: give the iOS CameraPosition value equality
kikoso e959ae0
fix: keep synchronized(mQuadTree) working for algorithm subclasses
kikoso af0ae4d
Merge remote-tracking branch 'origin/main' into feat/experimental-kmp…
kikoso f9a38c4
feat(location): add multiplatform Location, LocationSource, and iOS C…
dkhawk f080700
Merge remote-tracking branch 'origin/main' into feat/experimental-kmp…
kikoso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
146 changes: 146 additions & 0 deletions
146
build-logic/convention/src/main/kotlin/KmpPublishingConventionPlugin.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import com.android.build.api.dsl.Lint | ||
| import com.vanniktech.maven.publish.JavadocJar | ||
| import com.vanniktech.maven.publish.KotlinMultiplatform | ||
| import com.vanniktech.maven.publish.MavenPublishBaseExtension | ||
| import com.vanniktech.maven.publish.SourcesJar | ||
| import kotlinx.kover.gradle.plugin.dsl.KoverProjectExtension | ||
| import kotlinx.validation.KotlinApiBuildTask | ||
| import kotlinx.validation.KotlinApiCompareTask | ||
| import org.gradle.api.Plugin | ||
| import org.gradle.api.Project | ||
| import org.gradle.api.tasks.Copy | ||
| import org.gradle.kotlin.dsl.apply | ||
| import org.gradle.kotlin.dsl.configure | ||
| import org.gradle.kotlin.dsl.register | ||
| import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
|
|
||
| /** | ||
| * Convention for the Kotlin Multiplatform library modules (Android plus iOS). | ||
| * | ||
| * Mirrors [PublishingConventionPlugin] for the Android-only modules: explicit API mode, Kover, | ||
| * Dokka and Maven Central publishing under the same artifactIds and POM. Each module still | ||
| * configures its own `androidLibrary { }` target (namespace, SDK levels) and source sets. | ||
| * | ||
| * The binary compatibility validator only checks the iOS klib ABI of these modules | ||
| * (`api/<module>.klib.api`). The Android API is checked here against the same | ||
| * `api/<module>.api` file the module had before it became multiplatform, so moving to KMP | ||
| * cannot change the Android API without the check failing. | ||
| */ | ||
| class KmpPublishingConventionPlugin : Plugin<Project> { | ||
| override fun apply(project: Project) { | ||
| project.run { | ||
| apply(plugin = "org.jetbrains.kotlin.multiplatform") | ||
| apply(plugin = "com.android.kotlin.multiplatform.library") | ||
| // Multiplatform Android libraries only get lint tasks from the standalone lint plugin. | ||
| apply(plugin = "com.android.lint") | ||
| apply(plugin = "org.jetbrains.kotlinx.kover") | ||
| apply(plugin = "org.jetbrains.dokka") | ||
| apply(plugin = "com.vanniktech.maven.publish") | ||
|
|
||
| configure<KotlinMultiplatformExtension> { | ||
| explicitApi() | ||
| jvmToolchain(17) | ||
| iosArm64() | ||
| iosSimulatorArm64() | ||
| iosX64() | ||
| } | ||
|
|
||
| configure<Lint> { | ||
| sarifOutput = layout.buildDirectory.file("reports/lint-results.sarif").get().asFile | ||
| } | ||
|
|
||
| configure<KoverProjectExtension> { | ||
| // CI and the coverage history read koverXmlReportDebug / reportDebug.xml, which | ||
| // the Android-only modules produce. Expose the KMP Android coverage the same way. | ||
| currentProject { | ||
| createVariant("debug") { | ||
| add("android") | ||
| } | ||
| } | ||
| reports { | ||
| filters { | ||
| excludes { | ||
| androidGeneratedClasses() | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| configure<MavenPublishBaseExtension> { | ||
| configure( | ||
| KotlinMultiplatform( | ||
| javadocJar = JavadocJar.Dokka("dokkaGeneratePublicationHtml"), | ||
| sourcesJar = SourcesJar.Sources(), | ||
| ), | ||
| ) | ||
| configureMapsUtilsPublishing(project) | ||
| } | ||
|
|
||
| configureAndroidApiValidation() | ||
| } | ||
| } | ||
|
|
||
| private fun Project.configureAndroidApiValidation() { | ||
| val projectName = name | ||
| val apiFile = layout.projectDirectory.file("api/$projectName.api") | ||
| val buildApiFile = layout.buildDirectory.file("api/android/$projectName.api") | ||
|
|
||
| afterEvaluate { | ||
| val bundleTask = tasks.findByName("bundleAndroidMainClassesToCompileJar") ?: return@afterEvaluate | ||
| val classesJar = layout.buildDirectory.file( | ||
| "intermediates/compile_library_classes_jar/androidMain/bundleAndroidMainClassesToCompileJar/classes.jar", | ||
| ) | ||
|
|
||
| val androidApiBuild = tasks.register<KotlinApiBuildTask>("androidApiBuild") { | ||
| group = "verification" | ||
| description = "Builds the public Android API declaration for $projectName." | ||
| inputJar.set(classesJar) | ||
| outputApiFile.set(buildApiFile) | ||
| ignoredClasses.addAll( | ||
| "com.google.maps.android.R", | ||
| "com.google.maps.android.BuildConfig", | ||
| "com.google.maps.android.$projectName.R", | ||
| "com.google.maps.android.$projectName.BuildConfig", | ||
| ) | ||
| dependsOn(bundleTask) | ||
| } | ||
|
|
||
| val androidApiDump = tasks.register<Copy>("androidApiDump") { | ||
| group = "verification" | ||
| description = "Syncs the public Android API declaration of $projectName to api/$projectName.api." | ||
| from(androidApiBuild.flatMap { it.outputApiFile }) | ||
| into(apiFile.asFile.parentFile) | ||
| dependsOn(androidApiBuild) | ||
| } | ||
|
|
||
| val androidApiCheck = tasks.register<KotlinApiCompareTask>("androidApiCheck") { | ||
| group = "verification" | ||
| description = | ||
| "Checks the public Android API of $projectName against the committed api/$projectName.api." | ||
| projectApiFile.set(apiFile) | ||
| generatedApiFile.set(androidApiBuild.flatMap { it.outputApiFile }) | ||
| dependsOn(androidApiBuild) | ||
| } | ||
|
|
||
| tasks.named("apiDump") { dependsOn(androidApiDump) } | ||
| tasks.named("apiCheck") { dependsOn(androidApiCheck) } | ||
| tasks.findByName("check")?.dependsOn(androidApiCheck) | ||
| } | ||
| } | ||
| } |
69 changes: 69 additions & 0 deletions
69
build-logic/convention/src/main/kotlin/MapsUtilsPublishing.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import com.vanniktech.maven.publish.MavenPublishBaseExtension | ||
| import org.gradle.api.Project | ||
|
|
||
| /** | ||
| * Publishing settings shared by the Android-only and the Kotlin Multiplatform modules: Maven | ||
| * Central, signing when keys are configured, the public artifactId scheme and the POM. | ||
| */ | ||
| internal fun MavenPublishBaseExtension.configureMapsUtilsPublishing(project: Project) { | ||
| publishToMavenCentral() | ||
| if (project.findProperty("signing.keyId")?.toString()?.isNotBlank() == true || | ||
| project.findProperty("signing.secretKeyRingFile")?.toString()?.isNotBlank() == true || | ||
| project.findProperty("signingInMemoryKey")?.toString()?.isNotBlank() == true | ||
| ) { | ||
| signAllPublications() | ||
| } | ||
|
|
||
| val artifactIdName = when (project.name) { | ||
| "maps-utils" -> "android-maps-utils" | ||
| "library" -> "android-maps-utils-core" | ||
| else -> "android-maps-utils-${project.name}" | ||
| } | ||
| coordinates( | ||
| artifactId = artifactIdName, | ||
| ) | ||
|
|
||
| pom { | ||
| name.set("android-maps-utils") | ||
| description.set("Handy extensions to the Google Maps Android API.") | ||
| url.set("https://github.com/googlemaps/android-maps-utils") | ||
| licenses { | ||
| license { | ||
| name.set("The Apache Software License, Version 2.0") | ||
| url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") | ||
| distribution.set("repo") | ||
| } | ||
| } | ||
| scm { | ||
| connection.set("scm:git@github.com:googlemaps/android-maps-utils.git") | ||
| developerConnection.set("scm:git@github.com:googlemaps/android-maps-utils.git") | ||
| url.set("https://github.com/googlemaps/android-maps-utils") | ||
| } | ||
| developers { | ||
| developer { | ||
| id.set("google") | ||
| name.set("Google LLC") | ||
| } | ||
| } | ||
| organization { | ||
| name.set("Google Inc") | ||
| url.set("http://developers.google.com/maps") | ||
| } | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.