1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-04-25 13:03:35 +08:00

[build] Publish android artifacts

This commit is contained in:
Him188 2023-05-01 22:39:37 +01:00
parent 84d03c9a71
commit 64cfab6f0a
2 changed files with 4 additions and 8 deletions
buildSrc/src/main/kotlin

View File

@ -53,7 +53,6 @@ fun Project.configureAndroidTarget(androidNamespace: String) {
private fun Project.configureAndroidTargetWithJvm() {
extensions.getByType(KotlinMultiplatformExtension::class.java).apply {
jvm("android") {
jvmToolchain(JVM_TOOLCHAIN_VERSION)
attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.androidJvm)
if (IDEA_ACTIVE) {
@ -90,9 +89,7 @@ private fun Project.configureAndroidTargetWithSdk(androidNamespace: String) {
}
extensions.getByType(KotlinMultiplatformExtension::class.java).apply {
android {
if (IDEA_ACTIVE) {
attributes.attribute(MIRAI_PLATFORM_ATTRIBUTE, "android") // workaround for IDE bug
}
publishLibraryVariants("release", "debug")
}
val jvmBaseMain = sourceSets.maybeCreate("jvmBaseMain")

View File

@ -166,12 +166,13 @@ const val JVM_TOOLCHAIN_VERSION = 8
*/
fun Project.configureJvmTargetsHierarchical(androidNamespace: String) {
extensions.getByType(KotlinMultiplatformExtension::class.java).apply {
jvmToolchain(JVM_TOOLCHAIN_VERSION)
val commonMain by sourceSets.getting
val commonTest by sourceSets.getting
if (IDEA_ACTIVE) {
jvm("jvmBase") { // dummy target for resolution, not published
jvmToolchain(JVM_TOOLCHAIN_VERSION)
compilations.all {
// magic to help IDEA
this.compileTaskProvider.configure {
@ -204,9 +205,7 @@ fun Project.configureJvmTargetsHierarchical(androidNamespace: String) {
}
if (isTargetEnabled("jvm")) {
jvm("jvm") {
jvmToolchain(JVM_TOOLCHAIN_VERSION)
}
jvm("jvm")
val jvmMain by sourceSets.getting
val jvmTest by sourceSets.getting
jvmMain.dependsOn(jvmBaseMain)