-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
90 lines (76 loc) · 2.11 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
import de.undercouch.gradle.tasks.download.Download
plugins {
kotlin("multiplatform") version "1.8.0"
id("app.cash.sqldelight") version "2.0.0-SNAPSHOT"
id("org.jetbrains.compose") version "1.3.0"
id("de.undercouch.download") version "5.3.0"
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google()
}
compose {
kotlinCompilerPlugin.set("androidx.compose.compiler:compiler:1.4.0")
}
kotlin {
js {
binaries.executable()
browser {
commonWebpackConfig {
cssSupport {
enabled.set(true)
}
}
}
}
sourceSets {
val jsMain by getting {
dependencies {
implementation("app.cash.sqldelight:web-worker-driver:2.0.0-SNAPSHOT")
implementation("app.cash.sqldelight:coroutines-extensions:2.0.0-SNAPSHOT")
implementation(compose.web.core)
implementation(compose.runtime)
}
resources.srcDir(layout.buildDirectory.dir("sqlite"))
}
val jsTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
}
}
sqldelight {
databases {
create("Database") {
packageName.set("org.example.db")
generateAsync.set(true)
}
}
}
// See https://sqlite.org/download.html for the latest wasm build version
val sqlite = 3400000
val sqliteDownload = tasks.register("sqliteDownload", Download::class.java) {
src("https://sqlite.org/2022/sqlite-wasm-$sqlite.zip")
dest(layout.buildDirectory.dir("tmp"))
onlyIfModified(true)
}
val sqliteUnzip = tasks.register("sqliteUnzip", Copy::class.java) {
dependsOn(sqliteDownload)
from(zipTree(layout.buildDirectory.dir("tmp/sqlite-wasm-$sqlite.zip"))) {
include("sqlite-wasm-$sqlite/jswasm/**")
exclude("**/*worker1*")
eachFile {
relativePath = RelativePath(true, *relativePath.segments.drop(2).toTypedArray())
}
}
into(layout.buildDirectory.dir("sqlite"))
includeEmptyDirs = false
}
tasks.named("jsProcessResources").configure {
dependsOn(sqliteUnzip)
}