-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
181 lines (158 loc) · 6.39 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
181 lines (158 loc) · 6.39 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
plugins {
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.android.library)
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)
}
}
android {
namespace = "com.mapconductor.core"
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()
}
}
}
dependencies {
// Make Compose dependencies implementation instead of compileOnly for proper runtime support
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
compileOnly(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.foundation)
// Core dependencies - use api to avoid version conflicts
implementation(libs.androidx.core.ktx)
// Lifecycle(MapView用)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.common.java8)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
// Publishing configuration
val libraryGroupId = project.findProperty("libraryGroupId") as String? ?: "com.mapconductor"
val libraryArtifactId = "core"
val libraryVersion = project.findProperty("libraryVersion") as String? ?: "1.0.0"
// Set project version for NMCP plugin
version = libraryVersion
val libraryName = "MapConductor Core"
val libraryDescription = "Core abstractions and shared functionality for MapConductor unified mapping library"
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
// Since Android libraries don't have javadoc task by default, create empty jar
}
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-sdk-core",
)
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-sdk-core.git")
developerConnection
.set("scm:git:ssh://github.com:MapConductor/android-sdk-core.git")
url.set(
project.findProperty("scmUrl") as String?
?: "https://github.com/MapConductor/android-sdk-core.git",
)
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
setUrl("https://maven.pkg.github.com/MapConductor/android-sdk-core")
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")
}
}
// Central Portal publishing is handled by nmcp plugin, no manual repository needed
}
}
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") ?: "")
}
}
}
}