-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild.gradle.kts
59 lines (51 loc) · 1.37 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream
val mainClassName = "LauncherKt"
dependencies {
implementation(project(":server"))
implementation(project(":json"))
implementation(project(":i18n"))
implementation(project(":jdbc"))
implementation(project(":slf4j"))
implementation(project(":oauth"))
implementation(project(":openapi"))
implementation(libs.postgresql)
testImplementation(project(":jdbc-test"))
}
sourceSets {
main {
resources.srcDirs("db", "i18n")
}
}
tasks.register<Copy>("deps") {
into("$buildDir/libs/deps")
from(configurations.runtimeClasspath)
}
tasks.jar {
dependsOn("deps")
doFirst {
manifest {
attributes(
"Main-Class" to mainClassName,
"Class-Path" to File("$buildDir/libs/deps").listFiles()?.joinToString(" ") { "deps/${it.name}"}
)
}
}
}
tasks.register<JavaExec>("run") {
mainClass.set(mainClassName)
classpath = sourceSets.main.get().runtimeClasspath
}
tasks.register<JavaExec>("types.ts") {
dependsOn("classes")
mainClass.set("klite.json.TSGenerator")
classpath = sourceSets.main.get().runtimeClasspath
args("${project.buildDir}/classes/kotlin/main")
standardOutput = ByteArrayOutputStream()
doLast {
project.file("build/types.ts").writeText(standardOutput.toString())
}
}
tasks.withType<KotlinCompile> {
finalizedBy("types.ts")
}