-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
75 lines (65 loc) · 2.02 KB
/
Copy pathbuild.gradle
File metadata and controls
75 lines (65 loc) · 2.02 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
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.14'
id 'java'
id 'org.flywaydb.flyway' version '10.10.0'
}
group = 'com.clinicmanager'
version = '1.0'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.xerial:sqlite-jdbc:3.43.2.1'
implementation 'org.slf4j:slf4j-api:2.0.13'
runtimeOnly 'org.slf4j:slf4j-simple:2.0.13'
implementation 'org.flywaydb:flyway-core:10.10.0'
implementation 'org.mindrot:jbcrypt:0.4'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'com.tngtech.archunit:archunit-junit5:1.3.0'
}
application {
mainClass = 'com.clinicmanager.gui.MainFX'
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
javafx {
version = "21.0.1"
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
test {
useJUnitPlatform()
}
def dbPathProperty = project.findProperty('dbPath') as String
def resolvedDbUrl
if (dbPathProperty) {
if (dbPathProperty.startsWith('jdbc:')) {
resolvedDbUrl = dbPathProperty
} else {
def dbFile = project.layout.projectDirectory.file(dbPathProperty).asFile
def parentDir = dbFile.parentFile
if (parentDir != null && !parentDir.exists()) {
parentDir.mkdirs()
}
resolvedDbUrl = "jdbc:sqlite:${dbFile.absolutePath}"
}
} else {
def defaultDbFile = project.layout.projectDirectory.file('clinic.db').asFile
resolvedDbUrl = "jdbc:sqlite:${defaultDbFile.absolutePath}"
}
flyway {
url = resolvedDbUrl
driver = 'org.sqlite.JDBC'
locations = ['filesystem:src/main/resources/db/migration']
configurations = ['runtimeClasspath']
cleanDisabled = true
}
tasks.register('initDatabase', JavaExec) {
group = 'database'
description = 'Initializes the local SQLite database using Flyway migrations.'
classpath = sourceSets.main.runtimeClasspath
mainClass.set('com.clinicmanager.tools.DatabaseSetup')
args(project.findProperty('dbPath') ?: 'clinic.db')
}