-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
120 lines (108 loc) · 3.22 KB
/
build.gradle.kts
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
plugins {
kotlin("multiplatform")
kotlin("native.cocoapods")
id("com.android.library")
id("convention.publication")
}
group = "io.github.ltttttttttttt"
//上传到mavenCentral命令: ./gradlew publishAllPublicationsToSonatypeRepository
//mavenCentral后台: https://s01.oss.sonatype.org/#stagingRepositories
version = mVersion
kotlin {
android {
publishLibraryVariants("debug", "release")
}
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "17"
}
}
}
ios()
iosSimulatorArm64()
js(IR) {
browser()
compilations.all {
defaultSourceSet.resources.srcDir("/resources")
}
}
cocoapods {
summary = "LazyPeopleHttp"
homepage = "https://github.com/ltttttttttttt/LazyPeopleHttp"
ios.deploymentTarget = "14.1"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "LazyPeopleHttp"
isStatic = true
}
extraSpecAttributes["resources"] =
"['resources/**']"
}
sourceSets {
val commonMain by getting {
dependencies {
//协程
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
//跨平台网络请求
api("io.ktor:ktor-client-core:$ktorVersion")
//kt的跨平台json解析
api("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationJsonVersion")
//compose runtime
compileOnly("org.jetbrains.compose.runtime:runtime:1.4.0")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting{
dependencies {
//网络请求引擎
api("io.ktor:ktor-client-okhttp:$ktorVersion")
}
}
val androidUnitTest by getting
val jvmMain by getting{
dependencies {
//网络请求引擎
api("io.ktor:ktor-client-okhttp:$ktorVersion")
}
}
val jvmTest by getting
val iosMain by getting{
dependencies {
//网络请求引擎
api("io.ktor:ktor-client-darwin:$ktorVersion")
}
}
val iosTest by getting
val iosSimulatorArm64Main by getting {
dependsOn(iosMain)
}
val iosSimulatorArm64Test by getting {
dependsOn(iosTest)
}
val jsMain by getting{
dependencies {
//网络请求引擎
api("io.ktor:ktor-client-js:$ktorVersion")
}
}
}
}
android {
compileSdk = 33
defaultConfig {
minSdk = 21
targetSdk = 31
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDir("resources")
consumerProguardFiles("consumer-rules.pro")//配置库的混淆文件,会带到app中
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}