Skip to content

chore: enable Kotlin explicitApi() and Binary Compatibility Validator (.api dumps) - #1800

Merged
dkhawk merged 2 commits into
feat/migrate-ktx-to-utilsfrom
chore/explicit-api-and-bcv
Sep 30, 2026
Merged

dkhawk merged 2 commits into
feat/migrate-ktx-to-utilsfrom
chore/explicit-api-and-bcv

Conversation

@dkhawk

@dkhawk dkhawk commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Addresses #1794 in a stacked PR on top of #1716 (feat/migrate-ktx-to-utils).

Summary of Changes

  1. Enable Kotlin Explicit API Mode:

    • Configured kotlin { explicitApi() } in library/build.gradle.kts, clustering/build.gradle.kts, data/build.gradle.kts, heatmaps/build.gradle.kts, and ui/build.gradle.kts.
    • Updated all existing Kotlin source declarations with explicit visibility modifiers and explicit return types across all 5 published library modules.
  2. Configure Binary Compatibility Validator (BCV):

    • Wired BCV v0.18.2 in build-logic/convention/src/main/kotlin/PublishingConventionPlugin.kt and root build.gradle.kts to support AGP 9.3 compiled release classes (bundleLibCompileToJarRelease / classes.jar).
    • Registered apiBuild, apiDump, and apiCheck tasks per library module with R and BuildConfig exclusion filters.
    • Registered aggregate apiDump and apiCheck verification tasks on root project and wired check to depend on apiCheck.
  3. Baseline .api Dumps:

    • Generated and committed baseline public API dumps for:
      • library/api/library.api
      • clustering/api/clustering.api
      • data/api/data.api
      • heatmaps/api/heatmaps.api
      • ui/api/ui.api
  4. CI Workflow:

    • Added apiCheck to the PR test workflow in .github/workflows/test.yml.

Fixes #1794

@dkhawk
dkhawk requested a review from LoyalAbbas September 30, 2026 03:21
@googlemaps-bot

googlemaps-bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 56.94% -1.77% 🍏
Files changed 66.62% 🍏

Module Coverage
Kover Gradle Plugin XML report for :library 89.59% -0.14% 🍏
Kover Gradle Plugin XML report for :heatmaps 88.62% -0.44% 🍏
Kover Gradle Plugin XML report for :ui 80.78% 🍏
Kover Gradle Plugin XML report for :data 54.29% -3.01% 🍏
Kover Gradle Plugin XML report for :clustering 33.26% -0.68% 🍏
Files
Module File Coverage
Kover Gradle Plugin XML report for :library StreetViewJavaHelper.kt 100% 🍏
MathUtil.kt 100% 🍏
SphericalUtil.kt 99.71% 🍏
PolyUtil.kt 99.37% 🍏
FlexiblePolyline.kt 97.81% 🍏
MapObjectManager.kt 94.05% 🍏
MarkerManager.kt 91.98% 🍏
PolygonManager.kt 87.84% 🍏
CircleManager.kt 87.84% 🍏
GroundOverlayManager.kt 87.84% 🍏
PolylineManager.kt 87.84% 🍏
StreetViewUtil.kt 34.02% -3.73% ❌
Kover Gradle Plugin XML report for :heatmaps WeightedLatLng.kt 100% 🍏
HeatmapTileProvider.kt 92.61% 🍏
Gradient.kt 88.4% -1.9% 🍏
Kover Gradle Plugin XML report for :ui AnimationUtil.kt 92.7% 🍏
IconGenerator.kt 90.34% 🍏
RotationLayout.kt 88.97% 🍏
SquareTextView.kt 0% 🍏
Kover Gradle Plugin XML report for :data GroundOverlay.kt 100% 🍏
Point.kt 100% 🍏
Feature.kt 100% 🍏
GroundOverlayStyle.kt 100% 🍏
Geometry.kt 100% 🍏
GeoJsonObjects.kt 96.92% 🍏
LatLngAlt.kt 91.67% 🍏
KmlParser.kt 90.53% -5.33% ❌
GeoJsonParser.kt 89.39% -1.4% ❌
GpxParser.kt 88.68% -8.49% ❌
KmzParser.kt 87.85% -0.4% 🍏
KmlMapper.kt 87.53% 🍏
DataLayer.kt 87.35% 🍏
Layer.kt 86.05% 🍏
MapViewRenderer.kt 76.13% 🍏
GpxMapper.kt 69.05% -3.4% ❌
GeoJsonMapper.kt 56.42% 🍏
GeoJsonPolygon.kt 56.25% -2.5% 🍏
KmlModel.kt 53.36% -0.6% 🍏
GpxModel.kt 52.22% -1.37% 🍏
DataScene.kt 52.22% -17.78% ❌
Style.kt 51.22% 🍏
UrlIconProvider.kt 48.9% 🍏
GeoJsonPointStyle.kt 35.52% 🍏
KmlPolygon.kt 32.22% -3.33% 🍏
GeoJsonLineStringStyle.kt 22.51% 🍏
GeoJsonPolygonStyle.kt 21.43% 🍏
KmlStyle.kt 8.48% 🍏
GoogleMapRenderer.kt 0.76% -0.96% ❌
DataLayerLoader.kt 0% 🍏
Model.kt 0% ❌
MapObject.kt 0% 🍏
Polyline.kt 0% -99.13% ❌
Layer.kt 0% -18.75% ❌
Marker.kt 0% -99.16% ❌
Circle.kt 0% -98.85% ❌
Polygon.kt 0% -94.87% ❌
Kover Gradle Plugin XML report for :clustering SphericalMercatorProjection.kt 100% 🍏
CentroidNonHierarchicalDistanceBasedAlgorithm.kt 100% 🍏
NonHierarchicalViewBasedAlgorithm.kt 100% 🍏
AbstractAlgorithm.kt 100% 🍏
ScreenBasedAlgorithmAdapter.kt 100% 🍏
GridBasedAlgorithm.kt 100% 🍏
PreCachingAlgorithmDecorator.kt 100% 🍏
StaticCluster.kt 100% 🍏
Bounds.kt 100% 🍏
ContinuousZoomEuclideanCentroidAlgorithm.kt 99.63% 🍏
NonHierarchicalDistanceBasedAlgorithm.kt 99.48% 🍏
Point.kt 94.87% 🍏
PointQuadTree.kt 94.71% 🍏
ClusterManager.kt 71.59% 🍏
DefaultClusterRenderer.kt 17.25% -0.83% ❌
ClusterRendererMultipleItems.kt 0.15% -0.96% ❌
DefaultAdvancedMarkersClusterRenderer.kt 0% -1.2% ❌

