forked from hapifhir/org.hl7.fhir.validator-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
276 lines (238 loc) · 10.9 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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
plugins {
// Make sure the version for multiplatform and plugin.serialization match kotlinVersion in gradle.properties
kotlin("multiplatform") version "1.6.21"
kotlin("plugin.serialization") version "1.6.21"
id("org.hidetake.ssh") version "2.10.1"
id("org.openjfx.javafxplugin") version "0.0.8"
id("net.thauvin.erik.gradle.semver") version "1.0.4"
application
}
group = "org.hl7.fhir"
repositories {
google()
mavenLocal()
mavenCentral()
maven {
url = uri("https://jitpack.io")
}
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}
maven {
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
}
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
kotlin {
jvm {
compilations {
all {
kotlinOptions.jvmTarget = "11"
}
}
withJava()
tasks.test { useJUnit() }
testRuns["test"].executionTask.configure {
useJUnit()
}
}
js () {
useCommonJs()
binaries.executable()
browser {
binaries.executable()
webpackTask {
cssSupport.enabled = true
}
runTask {
cssSupport.enabled = true
}
testTask {
useKarma {
useChromeHeadless()
webpackConfig.cssSupport.enabled = true
}
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.0")
implementation("com.fasterxml.jackson.core:jackson-databind:${property("jacksonVersion")}")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:${property("kotlinxSerializationVersion")}")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:${property("kotlinxSerializationVersion")}")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:${property("kotlinxSerializationVersion")}")
implementation("ca.uhn.hapi.fhir:org.hl7.fhir.validation:${property("fhirCoreVersion")}")
implementation("ca.uhn.hapi.fhir:org.hl7.fhir.utilities:${property("fhirCoreVersion")}")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation("ca.uhn.hapi.fhir:org.hl7.fhir.validation:${property("fhirCoreVersion")}")
implementation("ca.uhn.hapi.fhir:org.hl7.fhir.utilities:${property("fhirCoreVersion")}")
}
}
val jvmMain by getting {
dependencies {
implementation("io.ktor:ktor-server-netty:${property("ktorVersion")}")
implementation("io.ktor:ktor-server-html-builder:${property("ktorVersion")}")
implementation("io.ktor:ktor-server-jetty:${property("ktorVersion")}")
implementation("io.ktor:ktor-server-core:${property("ktorVersion")}")
implementation("io.ktor:ktor-server-cors:${property("ktorVersion")}")
implementation("io.ktor:ktor-server-compression:${property("ktorVersion")}")
implementation("io.ktor:ktor-server-content-negotiation:${property("ktorVersion")}")
implementation("io.ktor:ktor-server-call-logging:${property("ktorVersion")}")
implementation("io.ktor:ktor-websockets:${property("ktorVersion")}")
implementation("io.ktor:ktor-server-content-negotiation:${property("ktorVersion")}")
implementation("io.ktor:ktor-events:${property("ktorVersion")}")
implementation("io.ktor:ktor-serialization-kotlinx-json:${property("ktorVersion")}")
implementation("io.ktor:ktor-serialization-kotlinx-xml:${property("ktorVersion")}")
implementation("io.ktor:ktor-serialization-gson:${property("ktorVersion")}")
implementation("io.ktor:ktor-serialization-jackson:${property("ktorVersion")}")
implementation("io.ktor:ktor-serialization:${property("ktorVersion")}")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:${property("kotlinxHtmlVersion")}")
implementation("io.insert-koin:koin-ktor:${property("koinVersion")}")
//TODO
implementation("io.ktor:ktor-client-core:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-json:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-cio:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-logging:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-serialization:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-jackson:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-gson:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-serialization-jvm:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-content-negotiation:${property("ktorVersion")}")
implementation("com.squareup.okhttp3:okhttp:4.9.0")
implementation("ch.qos.logback:logback-classic:${property("logbackVersion")}")
implementation("org.litote.kmongo:kmongo-coroutine-serialization:${property("kmongoVersion")}")
implementation("no.tornado:tornadofx:${property("tornadoFXVersion")}")
}
}
val jvmTest by getting {
dependencies {
implementation("org.junit.jupiter:junit-jupiter:${property("junitVersion")}")
implementation("org.junit.jupiter:junit-jupiter-engine:${property("junitVersion")}")
implementation("org.junit.jupiter:junit-jupiter-api:${property("junitVersion")}")
implementation("org.junit.jupiter:junit-jupiter-params:${property("junitVersion")}")
implementation("io.ktor:ktor-server-tests:${property("ktorVersion")}")
implementation("io.ktor:ktor-server-test-host:${property("ktorVersion")}")
implementation("io.mockk:mockk:${property("mockk_version")}")
implementation("io.ktor:ktor-client-mock:${property("ktorVersion")}")
implementation("io.insert-koin:koin-test:${property("koinVersion")}")
}
}
val jsMain by getting {
dependencies {
implementation("io.ktor:ktor-client-core:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-js:${property("ktorVersion")}") //include http&websockets
implementation("io.ktor:ktor-client-json-js:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-content-negotiation:${property("ktorVersion")}")
implementation("io.ktor:ktor-client-serialization-js:${property("ktorVersion")}")
implementation("org.jetbrains.kotlinx:kotlinx-html-js:${property("kotlinxHtmlVersion")}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${property("kotlinxCoroutinesVersion")}")
implementation("io.ktor:ktor-serialization-kotlinx-json:${property("ktorVersion")}")
implementation(project.dependencies.enforcedPlatform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${property("kotlinWrappersVersion")}"))
implementation("org.jetbrains.kotlin-wrappers:kotlin-react")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-redux")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-redux")
implementation("org.jetbrains.kotlin-wrappers:kotlin-mui")
implementation("org.jetbrains.kotlin-wrappers:kotlin-mui-icons")
implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion")
implementation("org.jetbrains.kotlin-wrappers:kotlin-css")
implementation("org.jetbrains.kotlin-wrappers:kotlin-styled")
implementation(npm("node-polyglot", "2.4.0"))
implementation(npm("react-ace", "9.5.0"))
implementation(npm("ace-builds","^1.4.13" ))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
javafx {
version = "14"
modules("javafx.controls", "javafx.graphics", "javafx.web")
}
/**
* Utility function to retrieve the current version number.
*/
task("printVersion") {
doLast {
println(project.version)
}
}
tasks.withType<Jar> {
setProperty("zip64", true)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest {
attributes["Main-Class"] = "ServerKt"
exclude("META-INF/*.SF",
"META-INF/*.DSA",
"META-INF/*.RSA"
)
}
// To add all of the dependencies otherwise a "NoClassDefFoundError" error
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get()
.filter { it.name.endsWith("jar") }
.map { zipTree(it) }
})
}
tasks.named<Copy>("jvmProcessResources") {
duplicatesStrategy = DuplicatesStrategy.WARN
}
tasks.named<Test>("jvmTest") {
useJUnitPlatform()
}
application {
mainClass.set("ServerKt")
}
// include JS artifacts in any JAR we generate
tasks.getByName<Jar>("jvmJar") {
val taskName = if (project.hasProperty("isProduction")) {
"jsBrowserProductionWebpack"
} else {
"jsBrowserDevelopmentWebpack"
}
val webpackTask = tasks.getByName<KotlinWebpack>(taskName)
dependsOn(webpackTask) // make sure JS gets compiled first
from(File(webpackTask.destinationDirectory, webpackTask.outputFileName)) // bring output file along into the JAR
}
tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
}
}
}
distributions {
main {
contents {
from("$buildDir/libs") {
rename("${rootProject.name}-jvm", rootProject.name)
into("lib")
}
}
}
}
// Alias "installDist" as "stage" (for cloud providers)
tasks.create("stage") {
dependsOn(tasks.getByName("installDist"))
}
tasks.getByName<JavaExec>("run") {
classpath(tasks.getByName<Jar>("jvmJar")) // so that the JS artifacts generated by `jvmJar` can be found and served
}