-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
124 lines (109 loc) · 4.47 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
124 lines (109 loc) · 4.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// 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
//
// https://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.
buildscript {
val kotlinVersion = "2.3.20"
repositories {
google()
mavenCentral()
// Only needed to resolve ktfmt below (development/CI-only, gated by -Pktfmt).
if (providers.gradleProperty("ktfmt").isPresent) {
maven { url = uri("https://plugins.gradle.org/m2/") }
}
}
dependencies {
classpath("com.android.tools.build:gradle:8.8.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
// ktfmt (Kotlin formatter) is a development/CI-only tool. Pulling it onto the classpath
// (and applying it below) is gated behind -Pktfmt so it is never forced on apps that
// depend on this plugin. Enabled by `melos run format:android`.
if (providers.gradleProperty("ktfmt").isPresent) {
classpath("com.ncorti.ktfmt.gradle:plugin:0.21.0")
}
}
}
plugins {
id("com.android.library")
}
group = "com.google.maps.flutter.driver"
version = "1.0-SNAPSHOT"
allprojects {
repositories {
google()
mavenCentral()
}
}
// Apply the Kotlin Gradle Plugin (KGP) only when consumed by AGP < 9. AGP 9+ ships built-in Kotlin,
// so applying KGP there is unnecessary and triggers a Flutter deprecation warning. Keeping it
// conditional preserves compatibility for apps still on AGP 8.
// https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors#supporting-flutter-versions-earlier-than-3-44
val agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.substringBefore('.').toInt()
if (agpMajor < 9) {
apply(plugin = "org.jetbrains.kotlin.android")
}
// ktfmt is applied only for development/CI formatting (-Pktfmt), so it is never forced on apps
// that depend on this plugin. Run via `melos run format:android` (which passes -Pktfmt).
if (providers.gradleProperty("ktfmt").isPresent) {
apply(plugin = "com.ncorti.ktfmt.gradle")
// Configured dynamically (no compile-time type reference) so this script still compiles when
// ktfmt is absent from the classpath, i.e. for apps that depend on this plugin.
extensions.getByName("ktfmt").withGroovyBuilder { "googleStyle"() }
}
android {
namespace = "com.google.maps.flutter.driver"
compileSdk = 36
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
sourceSets {
getByName("main") {
java.srcDirs("src/main/kotlin")
}
getByName("test") {
java.srcDirs("src/test/kotlin")
}
}
defaultConfig {
minSdk = 26
}
testOptions {
unitTests {
isIncludeAndroidResources = true
all {
it.testLogging {
events("passed", "skipped", "failed", "standardOut", "standardError")
showStandardStreams = true
}
it.outputs.upToDateWhen { false }
}
}
}
}
// Configure the Kotlin JVM target via the compilerOptions DSL (replaces the deprecated
// android.kotlinOptions block). Configured through the extension so it works whether the Kotlin
// plugin is applied conditionally (AGP < 9) or provided by AGP's built-in Kotlin (AGP 9+). The
// static `kotlin { }` accessor is not generated for imperatively-applied plugins.
project.extensions.configure(org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension::class.java) {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
dependencies {
implementation("com.google.android.libraries.mapsplatform.transportation:transportation-driver:7.0.0")
implementation("androidx.startup:startup-runtime:1.2.0")
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("io.mockk:mockk:1.14.11")
testImplementation("junit:junit:4.13.2")
testImplementation("org.robolectric:robolectric:4.11.1")
}