-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
51 lines (39 loc) · 1.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
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
project.apply {
group = "me.duncte123"
version = "1.0-SNAPSHOT"
}
plugins {
id("kotlin2js") version "1.3.21"
}
repositories {
mavenCentral()
}
dependencies {
"compile"(kotlin("stdlib-js"))
}
val classes: Task by tasks
val assemble: Task by tasks
val compileKotlin2Js: KotlinJsCompile by tasks
val assembleWeb = task<Sync>("assembleWeb") {
configurations["compile"].forEach { file: File ->
from(zipTree(file.absolutePath), {
includeEmptyDirs = false
include { fileTreeElement ->
val path = fileTreeElement.path
path.endsWith(".js") && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/"))
}
})
}
from(compileKotlin2Js.path)
into("$projectDir/web")
dependsOn(classes)
}
assemble.dependsOn(assembleWeb)
compileKotlin2Js.apply {
kotlinOptions.outputFile = "$projectDir/bot/index.js"
kotlinOptions.moduleKind = "commonjs"
kotlinOptions.sourceMap = false
kotlinOptions.main = "call"
kotlinOptions.metaInfo = false
}