@dkhawk
dkhawk marked this pull request as ready for review September 30, 2026 16:40
@dkhawk
dkhawk requested a review from a team as a code owner September 30, 2026 16:40
@dkhawk
dkhawk force-pushed the feat/migrate-ktx-to-utils branch from e7d9d13 to 7dbc806 Compare September 30, 2026 16:43
@dkhawk
dkhawk requested review from kikoso and removed request for LoyalAbbas September 30, 2026 16:50

@kikoso kikoso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@dkhawk , there is one comment to check

Comment thread library/src/main/java/com/google/maps/android/StreetViewUtil.kt Outdated
… (.api dumps)

- Enable kotlin explicitApi() across published modules (:library, :clustering, :data, :heatmaps, :ui)
- Add explicit public visibility and return types to all public Kotlin symbols across modules
- Configure Binary Compatibility Validator (BCV) for AGP 9.3 via build-logic convention plugin and root aggregate tasks
- Generate and commit baseline .api dumps for :library, :clustering, :data, :heatmaps, and :ui
- Add apiCheck to the CI Pull Request test workflow

Fixes #1794
@dkhawk
dkhawk force-pushed the chore/explicit-api-and-bcv branch from 867b01b to 02ca069 Compare September 30, 2026 22:36
@dkhawk
dkhawk requested a review from kikoso September 30, 2026 22:39
@dkhawk
dkhawk merged commit e8be5af into feat/migrate-ktx-to-utils Sep 30, 2026
5 checks passed
@dkhawk
dkhawk deleted the chore/explicit-api-and-bcv branch September 30, 2026 22:53
dkhawk added a commit that referenced this pull request Sep 30, 2026
* feat: migrate android-maps-ktx into android-maps-utils (v6.0.0-rc01) (#1716)

- Consolidate Kotlin Extensions (KTX into Utils): Move all reactive Coroutine/Flow extensions (awaitMap, mapClickEvents, cameraMoveEvents) and option builder DSLs (addMarker, addPolyline, addPolygon) from android-maps-ktx directly into android-maps-utils.

- Canonical Non-KTX Packages: Place all reactive Coroutine/Flow extensions and DSL builders in canonical com.google.maps.android.* packages.

- Deprecated Compatibility Layer: Preserve the legacy com.google.maps.android.ktx.* package structure with @deprecated(level = DeprecationLevel.WARNING, replaceWith = ReplaceWith(...)) forwarding wrappers and typealiases so existing imports compile seamlessly with deprecation warnings.

- Multi-Module Integration: Integrate KTX extensions across :library, :clustering, :heatmaps, and :data modules.

- Demo & Test Consolidation: Include KtxExtensionsDemoActivity in :demo and integrate all 18 KTX unit test suites with both canonical and shim test coverage.

* feat: port Maps SDK coroutine initialization extension from android-maps-ktx

- Add canonical Context.awaitMapsSdkInitialized(preferredRenderer) suspending extension in com.google.maps.android.
- Add deprecated backward-compatibility shim in com.google.maps.android.ktx.
- Add canonical and shim unit test suites for MapsInitializer coroutine extensions.
- Showcase awaitMapsSdkInitialized in KtxExtensionsDemoActivity and register demo in MainActivity.
- Update README.md documentation with awaitMapsSdkInitialized usage example.

* chore: release v6.0.0-rc01

* chore: release v6.0.0-rc02

* fix: resolve lint test SDK requirement and configure isolated test home for unit tests

* chore: release v6.0.0-rc03

* chore: prepare v6.0.0 final release

* build(deps): update dependencies for v6.0.0 release

* refactor: address review comments on coroutines, inlining, and file structure

* chore: release v6.0.0-rc04

* chore: align release-please version baseline with main for v6.0.0 release

* fix: harden coroutine continuations, remove FQCNs/wildcard imports, and add adversarial tests

* fix: address all remaining PR review comments from LoyalAbbas and kikoso

* fix: add R8 consumer rules for optional location and Navigation SDK dependencies

* fix(location): remove PASSIVE_PROVIDER fallback and guard missing providers

* fix: resolve 10 defects uncovered by Android Maps Testing Toolkit (#1795)

* fix: resolve 10 defects uncovered by Android Maps Testing Toolkit

Fixes 10 production issues across `:data`, `:heatmaps`, `:clustering`,
`:library`, and `:ui` uncovered by deterministic JVM and visual testing
with Android Maps Testing Toolkit v1.1.0-rc01:

1. `:data` (`KmlLayer`): Cache `KmlGroundOverlay -> ModelFeature` in
   `mGroundOverlayMap` so `removeLayerFromMap()` removes ground overlays
   from `MapViewRenderer`'s `IdentityHashMap` instead of leaking them.
2. `:data` (`Style`, `MapViewRenderer`, `GeoJsonLayer`, `KmlLayer`):
   Propagate `clickable` (defaulting to `true`) and `visible` to
   `PolylineOptions` and `PolygonOptions` so GeoJSON and KML polygons
   and polylines dispatch `OnFeatureClickListener` callbacks.
3. `:data` (`GeoJsonLayer`, `KmlLayer`, `MapViewRenderer`): Route
   markers, polygons, polylines, and ground overlays through passed-in
   `MarkerManager`, `PolygonManager`, `PolylineManager`, and
   `GroundOverlayManager` collections when provided, and register click
   listeners on those collections instead of clobbering global
   `GoogleMap` click listeners.
4. `:data` (`KmlLayer`, `GeoJsonLayer`, `Style`, `MapViewRenderer`):
   Aggregate placemarks and ground overlays from `<Document>` containers
   in `hasPlacemarks()`, `getPlacemarks()`, `features`, and
   `getGroundOverlays()`, and preserve styles on `MultiGeometry`
   features via `CompositeStyle`.
5. `:data` (`GeoJsonLayer`, `Style`, `MapViewRenderer`): Propagate
   `GeoJsonPointStyle` `title`, `snippet`, `isDraggable`, `isFlat`,
   `isVisible`, `infoWindowAnchorU/V`, and custom `icon` (`BitmapDescriptor`)
   to `MarkerOptions` and `AdvancedMarkerOptions`.
6. `:heatmaps` (`HeatmapTileProvider`): Clamp `zoom` when indexing
   `maxIntensity` (preventing `ArrayIndexOutOfBoundsException` at zoom
   level 22) and clamp `bucketX`/`bucketY` to `0 until gridDim` so points
   on the inclusive upper boundary `maxX`/`maxY` do not throw
   `ArrayIndexOutOfBoundsException`.
7. `:heatmaps` (`HeatmapTileProvider`): Check `&& wrappedPoints.isEmpty()`
   before returning `TileProvider.NO_TILE` so cross-antimeridian points
   render across the International Date Line, and enforce `MIN_RADIUS..MAX_RADIUS`
   and `0.0..1.0` bounds validation in `setRadius` and `setOpacity`.
8. `:clustering` (`DefaultClusterRenderer`): Clear stale `marker.title`
   and `marker.snippet` when a `ClusterItem`'s title/snippet is updated
   to `null`, and update `marker.zIndex` in `onClusterItemUpdated` even
   when `position` is unchanged.
9. `:library` (`MapObjectManager`): Invoke `setListenersOnUiThread()`
   synchronously when constructed on the main thread instead of
   unconditionally posting to the back of the main looper queue.
10. `:ui` (`AnimationUtil`, `IconGenerator`, `RotationLayout`): Snap
    directly to `finalPosition` when `durationInMs <= 0L` (avoiding
    `0 / 0.0f = NaN`), clamp `t` to `[0f, 1f]` so
    `AccelerateDecelerateInterpolator` never rebounds on frame overshoot,
    and use `degrees.mod(360)` so negative multi-turn rotations do not
    throw `IllegalStateException`.

* fix: address PR review comments on layer managers, KML accessors, Style, and cluster renderers

* chore: enable Kotlin explicitApi() and Binary Compatibility Validator (.api dumps) (#1800)

* chore: enable Kotlin explicitApi() and Binary Compatibility Validator (.api dumps)

- Enable kotlin explicitApi() across published modules (:library, :clustering, :data, :heatmaps, :ui)
- Add explicit public visibility and return types to all public Kotlin symbols across modules
- Configure Binary Compatibility Validator (BCV) for AGP 9.3 via build-logic convention plugin and root aggregate tasks
- Generate and commit baseline .api dumps for :library, :clustering, :data, :heatmaps, and :ui
- Add apiCheck to the CI Pull Request test workflow

Fixes #1794

* fix: restore public visibility on ResponseStreetView and update library.api
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.

3 participants