-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
90 lines (71 loc) · 2.53 KB
/
build.gradle.kts
File metadata and controls
90 lines (71 loc) · 2.53 KB
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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
java
application
id("com.gradleup.shadow") version "9.4.1"
}
group = "com.codeheadsystems.hofmann"
version = "1.0.0-SNAPSHOT"
repositories {
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
application {
mainClass.set("com.codeheadsystems.hofmann.example.ExampleApplication")
}
dependencies {
implementation("com.codeheadsystems:hofmann-dropwizard:1.3.2")
implementation("io.dropwizard:dropwizard-core:5.0.1")
implementation("io.dropwizard:dropwizard-auth:5.0.1")
implementation("io.dropwizard:dropwizard-assets:5.0.1")
implementation("com.google.dagger:dagger:2.59.2")
annotationProcessor("com.google.dagger:dagger-compiler:2.59.2")
// Database
implementation("com.h2database:h2:2.4.240")
implementation("org.jdbi:jdbi3-core:3.52.1")
implementation("com.zaxxer:HikariCP:7.0.2")
testImplementation("org.junit.jupiter:junit-jupiter:6.0.3")
testImplementation("org.assertj:assertj-core:3.27.7")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.named<Test>("test") {
useJUnitPlatform()
}
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-Xlint:unchecked")
}
// ── Frontend build ────────────────────────────────────────────────────────────
val npmInstall = tasks.register<Exec>("npmInstall") {
workingDir = file("frontend")
commandLine("npm", "install")
}
val npmBuild = tasks.register<Exec>("npmBuild") {
dependsOn(npmInstall)
workingDir = file("frontend")
commandLine("npm", "run", "build")
}
val generatedFrontendDir = layout.buildDirectory.dir("generated-frontend")
val copyFrontend = tasks.register<Copy>("copyFrontend") {
dependsOn(npmBuild)
from(file("frontend/dist"))
into(generatedFrontendDir.map { it.dir("frontend") })
}
// Expose generated directory as a resource source so processResources picks it up
sourceSets.main {
resources.srcDir(generatedFrontendDir)
}
tasks.named("processResources") {
dependsOn(copyFrontend)
}
// Remove H2 database files on clean (keeps the .emptydir placeholder)
tasks.named<Delete>("clean") {
delete(fileTree("data") { include("*.db") })
}
// Merge META-INF/services/* so Dropwizard's connector/provider registrations survive fat-jar packaging
tasks.withType<ShadowJar>().configureEach {
mergeServiceFiles()
}