mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-25 13:03:35 +08:00
[build] Relocate ktor only for jvm, not for Android
This commit is contained in:
parent
164f621427
commit
a2d50ec03a
@ -125,6 +125,7 @@ private fun KotlinTarget.configureRelocationForMppTarget(project: Project) = pro
|
||||
// We will modify Kotlin metadata, so do generate metadata before relocation
|
||||
val generateMetadataTask =
|
||||
tasks.getByName("generateMetadataFileFor${targetName.capitalize()}Publication") as GenerateModuleMetadata
|
||||
generateMetadataTask.dependsOn(relocateDependencies)
|
||||
|
||||
val patchMetadataTask = tasks.create("patchMetadataFileFor${targetName.capitalize()}RelocatedPublication") {
|
||||
dependsOn(generateMetadataTask)
|
||||
|
@ -41,6 +41,15 @@ kotlin {
|
||||
relocateImplementation(`ktor-io_relocated`)
|
||||
}
|
||||
}
|
||||
configure(NATIVE_TARGETS.map { getByName(it + "Main") }
|
||||
+ NATIVE_TARGETS.map { getByName(it + "Test") }) {
|
||||
dependencies {
|
||||
// no relocation in native
|
||||
implementation(`ktor-io`) {
|
||||
exclude(ExcludeProperties.`slf4j-api`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val commonTest by getting {
|
||||
dependencies {
|
||||
|
@ -120,13 +120,28 @@ kotlin {
|
||||
|
||||
|
||||
// Ktor
|
||||
|
||||
findByName("commonMain")?.apply {
|
||||
dependencies {
|
||||
compileOnly(`ktor-io`)
|
||||
implementation(`ktor-client-core`)
|
||||
}
|
||||
}
|
||||
findByName("jvmBaseMain")?.apply {
|
||||
// relocate for JVM like modules
|
||||
dependencies {
|
||||
relocateCompileOnly(`ktor-io_relocated`) // runtime from mirai-core-utils
|
||||
relocateImplementation(`ktor-client-core_relocated`)
|
||||
}
|
||||
}
|
||||
configure(NATIVE_TARGETS.map { getByName(it + "Main") }
|
||||
+ NATIVE_TARGETS.map { getByName(it + "Test") }) {
|
||||
// no relocation in native, include binaries
|
||||
dependencies {
|
||||
api(`ktor-io`) {
|
||||
exclude(ExcludeProperties.`slf4j-api`)
|
||||
}
|
||||
}
|
||||
}
|
||||
findByName("jvmBaseMain")?.apply {
|
||||
dependencies {
|
||||
relocateImplementation(`ktor-client-okhttp_relocated`)
|
||||
|
Loading…
Reference in New Issue
Block a user