-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
108 lines (91 loc) · 2.86 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
import org.gradle.api.tasks.testing.logging.TestLogEvent.*
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
import org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest
group = "de.lorenzgorse"
version = "1.0-SNAPSHOT"
val ktorVersion by extra ("1.5.1")
repositories {
mavenLocal()
mavenCentral()
maven(url = "https://kotlin.bintray.com/kotlinx/")
}
plugins {
kotlin("multiplatform") version "1.4.30"
kotlin("plugin.serialization") version "1.4.30"
application
}
kotlin {
jvm {
withJava()
}
js {
browser()
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
}
}
val jsMain by getting {
dependencies {
implementation(npm("file-type", "16.2.0"))
implementation(npm("is-svg", "4.2.1"))
}
}
val jvmMain by getting {
dependencies {
implementation("ch.qos.logback:logback-classic:1.2.3")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("io.ktor:ktor-gson:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-websockets:$ktorVersion")
}
}
val jvmTest by getting {
dependencies {
implementation("com.xenomachina:kotlin-argparser:2.0.7")
implementation("org.junit.jupiter:junit-jupiter:5.5.2")
}
}
}
}
application {
mainClassName = "de.lorenzgorse.chatroulette.AppKt"
applicationDefaultJvmArgs = listOf("-Xmx500M")
}
task<Copy>("copyJsArtifacts") {
val webpackTask = tasks.getByName<KotlinWebpack>("jsBrowserDevelopmentWebpack")
dependsOn(webpackTask)
from(webpackTask.outputFile)
val jvmProcessResources = tasks.getByName<ProcessResources>("jvmProcessResources")
into(jvmProcessResources.destinationDir.resolve("static"))
}
tasks.getByName<ProcessResources>("jvmProcessResources") {
dependsOn(tasks.getByName("copyJsArtifacts"))
}
/* Setup testing. */
tasks.getByName<KotlinJvmTest>("jvmTest") {
useJUnitPlatform()
testLogging {
this.events(FAILED, PASSED, SKIPPED, STARTED)
}
}
/* Run the loadtest. */
//task<JavaExec>("loadtest") {
// classpath = sourceSets.getByName("jvmTest").runtimeClasspath
// main = "de.lorenzgorse.chatroulette.LoadtestKt"
// maxHeapSize = "2G"
//}
/* Setup distribution */
distributions {
main {
contents {
from("$buildDir/libs") {
rename("${rootProject.name}-jvm", rootProject.name)
into("lib")
}
}
}
}