-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
201 lines (174 loc) · 7.17 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
201 lines (174 loc) · 7.17 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.compose)
id("org.jlleitschuh.gradle.ktlint") version "14.2.0"
id("maven-publish")
id("signing")
id("com.gradleup.nmcp") version "1.5.0"
}
ktlint {
android.set(true)
reporters {
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE)
}
}
// ドライバー実装点(@InternalMapConductorApi)を使うためのオプトイン。
// android-for-* は地図SDKドライバーなので、モジュール単位で許可する。
kotlin {
compilerOptions {
optIn.add("com.mapconductor.core.InternalMapConductorApi")
}
}
android {
namespace = "com.mapconductor.googlemaps"
compileSdk = project.property("compileSdk").toString().toInt()
defaultConfig {
minSdk = project.property("minSdk").toString().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
aarMetadata {
minCompileSdk = project.property("compileSdk").toString().toInt()
}
}
buildFeatures {
compose = true
}
buildTypes {
debug {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.toVersion(project.property("javaVersion").toString())
targetCompatibility = JavaVersion.toVersion(project.property("javaVersion").toString())
}
publishing {
singleVariant("release") {
withSourcesJar()
}
}
}
// Publishing configuration
val libraryGroupId = project.findProperty("libraryGroupId") as String? ?: "com.mapconductor"
val libraryArtifactId = "for-googlemaps"
val libraryVersion = project.findProperty("libraryVersion") as String? ?: "1.0.0"
dependencies {
implementation(platform(libs.androidx.compose.bom)) // BOM manages Compose artifact versions.
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.ui)
implementation(libs.androidx.foundation)
compileOnly(libs.androidx.ui.tooling.preview)
implementation(libs.okhttp)
// Lifecycle(MapView用)
// BOM管理の依存関係はPOMにバージョンが出力されないためMaven Central検証エラーになる
// BOMと同じバージョンを明示することで解決
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.common.java8)
// CancellableContinuation.resume の 3 引数 onCancellation は coroutines 1.9 以降。
// 明示しないと推移的に 1.7.3 が入り、単体ビルドだけがコンパイルエラーになる
// (集約ビルドの catalog は 1.9.0 を指しているので気づけない)。
implementation(libs.kotlinx.coroutines.android)
// Google Maps SDK
api(libs.play.services.maps)
if (findProject(":android-sdk-compose") != null) {
api(project(":android-sdk-compose"))
} else {
api("com.mapconductor:compose:$libraryVersion")
}
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
// Set project version for NMCP plugin
version = libraryVersion
val libraryName = "MapConductor for Google Maps"
val libraryDescription = "Google Maps implementation for MapConductor unified mapping library"
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
afterEvaluate {
publishing {
publications {
create<MavenPublication>("release") {
from(components["release"])
groupId = libraryGroupId
artifactId = libraryArtifactId
version = libraryVersion
artifact(javadocJar.get())
pom {
name.set(libraryName)
description.set(libraryDescription)
url.set(
project.findProperty("libraryUrl") as String?
?: "https://github.com/MapConductor/android-for-googlemaps",
)
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set(project.findProperty("developerId") as String? ?: "mapconductor")
name.set(project.findProperty("developerName") as String? ?: "MapConductor Team")
email.set(project.findProperty("developerEmail") as String? ?: "info@mkgeeklab.com")
}
}
scm {
connection.set("scm:git:git://github.com/MapConductor/android-for-googlemaps.git")
developerConnection
.set("scm:git:ssh://github.com:MapConductor/android-for-googlemaps.git")
url.set(
project.findProperty("scmUrl") as String?
?: "https://github.com/MapConductor/android-for-googlemaps.git",
)
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
setUrl("https://maven.pkg.github.com/MapConductor/android-for-googlemaps")
credentials {
username =
project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USER")
?: System.getenv("GITHUB_ACTOR")
password =
project.findProperty("gpr.key") as String? ?: System.getenv("GPR_TOKEN")
?: System.getenv("GITHUB_TOKEN")
}
}
}
}
signing {
val signingKey = findProperty("signingKey") as String?
val signingPassword = findProperty("signingPassword") as String?
if (!signingKey.isNullOrEmpty() && !signingPassword.isNullOrEmpty()) {
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["release"])
}
}
if (project == rootProject) {
// standalone build only — in multi-project (android-sdk), parent configures nmcp
nmcp {
publishAllPublicationsToCentralPortal {
username.set(findProperty("ossrh_username") as String? ?: System.getenv("OSSRH_USERNAME") ?: "")
password.set(findProperty("ossrh_password") as String? ?: System.getenv("OSSRH_PASSWORD") ?: "")
}
}
}
}