added wasm/js target
This commit is contained in:
@@ -2,8 +2,10 @@ import com.android.build.api.dsl.ManagedVirtualDevice
|
||||
import org.jetbrains.compose.ExperimentalComposeLibrary
|
||||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
|
||||
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.multiplatform)
|
||||
@@ -14,6 +16,24 @@ plugins {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@OptIn(ExperimentalWasmDsl::class)
|
||||
wasmJs {
|
||||
moduleName = "composeApp"
|
||||
browser {
|
||||
val projectDirPath = project.projectDir.path
|
||||
commonWebpackConfig {
|
||||
outputFileName = "composeApp.js"
|
||||
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
|
||||
static = (static ?: mutableListOf()).apply {
|
||||
// Serve sources to debug inside browser
|
||||
add(projectDirPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
binaries.executable()
|
||||
}
|
||||
|
||||
// export correct artifact to use all classes of library directly from Swift
|
||||
targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java).all {
|
||||
binaries.withType(org.jetbrains.kotlin.gradle.plugin.mpp.Framework::class.java).all {
|
||||
@@ -64,7 +84,6 @@ kotlin {
|
||||
implementation(libs.coil.network.ktor)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.ktor.core)
|
||||
implementation(libs.ktor.client.cio)
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
implementation(libs.koin.core)
|
||||
implementation(libs.koin.compose)
|
||||
@@ -72,7 +91,6 @@ kotlin {
|
||||
implementation(libs.haze)
|
||||
implementation(libs.haze.materials)
|
||||
implementation(libs.kstore)
|
||||
implementation(libs.kstore.file)
|
||||
implementation(libs.napier)
|
||||
}
|
||||
|
||||
@@ -88,6 +106,7 @@ kotlin {
|
||||
implementation(libs.androidx.activityCompose)
|
||||
implementation(libs.kotlinx.coroutines.android)
|
||||
implementation(libs.ktor.client.okhttp)
|
||||
implementation(libs.kstore.file)
|
||||
}
|
||||
|
||||
jvmMain.dependencies {
|
||||
@@ -95,10 +114,16 @@ kotlin {
|
||||
implementation(libs.kotlinx.coroutines.swing)
|
||||
implementation(libs.ktor.client.okhttp)
|
||||
implementation(libs.appdirs)
|
||||
implementation(libs.kstore.file)
|
||||
}
|
||||
|
||||
iosMain.dependencies {
|
||||
implementation(libs.ktor.client.darwin)
|
||||
implementation(libs.kstore.file)
|
||||
}
|
||||
|
||||
wasmJsMain.dependencies {
|
||||
implementation(libs.kstore.storage)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,6 +153,11 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
getByName("release") {
|
||||
isMinifyEnabled = false
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
Reference in New Issue
Block a user