-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
132 lines (119 loc) · 3.72 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:6.1.0")
}
}
plugins {
kotlin("multiplatform") version "1.4.21"
kotlin("plugin.serialization") version "1.4.10"
id("com.github.johnrengelman.shadow") version "5.0.0"
application
}
group = "de.geosearchef"
version = "1.0-SNAPSHOT"
repositories {
jcenter()
mavenCentral()
maven { url = uri("https://dl.bintray.com/kotlin/kotlin-js-wrappers") }
maven { url = uri("https://dl.bintray.com/kotlin/kotlinx") }
}
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnit()
}
withJava()
}
js(LEGACY) {
browser {
binaries.executable()
webpackTask {
cssSupport.enabled = true
}
runTask {
cssSupport.enabled = true
}
testTask {
useKarma {
useChromeHeadless()
webpackConfig.cssSupport.enabled = true
}
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1")
}
}
val jvmMain by getting {
dependencies {
implementation("com.sparkjava:spark-kotlin:1.0.0-alpha")
implementation("org.slf4j:slf4j-simple:2.0.0-alpha1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1")
}
}
val jsMain by getting {
dependencies {
// implementation("org.jetbrains:kotlin-react:16.13.1-pre.113-kotlin-1.4.0")
// implementation("org.jetbrains:kotlin-react-dom:16.13.1-pre.113-kotlin-1.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1")
}
}
// val commonTest by getting {
// dependencies {
// implementation(kotlin("test-common"))
// implementation(kotlin("test-annotations-common"))
// }
// }
// val jvmTest by getting {
// dependencies {
// implementation(kotlin("test-junit"))
// }
// }
// val jsTest by getting {
// dependencies {
// implementation(kotlin("test-js"))
// }
// }
}
}
application {
mainClassName = "CardSimulatorServerKt"
}
tasks.getByName<KotlinWebpack>("jsBrowserProductionWebpack") {
outputFileName = "cards.js"
}
tasks.getByName<Jar>("jvmJar") {
dependsOn(tasks.getByName("jsBrowserProductionWebpack"))
val jsBrowserProductionWebpack = tasks.getByName<KotlinWebpack>("jsBrowserProductionWebpack")
from(File(jsBrowserProductionWebpack.destinationDirectory, jsBrowserProductionWebpack.outputFileName))
// into(project.file("static/"))
}
tasks.getByName<JavaExec>("run") {
dependsOn(tasks.getByName<Jar>("jvmJar"))
classpath(tasks.getByName<Jar>("jvmJar"))
}
tasks.withType<Jar> {
manifest {
attributes(
mapOf(
"Main-Class" to application.mainClassName
)
)
}
// from: https://stackoverflow.com/questions/44197521/gradle-project-java-lang-noclassdeffounderror-kotlin-jvm-internal-intrinsics
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}