-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
97 lines (87 loc) · 2.65 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
plugins {
kotlin("multiplatform") version "1.7.21"
kotlin("plugin.serialization") version "1.7.21"
}
group = "me.regob"
version = "1.0-SNAPSHOT"
repositories {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
}
kotlin {
js ("worker", IR) {
binaries.executable()
browser {
commonWebpackConfig {
outputFileName="worker.js"
}
testTask {
useKarma {
useChromeHeadless()
}
}
}
}
js ("js", IR) {
binaries.executable()
browser {
commonWebpackConfig {
outputFileName="backgammon-kotlinjs.js"
cssSupport.enabled = true
}
testTask {
useKarma {
//useFirefox()
useChromeHeadless()
}
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-html:0.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1")
}
}
val workerMain by getting {
dependsOn(commonMain)
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation(npm("onnxruntime-web", "1.13.1"))
implementation(npm("onnxruntime-common", "1.13.1"))
}
}
val jsMain by getting {
dependsOn(commonMain)
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
val workerTest by getting {
dependencies {
implementation(kotlin("test-js"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
}
}
}
}
tasks.named("workerProductionExecutableCompileSync") {
finalizedBy("compileProductionExecutableKotlinJs")
}
// This task copies files from build/distributions to /docs for github-pages
task("copyDistToDocs", Copy::class) {
from("$buildDir/distributions/")
into("docs")
dependsOn("workerBrowserDistribution", "jsBrowserDistribution")
}
task("buildAll") {
dependsOn("workerBrowserDistribution", "jsBrowserDistribution", "copyDistToDocs")
}
task("buildAndTestAll") {
dependsOn("workerBrowserDistribution", "jsBrowserDistribution", "jsBrowserTest", "workerBrowserTest", "copyDistToDocs")
}