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.
199 lines
5.8 KiB
199 lines
5.8 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 |
|
|
|
buildscript { |
|
repositories { |
|
mavenLocal() |
|
mavenCentral() |
|
google() |
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") |
|
} |
|
} |
|
|
|
plugins { |
|
kotlin("multiplatform") version "1.7.10" |
|
id("org.jetbrains.compose") version "1.3.0-alpha01-dev824" |
|
} |
|
|
|
version = "1.0-SNAPSHOT" |
|
|
|
repositories { |
|
mavenLocal() |
|
mavenCentral() |
|
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") |
|
google() |
|
} |
|
|
|
kotlin { |
|
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" |
|
) |
|
} |
|
} |
|
} |
|
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" |
|
) |
|
} |
|
} |
|
} |
|
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" |
|
) |
|
// TODO: the current compose binary surprises LLVM, so disable checks for now. |
|
freeCompilerArgs += "-Xdisable-phases=VerifyBitcode" |
|
} |
|
} |
|
} |
|
|
|
sourceSets { |
|
val commonMain by getting { |
|
dependencies { |
|
implementation(compose.ui) |
|
implementation(compose.foundation) |
|
implementation(compose.material) |
|
implementation(compose.runtime) |
|
|
|
//TODO hotfix of issue https://github.com/JetBrains/compose-jb/issues/2113 |
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1") |
|
} |
|
} |
|
|
|
val commonTest by getting { |
|
dependencies { |
|
implementation(kotlin("test")) |
|
} |
|
} |
|
|
|
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" |
|
nativeDistributions { |
|
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) |
|
packageName = "Minesweeper" |
|
packageVersion = "1.0.0" |
|
|
|
windows { |
|
menuGroup = "Compose Examples" |
|
// see https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html |
|
upgradeUuid = "2bf169f9-d851-49f0-b3a1-308966d473ca" |
|
} |
|
} |
|
} |
|
} |
|
|
|
compose.experimental { |
|
web.application {} |
|
uikit.application { |
|
bundleIdPrefix = "org.jetbrains" |
|
projectName = "ComposeMinesweeper" |
|
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" |
|
} |
|
|
|
kotlin { |
|
targets.withType<KotlinNativeTarget> { |
|
binaries.all { |
|
// TODO: the current compose binary surprises LLVM, so disable checks for now. |
|
freeCompilerArgs += "-Xdisable-phases=VerifyBitcode" |
|
} |
|
} |
|
} |
|
|
|
// 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" |
|
} |
|
}
|
|
|