-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle.kts
104 lines (96 loc) · 3.93 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig.*
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
alias(libsCommon.plugins.spotless)
}
val localProperties = gradleLocalProperties(rootDir)
compose {
kotlinCompilerPlugin.set(libsClient.jbcompose.compiler.get().toString())
//kotlinCompilerPluginArgs.add("suppressKotlinVersionCompatibilityCheck=${libs.versions.kotlin.get()}")
}
kotlin {
js(IR) {
useCommonJs()
browser {
binaries.executable()
commonWebpackConfig {
cssSupport {
enabled.set(true)
}
}
runTask {
val anystreamUrl = localProperties.getProperty("anystream.serverUrl", "http://localhost:8888")
mainOutputFileName.set("main.bundle.js")
devtool = "eval-source-map"
devServer = DevServer(
open = false,
port = 3000,
static = mutableListOf("$buildDir/processedResources/js/main"),
proxy = mutableMapOf(
"/api" to mapOf<String, Any>(
"ws" to true,
"target" to anystreamUrl,
"secure" to anystreamUrl.startsWith("https"),
"changeOrigin" to true,
"rejectUnauthorzied" to false,
)
),
)
}
webpackTask {
mainOutputFileName.set("main.bundle.js")
//devtool = "eval-source-map"
}
}
}
sourceSets {
all {
languageSettings.apply {
optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
optIn("kotlinx.coroutines.FlowPreview")
optIn("kotlin.time.ExperimentalTime")
optIn("kt.mobius.compose.ExperimentalMobiusktComposeApi")
}
}
named("jsMain") {
dependencies {
implementation(projects.client.core)
implementation(libsCommon.coroutines.core)
implementation(libsCommon.ktor.client.js)
implementation(compose.html.core)
implementation(compose.runtime)
implementation(libsClient.mobiuskt.compose)
implementation(libsClient.routingCompose)
implementation(libsClient.kotlinjs.extensions)
implementation(libsClient.kotlinjs.browser)
implementation(devNpm("jquery", "3.6.4"))
implementation(devNpm("bootstrap", "5.3.0-alpha3"))
implementation(devNpm("bootstrap-icons", "1.10.4"))
implementation(devNpm("@fontsource/open-sans", "4.5.14"))
implementation(devNpm("@popperjs/core", "2.11.7"))
implementation(devNpm("video.js", "8.0.4"))
implementation(devNpm("webworkify-webpack-dropin", "1.1.9"))
implementation(devNpm("mini-css-extract-plugin", "2.7.5"))
implementation(devNpm("file-loader", "6.2.0"))
implementation(devNpm("webpack-bundle-analyzer", "4.8.0"))
implementation(devNpm("qrcode", "1.5.1"))
implementation(devNpm("sass", "1.62.0"))
implementation(devNpm("sass-loader", "13.2.2"))
implementation(devNpm("postcss-loader", "7.2.4"))
implementation(devNpm("autoprefixer", "10.4.14"))
}
}
}
}
afterEvaluate {
spotless {
kotlin {
target("**/**.kt")
licenseHeaderFile(rootDir.resolve("licenseHeader.txt"))
//ktlint(libsCommon.versions.ktlint.get())
// .setEditorConfigPath(rootDir.resolve(".editorconfig"))
}
}
}