-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
167 lines (138 loc) · 4.62 KB
/
build.gradle
File metadata and controls
167 lines (138 loc) · 4.62 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
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
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.node-gradle.node' version '3.5.1'
}
group 'net.seitter.studiodb'
version '1.0-SNAPSHOT'
sourceCompatibility = 11
targetCompatibility = 11
repositories {
mavenCentral()
}
dependencies {
implementation 'org.slf4j:slf4j-api:2.0.9'
implementation 'ch.qos.logback:logback-classic:1.4.11'
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'org.antlr:antlr4-runtime:4.9.3'
// JLine console dependencies
implementation 'org.jline:jline-terminal:3.21.0'
implementation 'org.jline:jline-reader:3.21.0'
implementation 'org.jline:jline-terminal-jansi:3.21.0' // For Windows support
// Web server dependencies
implementation 'io.javalin:javalin:5.6.3'
implementation 'org.webjars.npm:swagger-ui-dist:5.10.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2'
// WebSocket support
implementation 'org.eclipse.jetty.websocket:websocket-jetty-server:11.0.15'
implementation 'org.eclipse.jetty.websocket:websocket-jetty-client:11.0.15'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
}
application {
mainClass = 'net.seitter.studiodb.StudioDB'
}
// Configuration for the shadow jar (fat jar) plugin
shadowJar {
archiveBaseName.set('studiodb')
archiveClassifier.set('')
archiveVersion.set(project.version.toString())
manifest {
attributes 'Main-Class': application.mainClass
}
mergeServiceFiles()
}
// Node plugin configuration for the frontend
node {
version = '18.17.1'
download = true
nodeProjectDir = file("${project.projectDir}/web-ui")
}
// Task to create React app if it doesn't exist
task createReactApp(type: Exec) {
workingDir = file("${project.projectDir}")
commandLine 'node_modules/.bin/create-vite', 'web-ui', '--template', 'react-ts'
doFirst {
if (!file("${project.projectDir}/web-ui").exists()) {
// Install create-vite if not already installed
exec {
workingDir = file("${project.projectDir}")
commandLine 'npm', 'install', 'create-vite'
}
} else {
// Skip if web-ui directory already exists
logger.info('web-ui directory already exists, skipping creation')
commandLine 'echo', 'Skipping create-vite, web-ui already exists'
}
}
}
// Task to build the React app
task buildReactApp(type: NpmTask) {
dependsOn npmInstall
args = ['run', 'build']
workingDir = file("${project.projectDir}/web-ui")
doFirst {
// Skip the task if web-ui doesn't exist yet
if (!file("${project.projectDir}/web-ui").exists()) {
logger.info('web-ui directory doesn\'t exist, skipping build')
commandLine 'echo', 'Skipping build, web-ui doesn\'t exist'
enabled = false
}
}
}
// Task to copy the built React app to the resources directory
task copyReactApp(type: Copy) {
dependsOn buildReactApp
from "${project.projectDir}/web-ui/dist"
into "${project.buildDir}/resources/main/public"
doFirst {
// Skip the task if dist directory doesn't exist
if (!file("${project.projectDir}/web-ui/dist").exists()) {
logger.info('web-ui/dist directory doesn\'t exist, skipping copy')
enabled = false
}
}
}
// Make the build task depend on copyReactApp if web-ui exists
tasks.named('processResources') {
if (file("${project.projectDir}/web-ui").exists()) {
dependsOn(copyReactApp)
}
}
// Custom task to run with visualization interface
task runWithViz(type: JavaExec) {
dependsOn classes
group = 'application'
description = 'Runs StudioDB with visualization interface'
classpath = sourceSets.main.runtimeClasspath
mainClass = application.mainClass
args = ['--viz']
}
// Configure task dependencies
tasks.named('distTar') {
dependsOn tasks.named('shadowJar')
}
tasks.named('distZip') {
dependsOn tasks.named('shadowJar')
}
tasks.named('startScripts') {
dependsOn tasks.named('shadowJar')
}
tasks.named('startShadowScripts') {
dependsOn tasks.named('jar')
}
tasks.named('shadowDistTar') {
dependsOn tasks.named('jar')
}
tasks.named('shadowDistZip') {
dependsOn tasks.named('jar')
}
// Make the build task depend on shadowJar
tasks.named('build') {
dependsOn tasks.named('shadowJar')
}
test {
useJUnitPlatform()
}