forked from squirrel-sql-client/squirrel-sql-code
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
149 lines (121 loc) · 3.32 KB
/
build.gradle
File metadata and controls
149 lines (121 loc) · 3.32 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
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.1.0'
}
group = 'squirrel-sql'
def currDate = new Date()
def DSTAMP = currDate.format('yyyyMMdd')
def TSTAMP = currDate.format('HHmm')
//DEFINE VERSION HERE ONLY
//version = '0.' //release version
version = "snapshot-${DSTAMP}_${TSTAMP}" //development version
defaultTasks 'buildAll'
ext {
mainClassName = 'org.squirrelsql.Main'
launcherClassName = 'org.squirrelsql.Launcher'
//3rd-party libraries in core/lib, for the compile classpath
coreLibClasspath = fileTree(dir: 'core/lib', include: '*.jar', exclude: 'versioncheck.jar')
javafxVersion = '17.0.19'
}
repositories {
mavenCentral()
mavenLocal()
}
compileJava {
options.release = 17
options.encoding = 'UTF-8'
}
javafx {
version = javafxVersion
modules = ['javafx.controls', 'javafx.fxml', 'javafx.swing']
}
dependencies {
implementation coreLibClasspath
}
application {
mainClass = project.mainClassName
}
sourceSets {
main {
java {
srcDirs = ['core/src']
}
resources {
//initialize the srcDirs property to remove the default src/main/resources,
//and add other resources from core/src (excluding *.java by default)
srcDirs = ['core/src']
}
}
}
processResources {
filesMatching('org/squirrelsql/splash/Version.properties') {
filter { line ->
line.replace('squirrelsql.version.value', version)
}
filteringCharset = java.nio.charset.StandardCharsets.UTF_8
}
}
jar {
archiveFileName = "squirrel-sql-fx.jar"
manifest {
attributes(
'Main-Class': project.launcherClassName,
'Class-Path': configurations.runtimeClasspath.collect { 'lib/' + it.name }.join(' '),
'JavaFX-Version': javafxVersion,
'Built-By': System.getProperty('user.name'),
'Created-By': System.getProperty('java.runtime.version') + ' (' + System.getProperty('java.vendor') + ')',
'Gradle-Version': 'Gradle ' + gradle.getGradleVersion(),
)
}
}
run {
//args '--p=<propertiesFilePath>'
debugOptions {
enabled = true
port = 5566
server = true
suspend = false
}
}
//custom task for creating zip distribution
task createZipDistribution(type: Zip) {
def osString = javafx.platform.classifier
destinationDirectory = file("$buildDir/plainZip")
def internalFolder = "squirrelsqlfx-$project.version-$osString"
archiveFileName = internalFolder + '.zip'
into internalFolder
from jar
if (osString.startsWith('win')) {
from ('launcher') {
include '*.bat'
}
}
else {
from ('launcher') {
include '*.sh'
}
}
from ('core') {
include 'doc/**'
}
from ('core/lib') {
include 'versioncheck.jar'
into 'versioncheck'
}
//include JavaFX native libraries (of the current OS running the build)
//to the 'lib' sub-folder
from (configurations.runtimeClasspath) {
into 'lib'
}
from ('core/src/org/squirrelsql/globalicons') {
include 'splash.jpg'
into 'icons'
}
}
task runApp {
//execute the 'application' plugin's run task
dependsOn run
}
task buildAll {
dependsOn createZipDistribution
}