forked from JetBrains/lets-plot
/
build.gradle
157 lines (138 loc) · 5.08 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
plugins {
id 'kotlin-multiplatform'
id 'org.jetbrains.gradle.plugin.idea-ext'
}
kotlin {
jvm("jvmJfx")
jvm("jvmRawJfx")
jvm("jvmBrowser")
js() {
compileKotlinJs {
kotlinOptions.sourceMap = true
kotlinOptions.sourceMapEmbedSources = "always"
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation project(':base-portable')
implementation project(':base')
implementation project(':gis')
implementation project(':livemap')
implementation project(':vis-svg')
implementation project(':vis-canvas')
implementation project(':vis-demo-common')
implementation project(':vis-demo-common-jfx')
implementation project(':plot-builder-portable')
implementation project(':plot-builder')
implementation project(':plot-base-portable')
implementation project(':plot-base')
}
}
allJvm {
dependencies {
implementation kotlin('stdlib-jdk8')
compileOnly "io.github.microutils:kotlin-logging:$kotlinLogging_version"
implementation "org.jetbrains.kotlinx:kotlinx-html-jvm:${kotlinx_html_version}"
implementation "io.ktor:ktor-client-cio:$ktor_version"
}
}
jvmMain {
dependsOn allJvm
}
jvmJfxMain {
dependsOn allJvm
}
jvmRawJfxMain {
dependsOn allJvm
}
jvmBrowserMain {
dependsOn allJvm
}
jsMain {
dependencies {
implementation kotlin('stdlib-js')
}
}
}
}
idea {
module {
settings {
packagePrefix["src/jvmJfxMain/kotlin"] = ""
packagePrefix["src/jvmBrowserMain/kotlin"] = "jetbrains"
}
}
}
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
// Workaround for Idea/Gradle bug: https://youtrack.jetbrains.com/issue/KT-24463
// MPP: Run does not add resource directory to classpath [Cannot get resource when using common module]
//
// JavaFX Scene mapping requires stylesheet resource URI
task copyProcessedResources(type: Copy) {
from "${project.buildDir}/processedResources"
into "${project.buildDir}/classes/kotlin"
}
build.dependsOn += copyProcessedResources
// ---------------------------------
// Trick to copy kotlin.js etc. to `output`
configurations {
libraryDependenciesJs
projectDependenciesJs
}
dependencies {
libraryDependenciesJs "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
libraryDependenciesJs "io.github.microutils:kotlin-logging-js:$kotlinLogging_version"
// for Assertions.kt ToDo: get rid of kotlin-test here
libraryDependenciesJs "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
libraryDependenciesJs "io.ktor:ktor-client-websockets:$ktor_version"
libraryDependenciesJs "io.ktor:ktor-client-cio:$ktor_version"
libraryDependenciesJs "io.ktor:ktor-client-js:$ktor_version"
projectDependenciesJs project(':base-portable')
projectDependenciesJs project(':base')
projectDependenciesJs project(':gis')
projectDependenciesJs project(':livemap')
projectDependenciesJs project(':mapper-core')
projectDependenciesJs project(':vis-svg')
projectDependenciesJs project(':vis-demo-common')
projectDependenciesJs project(':vis-canvas') // required by plot-builder (get rid?)
projectDependenciesJs project(':plot-common-portable')
projectDependenciesJs project(':plot-common')
projectDependenciesJs project(':plot-base')
projectDependenciesJs project(':plot-base-portable')
projectDependenciesJs project(':plot-builder-portable')
projectDependenciesJs project(':plot-builder')
projectDependenciesJs project(':plot-config-portable')
projectDependenciesJs project(':plot-config')
}
// ---------------------------------
def OUTPUT_DIR_JS = "${project.buildDir}/demoWeb"
def OUTPUT_DIR_JS_LIB = "${OUTPUT_DIR_JS}/lib"
task copyLibraryDependenciesJs(type: Copy) {
configurations.libraryDependenciesJs.each {
println "library dependency: ${it.absolutePath}"
from zipTree(it.absolutePath).matching { include '*.js' }
}
into OUTPUT_DIR_JS_LIB
}
task copyProjectDependenciesJs(type: Copy) {
configurations.projectDependenciesJs.each {
def jarJs = it.absolutePath.replace("-metadata-", "-js-")
println "project dependency: $jarJs"
from zipTree(jarJs).matching { include '*.js' }
}
into OUTPUT_DIR_JS_LIB
}
task copyMainJs(type: Copy) {
from "${project.buildDir}/classes/kotlin/js/main"
include "*.js"
into OUTPUT_DIR_JS
}
build.dependsOn += copyLibraryDependenciesJs
build.dependsOn += copyProjectDependenciesJs
build.dependsOn += copyMainJs