-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
126 lines (105 loc) · 2.92 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version libs.versions.kotlin
id("com.github.johnrengelman.shadow") version "8.1.1"
}
allprojects {
configurations.all {
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
}
repositories {
mavenLocal()
mavenCentral()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/veupathdb/maven-packages")
credentials {
username = if (extra.has("gpr.user")) extra["gpr.user"] as String? else System.getenv("GITHUB_USERNAME")
password = if (extra.has("gpr.key")) extra["gpr.key"] as String? else System.getenv("GITHUB_TOKEN")
}
}
}
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
}
}
tasks.withType<JavaCompile> {
sourceCompatibility = "21"
targetCompatibility = "21"
}
tasks.withType<Test> {
testLogging {
events(
TestLogEvent.FAILED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.PASSED
)
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
}
tasks.shadowJar {
exclude("**/Log4j2Plugins.dat")
archiveFileName.set("service.jar")
manifest {
attributes["Main-Class"] = "vdi.bootstrap.Main"
}
}
tasks.register("compile-design-doc") {
doLast {
val command = arrayOf(
"asciidoctor",
"--backend", "html5",
"--out-file", "docs/design/1.0/design.html",
"docs/design/1.0/design.adoc"
)
println("Running ASCIIDoctor")
println(command.joinToString(" "))
with(ProcessBuilder(*command).start()) {
errorStream.bufferedReader().use { it.lines().forEach(::println) }
if (waitFor() != 0) {
throw RuntimeException("ASCIIDoctor command execution failed.")
}
}
}
}
tasks.register("generate-raml-docs") {
dependsOn(":service:rest-service:generate-raml-docs")
doLast {
val restModule = project(":service:rest-service")
val docsDir = file("docs")
docsDir.mkdir()
val docFiles = arrayOf(
// Source File to Target File
restModule.projectDir.resolve("docs/api.html") to docsDir.resolve("vdi-api.html"),
)
for ((source, target) in docFiles) {
target.delete()
source.copyTo(target)
source.delete()
}
}
}
tasks.register("download-dependencies") {
configurations {
create("download") {
project.versionCatalogs.forEach { catalog ->
catalog.libraryAliases.forEach { libName ->
dependencies.addLater(catalog.findLibrary(libName).get())
}
}
this.files
}
}
}
dependencies {
implementation(project(":service:bootstrap"))
}