-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
63 lines (54 loc) · 2.06 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
import com.google.devtools.ksp.gradle.KspTaskMetadata
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.google.ksp)
alias(libs.plugins.kotlin.serialization)
}
repositories {
mavenCentral()
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
kotlin {
jvm()
js(IR) {
browser()
}.binaries.executable()
sourceSets {
commonMain {
dependencies {
implementation(libs.fritz2.core)
implementation(libs.fritz2.serialization)
}
}
val jsMain by getting {
dependencies {
// tailwind
implementation(npm(libs.tailwindcss.core))
implementation(npm(libs.tailwindcss.typography))
// webpack
implementation(npm(libs.postcss.core))
implementation(npm(libs.postcss.loader))
implementation(npm(libs.autoprefixer))
implementation(npm(libs.css.loader))
implementation(npm(libs.style.loader))
implementation(npm(libs.cssnano))
}
}
}
}
rootProject.plugins.withType<YarnPlugin> {
rootProject.the<YarnRootExtension>().lockFileDirectory = project.rootDir.resolve("./")
}
// KSP support for Lens generation
dependencies.kspCommonMainMetadata(libs.fritz2.lenses)
kotlin.sourceSets.commonMain { tasks.withType<KspTaskMetadata> { kotlin.srcDir(destinationDirectory) } }
// FIXME: Simple workaround to make version catalogs usable for npm dependencies too. Remove if kotlin plugin
// supports this out of the box!
fun KotlinDependencyHandler.npm(dependency: Provider<MinimalExternalModuleDependency>): Dependency =
dependency.map { dep ->
val name = if (dep.group == "npm") dep.name else "@${dep.group}/${dep.name}"
npm(name, dep.version!!)
}.get()