Skip to content

Commit 0d562c7

Browse files
committed
build: migrate to AGP 9 and built-in Kotlin support
1 parent 047392c commit 0d562c7

7 files changed

Lines changed: 59 additions & 57 deletions

File tree

gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,4 @@ android.uniquePackageNames=false
4242
android.dependency.useConstraints=true
4343
android.r8.strictFullModeForKeepRules=false
4444
android.r8.optimizedResourceShrinking=false
45-
android.builtInKotlin=false
46-
android.newDsl=false
45+

gradle/libs.versions.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33

44
[versions]
55
# Base
6-
androidCompileSdk = "36"
6+
androidCompileSdk = "37"
77
androidMinSdk = "23"
8-
androidTargetSdk = "36"
8+
androidTargetSdk = "37"
99

10-
agp = "9.1.0"
11-
dokka = "2.1.0"
10+
agp = "9.2.1"
11+
dokka = "2.2.0"
1212
gradleMavenPublishPlugin = "0.36.0"
13-
kotlin = "2.3.10"
13+
kotlin = "2.3.21"
1414
kotlinxCoroutines = "1.10.2"
1515

1616
# Android
1717
activitycompose = "1.13.0"
1818
androidx-core = "1.18.0"
1919
androidx-startup = "1.2.0"
20-
compose-bom = "2026.03.00"
20+
compose-bom = "2026.05.00"
2121
constraintlayout = "2.2.1"
2222

2323
# Material
@@ -40,7 +40,7 @@ mockk = "1.14.9"
4040
org-jacoco-core = "0.8.14"
4141
jacoco-plugin = "0.2.1"
4242
robolectric = "4.16.1"
43-
screenshot = "0.0.1-alpha13"
43+
screenshot = "0.0.1-alpha14"
4444
truth = "1.4.5"
4545

4646
[libraries]
@@ -85,7 +85,6 @@ jacoco-android-plugin = { module = "com.mxalbert.gradle:jacoco-android", version
8585
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }
8686
leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanaryAndroid" }
8787
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
88-
#mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockkAndroid" }
8988
mockk-android = { group = "io.mockk", name = "mockk-android", version.ref = "mockk" }
9089
org-jacoco-core = { module = "org.jacoco:org.jacoco.core", version.ref = "org-jacoco-core" }
9190
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }

maps-app/build.gradle.kts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1818

