@file:Suppress("OPT_IN_IS_NOT_ENABLED") import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler plugins { kotlin("multiplatform") id("com.android.library") id("org.jetbrains.compose") } version = "1.0-SNAPSHOT" kotlin { android() jvm("desktop") js(IR) { browser() } macosX64 { binaries { executable { entryPoint = "main" } } } macosArm64 { binaries { executable { entryPoint = "main" } } } listOf( iosX64(), iosArm64(), iosSimulatorArm64() ).forEach { iosTarget -> iosTarget.binaries.framework { baseName = "shared" isStatic = true } } val enableKjsWorkaround = project.properties["workaround.kotlin.js.kt60852"] == "true" fun KotlinDependencyHandler.addCommonDependencies() { implementation(compose.ui) implementation(compose.runtime) implementation(compose.foundation) implementation(compose.material) @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) implementation(compose.components.resources) } sourceSets { val commonMain by getting { dependencies { if (!enableKjsWorkaround) { addCommonDependencies() } } } val androidMain by getting { dependencies { api("androidx.activity:activity-compose:1.6.1") api("androidx.appcompat:appcompat:1.6.1") api("androidx.core:core-ktx:1.9.0") } } val iosMain by creating { dependsOn(commonMain) } val iosX64Main by getting { dependsOn(iosMain) } val iosArm64Main by getting { dependsOn(iosMain) } val iosSimulatorArm64Main by getting { dependsOn(iosMain) } val desktopMain by getting { dependencies { implementation(compose.desktop.common) } } val macosMain by creating { dependsOn(commonMain) } val macosArm64Main by getting { dependsOn(macosMain) } val jsMain by getting { dependencies { if (enableKjsWorkaround) { addCommonDependencies() } } } } } android { compileSdk = 34 sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") sourceSets["main"].res.srcDirs("src/androidMain/res") sourceSets["main"].resources.srcDirs("src/commonMain/resources") defaultConfig { minSdk = 26 targetSdk = 34 } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } }