-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
77 lines (63 loc) · 2.1 KB
/
build.gradle
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
import java.awt.*
plugins {
id "kotlin2js" version "1.3.10"
id "com.moowork.node" version "1.2.0"
}
group "zir.teq"
version "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
}
[compileTestKotlin2Js, compileKotlin2Js]*.configure {
kotlinOptions {
moduleKind = "umd"
metaInfo = true
sourceMap = true
sourceMapEmbedSources = "always"
}
}
node {
version = node_version
download = true
}
task populateNodeModules(type: Copy, dependsOn: [compileKotlin2Js]) {
from compileKotlin2Js.destinationDir
configurations.testCompile.each {
from zipTree(it.absolutePath).matching { include "*.js" }
}
into "$buildDir/node_modules"
}
task runMocha(type: NodeTask, dependsOn: [populateNodeModules]) {
script = file("node_modules/mocha/bin/mocha")
args = [compileTestKotlin2Js.outputFile,
"--require=source-map-support/register",
"--useColors=false",
"--reporter", "mochawesome",
"--reporter-options",
"reportDir=$rootDir,reportTitle=Q-Gress Tests,json=false,inline=true,quiet=true"]
}
task cleanup(type: Delete) {
delete "published/Q-Gress.js", "published/kotlin.js",
"mochawesome.html", "build"
}
task fullCleanup(type: Delete, dependsOn: [cleanup]) {
delete "node_modules"
}
task installKotlin(type: NpmTask) { args = ["install", "--save", "kotlin"] }
task installNodeModules(type: NpmTask, dependsOn: [installKotlin]) {
args = ["install", "--save-dev", "mocha", "mochawesome", "source-map-support"]
}
task publish(type: Copy, dependsOn: [runMocha]) {
from file("$buildDir/node_modules/kotlin.js")
from file("$buildDir/classes/kotlin/main/Q-Gress.js")
into file("published/")
}
task openInBrowser { doLast { Desktop.desktop.browse "index.html".toURI() } }
task openTestReport { doLast { Desktop.desktop.browse "mochawesome.html".toURI() } }
test.dependsOn runMocha
build.dependsOn publish
clean.dependsOn cleanup