You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
217 lines
6.2 KiB
217 lines
6.2 KiB
import org.jetbrains.compose.compose |
|
import org.jetbrains.compose.desktop.application.dsl.TargetFormat |
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget |
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
|
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension |
|
import org.jetbrains.compose.experimental.dsl.IOSDevices |
|
|
|
plugins { |
|
id("com.android.application") |
|
kotlin("multiplatform") |
|
id("org.jetbrains.compose") |
|
} |
|
|
|
version = "1.0-SNAPSHOT" |
|
|
|
repositories { |
|
mavenLocal() |
|
google() |
|
mavenCentral() |
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") |
|
} |
|
|
|
kotlin { |
|
android() |
|
jvm("desktop") |
|
js(IR) { |
|
browser() |
|
binaries.executable() |
|
} |
|
macosX64 { |
|
binaries { |
|
executable { |
|
entryPoint = "main" |
|
freeCompilerArgs += listOf( |
|
"-linker-option", "-framework", "-linker-option", "Metal" |
|
) |
|
} |
|
} |
|
} |
|
macosArm64 { |
|
binaries { |
|
executable { |
|
entryPoint = "main" |
|
freeCompilerArgs += listOf( |
|
"-linker-option", "-framework", "-linker-option", "Metal" |
|
) |
|
} |
|
} |
|
} |
|
|
|
// Workaround for an issue: |
|
// https://youtrack.jetbrains.com/issue/KT-53561/Invalid-LLVM-module-inlinable-function-call-in-a-function-with-debug-info-must-have-a-dbg-location |
|
// Compose compiler produces nodes without line information sometimes that provokes Kotlin native compiler to report errors. |
|
// TODO: remove workaround when switch to Kotlin 1.8 |
|
val disableKonanVerification = "-Xverify-compiler=false" |
|
|
|
iosX64("uikitX64") { |
|
binaries { |
|
executable() { |
|
entryPoint = "main" |
|
freeCompilerArgs += listOf( |
|
"-linker-option", "-framework", "-linker-option", "Metal", |
|
"-linker-option", "-framework", "-linker-option", "CoreText", |
|
"-linker-option", "-framework", "-linker-option", "CoreGraphics", |
|
disableKonanVerification |
|
) |
|
} |
|
} |
|
} |
|
iosArm64("uikitArm64") { |
|
binaries { |
|
executable() { |
|
entryPoint = "main" |
|
freeCompilerArgs += listOf( |
|
"-linker-option", "-framework", "-linker-option", "Metal", |
|
"-linker-option", "-framework", "-linker-option", "CoreText", |
|
"-linker-option", "-framework", "-linker-option", "CoreGraphics", |
|
disableKonanVerification |
|
) |
|
} |
|
} |
|
} |
|
|
|
sourceSets { |
|
val commonMain by getting { |
|
dependencies { |
|
implementation(compose.ui) |
|
implementation(compose.foundation) |
|
implementation(compose.material) |
|
implementation(compose.runtime) |
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3") |
|
} |
|
} |
|
|
|
val commonTest by getting { |
|
dependencies { |
|
implementation(kotlin("test-common")) |
|
implementation(kotlin("test-annotations-common")) |
|
} |
|
} |
|
|
|
val androidMain by getting { |
|
dependsOn(commonMain) |
|
kotlin.srcDirs("src/jvmMain/kotlin") |
|
dependencies { |
|
implementation("androidx.appcompat:appcompat:1.5.1") |
|
implementation("androidx.activity:activity-compose:1.5.0") |
|
} |
|
} |
|
|
|
val desktopMain by getting { |
|
dependencies { |
|
implementation(compose.desktop.currentOs) |
|
} |
|
} |
|
|
|
val jsMain by getting { |
|
dependencies { |
|
implementation(compose.web.core) |
|
} |
|
} |
|
|
|
val nativeMain by creating { |
|
dependsOn(commonMain) |
|
} |
|
val macosMain by creating { |
|
dependsOn(nativeMain) |
|
} |
|
val macosX64Main by getting { |
|
dependsOn(macosMain) |
|
} |
|
val macosArm64Main by getting { |
|
dependsOn(macosMain) |
|
} |
|
val uikitMain by creating { |
|
dependsOn(nativeMain) |
|
} |
|
val uikitX64Main by getting { |
|
dependsOn(uikitMain) |
|
} |
|
val uikitArm64Main by getting { |
|
dependsOn(uikitMain) |
|
} |
|
} |
|
} |
|
|
|
compose.desktop { |
|
application { |
|
mainClass = "Main_desktopKt" |
|
} |
|
} |
|
|
|
compose.experimental { |
|
web.application {} |
|
uikit.application { |
|
bundleIdPrefix = "org.jetbrains" |
|
projectName = "Chat" |
|
deployConfigurations { |
|
simulator("IPhone8") { |
|
//Usage: ./gradlew iosDeployIPhone8Debug |
|
device = IOSDevices.IPHONE_8 |
|
} |
|
simulator("IPad") { |
|
//Usage: ./gradlew iosDeployIPadDebug |
|
device = IOSDevices.IPAD_MINI_6th_Gen |
|
} |
|
connectedDevice("Device") { |
|
//First need specify your teamId here, or in local.properties (compose.ios.teamId=***) |
|
//teamId="***" |
|
//Usage: ./gradlew iosDeployDeviceRelease |
|
} |
|
} |
|
} |
|
} |
|
|
|
tasks.withType<KotlinCompile> { |
|
kotlinOptions.jvmTarget = "11" |
|
} |
|
|
|
compose.desktop.nativeApplication { |
|
targets(kotlin.targets.getByName("macosX64")) |
|
distributions { |
|
targetFormats(TargetFormat.Dmg) |
|
packageName = "Chat" |
|
packageVersion = "1.0.0" |
|
} |
|
} |
|
|
|
// a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273 |
|
afterEvaluate { |
|
rootProject.extensions.configure<NodeJsRootExtension> { |
|
versions.webpackDevServer.version = "4.0.0" |
|
versions.webpackCli.version = "4.9.0" |
|
nodeVersion = "16.0.0" |
|
} |
|
} |
|
|
|
android { |
|
compileSdk = 32 |
|
|
|
defaultConfig { |
|
minSdk = 26 |
|
targetSdk = 32 |
|
} |
|
|
|
compileOptions { |
|
sourceCompatibility = JavaVersion.VERSION_11 |
|
targetCompatibility = JavaVersion.VERSION_11 |
|
} |
|
|
|
sourceSets { |
|
named("main") { |
|
manifest.srcFile("src/androidMain/AndroidManifest.xml") |
|
res.srcDirs("src/androidMain/res", "src/commonMain/resources") |
|
} |
|
} |
|
}
|
|
|