-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
120 lines (93 loc) · 3.2 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
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
buildscript {
ext.kotlin_version = '1.2.41'
ext.react_version = '16.3.1-pre.28'
repositories {
mavenCentral()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.31"
}
}
group = 'org.jetbrains.kotlin.example'
version = '0.0.1-SNAPSHOT'
apply plugin: 'kotlin2js'
apply plugin: 'org.jetbrains.kotlin.frontend'
apply plugin: 'kotlin-dce-js'
repositories {
jcenter()
maven { url "https://kotlin.bintray.com/kotlin-js-wrappers/" }
}
dependencies {
compile "org.jetbrains:kotlin-react:${react_version}-kotlin-1.2.30"
compile "org.jetbrains:kotlin-react-dom:${react_version}-kotlin-1.2.30"
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported
testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported
}
kotlinFrontend {
downloadNodeJsVersion = "8.9.3"
npm {
dependency("react", "^$react_version")
dependency("react-dom", "^$react_version")
// webpack loader dependencies
// https://webpack.js.org/loaders/css-loader/
devDependency("css-loader")
// https://webpack.js.org/loaders/style-loader/
devDependency("style-loader")
// https://github.com/webpack-contrib/file-loader
devDependency("file-loader")
// karma test runner
devDependency("karma")
// karma plugins
devDependency("karma-es6-shim")
devDependency("karma-mocha-reporter")
devDependency("karma-chrome-launcher")
}
karma {
port = 9876
runnerPort = 9100
browsers = ["ChromeHeadless"]
plugins = ["karma-mocha-reporter", "karma-es6-shim", "karma-chrome-launcher"]
reporters = ["mocha"]
frameworks = ["jasmine", "es6-shim"] // for now only qunit works as intended
}
webpackBundle {
bundleName = "main"
contentPath = file('src/main/web')
port = 3000
}
define "PRODUCTION", true
// allBundles {
// /* set properties for all bundles */
// }
}
compileKotlin2Js {
kotlinOptions.metaInfo = true
kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js"
kotlinOptions.sourceMap = true
kotlinOptions.sourceMapEmbedSources = "always"
kotlinOptions.moduleKind = 'commonjs'
kotlinOptions.main = "call"
}
compileTestKotlin2Js {
kotlinOptions.metaInfo = true
kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js"
kotlinOptions.sourceMap = true
kotlinOptions.sourceMapEmbedSources = "always"
kotlinOptions.moduleKind = 'commonjs'
kotlinOptions.main = "call"
}
sourceSets {
main {
resources.srcDirs += "src/main/resources"
}
}
project.afterEvaluate{
// tasks.getByPath('webpack-config').inputs.file("$buildFile")
tasks.matching { task -> task.name == "karma-run-single" }.all {
outputs.upToDateWhen { false }
}
}