forked from ppanopticon/virtual-exhibition-manager
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle
173 lines (137 loc) · 5.07 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
plugins {
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
id 'org.jetbrains.kotlin.plugin.serialization' version "$kotlinVersion"
id 'org.openapi.generator' version "$openApiGenVersion"
id 'com.github.johnrengelman.shadow' version "$shadowJarVersion"
id 'de.undercouch.download' version "$downloadPluginVersion"
id 'java'
id 'application'
id 'idea'
}
// OpenAPI specifications (VREM & Cineast).
def specPath = "$rootDir/oas"
// Path for generated Cineast client sources.
def generatedPath = "$buildDir/generated"
// Path for Cineast OpenAPI specification.
def cineastOasPath = "$specPath/cineast-oas.json"
// VREM OpenAPI specification URL and local file.
def vremOasUrl = "http://localhost:4545/swagger-docs"
def vremOasPath = "$specPath/vrem-oas.json"
// Source/Target compatibility (currently used for source & target/JVM).
def javaCompatibility = 11
// Project settings.
group 'ch.unibas.dmi.dbis'
version '3.0.0'
// Main class.
mainClassName = 'ch.unibas.dmi.dbis.vrem.VREMKt'
// Only build the shadow jar and corresponding distributions.
jar.enabled = false
tasks.distZip.enabled = false
tasks.distTar.enabled = false
// Java properties.
java {
sourceCompatibility = javaCompatibility
targetCompatibility = javaCompatibility
}
// Application properties.
application {
applicationDefaultJvmArgs = ["-Xms2G", "-Xmx4G"]
}
// Add generated code to sources.
sourceSets {
main {
java {
srcDirs += "$generatedPath/src/main/kotlin/"
}
}
}
shadowJar {
mergeServiceFiles()
exclude 'META-INF', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA'
archiveClassifier.set('') // Remove "-all" suffix.
}
// Generate Cineast OpenAPI bindings.
task generateCineastClient(type: GenerateTask) {
generatorName = 'kotlin'
inputSpec = cineastOasPath
packageName = "ch.unibas.dmi.dbis.vrem.cineast.client"
outputDir = "$generatedPath"
skipValidateSpec = true
configOptions = [
enumPropertyNaming: "UPPERCASE"
]
}
// Requires a VREM server running on port 4545.
task downloadVremOas(type: Download) {
def f = new File(vremOasPath)
src vremOasUrl
dest f
}
task copyResources {
doLast {
copy {
from "config.json"
into "$buildDir/libs/"
}
}
}
task deploy {
dependsOn generateCineastClient, build, copyResources
}
// Regenerate OpenAPI code before building.
compileKotlin {
mustRunAfter generateCineastClient
dependsOn generateCineastClient
kotlinOptions.jvmTarget = javaCompatibility
}
compileTestKotlin {
mustRunAfter generateCineastClient
dependsOn generateCineastClient
kotlinOptions.jvmTarget = javaCompatibility
}
// Regenerate OpenAPI code upon cleaning.
clean {
finalizedBy generateCineastClient
}
// IntelliJ properties.
idea {
module {
// IntelliJ should download Javadoc.
downloadJavadoc = true
// Exclude directories from IntelliJ (indexing etc.).
excludeDirs += file("data")
excludeDirs += file("logs")
}
}
repositories {
mavenCentral()
}
dependencies {
// CLI.
implementation group: 'com.github.ajalt', name: 'clikt', version: "$cliktVersion"
// Kotlinx Serialization.
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-serialization-json', version: "$kotlinxSerializationVersion"
// KMongo.
implementation group: 'org.litote.kmongo', name: 'kmongo-serialization', version: "$kmongoVersion"
implementation group: 'org.litote.kmongo', name: 'kmongo-id-serialization', version: "$kmongoVersion"
// Javalin.
implementation group: 'io.javalin', name: 'javalin-bundle', version: "$javalinVersion"
// Jetty.
implementation group: 'org.eclipse.jetty.http2', name: 'http2-server', version: "$jettyVersion"
implementation group: 'org.eclipse.jetty', name: 'jetty-alpn-conscrypt-server', version: "$jettyVersion"
implementation group: 'org.eclipse.jetty.alpn', name: 'alpn-api', version: "$alpnApiVersion"
implementation group: 'org.mortbay.jetty.alpn', name: 'alpn-boot', version: "$alpnBootVersion"
// Fuel.
implementation group: 'com.github.kittinunf.fuel', name: 'fuel', version: "$fuelVersion"
implementation group: 'com.github.kittinunf.fuel', name: 'fuel-kotlinx-serialization', version: "$fuelVersion"
// OpenAPI Dependencies (OkHttp3 and Moshi Serialization).
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: "$okhttpVersion"
implementation group: 'com.squareup.moshi', name: 'moshi-kotlin', version: "$moshiVersion"
// Logging.
implementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: "$log4jslf4jVersion"
implementation group: 'io.github.microutils', name: 'kotlin-logging-jvm', version: "$kotlinLoggingVersion"
// Kotlin test & JUnit library.
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test', version: "$kotlinVersion"
testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: "$kotlinVersion"
}