1919
plugins {
2020
id("com.android.application")
21-
id("kotlin-android")
2221
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
2322
alias(libs.plugins.compose.compiler)
2423
alias(libs.plugins.screenshot)
@@ -63,22 +62,9 @@ android {
6362
compose = true
6463
}
6564

66-
kotlin {
67-
compilerOptions {
68-
jvmTarget.set(JvmTarget.JVM_1_8)
69-
freeCompilerArgs.addAll(
70-
"-opt-in=kotlin.RequiresOptIn"
71-
)
72-
}
73-
}
74-
65+
@Suppress("UnstableApiUsage")
7566
experimentalProperties["android.experimental.enableScreenshotTest"] = true
7667

77-
screenshotTests {
78-
imageDifferenceThreshold = 0.035f // 3.5%
79-
}
80-
81-
8268
packaging {
8369
resources {
8470
pickFirsts += listOf(
@@ -89,6 +75,19 @@ android {
8975
}
9076
}
9177

78+
kotlin {
79+
compilerOptions {
80+
jvmTarget.set(JvmTarget.JVM_1_8)
81+
freeCompilerArgs.addAll(
82+
"-opt-in=kotlin.RequiresOptIn"
83+
)
84+
}
85+
}
86+
87+
screenshotTests {
88+
imageDifferenceThreshold = 0.035f // 3.5%
89+
}
90+
9291
dependencies {
9392
implementation(platform(libs.androidx.compose.bom))
9493
implementation(libs.androidx.activity.compose)

maps-compose-utils/build.gradle.kts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1818

1919
plugins {
20-
id("kotlin-android")
2120
alias(libs.plugins.compose.compiler)
2221
id("android.maps.compose.PublishingConventionPlugin")
2322
id("org.jetbrains.dokka")
@@ -45,16 +44,6 @@ android {
4544
compose = true
4645
}
4746

48-
kotlin {
49-
compilerOptions {
50-
jvmTarget.set(JvmTarget.JVM_1_8)
51-
freeCompilerArgs.addAll(
52-
"-Xexplicit-api=strict",
53-
"-opt-in=kotlin.RequiresOptIn"
54-
)
55-
}
56-
}
57-
5847
buildTypes {
5948
getByName("debug") {
6049
enableUnitTestCoverage = true
@@ -63,6 +52,16 @@ android {
6352
}
6453
}
6554

55+
kotlin {
56+
compilerOptions {
57+
jvmTarget.set(JvmTarget.JVM_1_8)
58+
freeCompilerArgs.addAll(
59+
"-Xexplicit-api=strict",
60+
"-opt-in=kotlin.RequiresOptIn"
61+
)
62+
}
63+
}
64+
6665
composeCompiler {
6766
stabilityConfigurationFiles.set(
6867
listOf(rootProject.layout.projectDirectory.file("compose_compiler_stability_config.conf"))

maps-compose-widgets/build.gradle.kts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1818

1919
plugins {
20-
id("kotlin-android")
2120
alias (libs.plugins.compose.compiler)
2221
id("android.maps.compose.PublishingConventionPlugin")
2322
id("org.jetbrains.dokka")
@@ -53,16 +52,6 @@ android {
5352
compose = true
5453
}
5554

56-
kotlin {
57-
compilerOptions {
58-
jvmTarget.set(JvmTarget.JVM_1_8)
59-
freeCompilerArgs.addAll(
60-
"-Xexplicit-api=strict",
61-
"-opt-in=kotlin.RequiresOptIn"
62-
)
63-
}
64-
}
65-
6655
buildTypes {
6756
getByName("debug") {
6857
enableUnitTestCoverage = true
@@ -71,6 +60,16 @@ android {
7160
}
7261
}
7362

63+
kotlin {
64+
compilerOptions {
65+
jvmTarget.set(JvmTarget.JVM_1_8)
66+
freeCompilerArgs.addAll(
67+
"-Xexplicit-api=strict",
68+
"-opt-in=kotlin.RequiresOptIn"
69+
)
70+
}
71+
}
72+
7473
composeCompiler {
7574
stabilityConfigurationFiles.set(
7675
listOf(rootProject.layout.projectDirectory.file("compose_compiler_stability_config.conf"))

maps-compose/build.gradle.kts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1818

1919
plugins {
20-
id("org.jetbrains.kotlin.android")
2120
alias(libs.plugins.compose.compiler)
2221
id("org.jetbrains.dokka")
2322
id("android.maps.compose.PublishingConventionPlugin")
@@ -45,18 +44,13 @@ android {
4544
compose = true
4645
}
4746

48-
kotlin {
49-
compilerOptions {
50-
jvmTarget.set(JvmTarget.JVM_1_8)
51-
freeCompilerArgs.addAll(
52-
"-Xexplicit-api=strict",
53-
"-opt-in=kotlin.RequiresOptIn"
54-
)
47+
sourceSets {
48+
getByName("main") {
49+
java.directories.add("build/generated/source/artifactId")
50+
kotlin.directories.add("build/generated/source/artifactId")
5551
}
5652
}
5753

58-
sourceSets["main"].java.srcDir("build/generated/source/artifactId")
59-
6054
buildTypes {
6155
getByName("debug") {
6256
enableUnitTestCoverage = true
@@ -65,6 +59,16 @@ android {
6559
}
6660
}
6761

62+
kotlin {
63+
compilerOptions {
64+
jvmTarget.set(JvmTarget.JVM_1_8)
65+
freeCompilerArgs.addAll(
66+
"-Xexplicit-api=strict",
67+
"-opt-in=kotlin.RequiresOptIn"
68+
)
69+
}
70+
}
71+
6872
composeCompiler {
6973
stabilityConfigurationFiles.set(
7074
listOf(rootProject.layout.projectDirectory.file("compose_compiler_stability_config.conf"))

settings.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ pluginManagement {
2929
gradlePluginPortal()
3030
}
3131
}
32+
plugins {
33+
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
34+
}
3235
rootProject.name = "android-maps-compose"
3336

3437
include(":maps-app")

0 commit comments

Comments
 (0)