-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
333 lines (296 loc) · 14.5 KB
/
build.gradle
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
// support for javafx11 - see https://openjfx.io/openjfx-docs/#gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.3'
// https://github.com/ben-manes/gradle-versions-plugin
// task: dependencyUpdates
classpath 'com.github.ben-manes:gradle-versions-plugin:0.45.0'
classpath 'org.openjfx:javafx-plugin:0.1.0'
}
}
plugins {
id 'org.beryx.runtime' version '1.12.7'
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.google.osdetector'
apply plugin: 'maven-publish'
// TFE, 20230914: build support for executables - WORK IN PROGRESS
// https://foojay.io/today/building-javafx-with-gradle/
apply plugin: 'org.openjfx.javafxplugin'
javafx {
version = '19.0.2'
modules = [ 'javafx.controls', 'javafx.graphics', 'javafx.base', 'javafx.fxml', 'javafx.web', 'javafx.swing', 'javafx.media' ]
platform = 'win'
sdk = 'D:/Thomas/Development/Java/javafx-sdk-19.0.2.1' // on mac
}
application {
mainClass = "tf.gpx.edit.main.Launcher"
applicationName = 'GPXEditor'
}
// https://badass-runtime-plugin.beryx.org/releases/latest/
// https://github.com/beryx-gist/badass-runtime-example-javafx
runtime {
// Some default options
options = ['--verbose', '--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
// Pack it!
launcher {
noConsole = true
}
jpackage {
// Could be taken from command line, here it is defined statically
// project.findProperty('installerOs')
// (example: -PinstallerOs=mac)
targetPlatformName = 'win'
// The app name
imageName = 'GPXEditor'
// Add jpackage-specific options
installerOptions = [
'--name', 'GPXEditor',
'--description', 'GPXEditor - JavaFX GPX file editor'
]
imageOptions += ['--icon', 'src/main/resources/GPXEditorManager.ico']
installerOptions += [
// '--win-per-user-install', // Install only for current user
// '--win-console', // Shows what Java outputs to the console
'--win-dir-chooser',
'--win-menu', '--win-shortcut'
]
}
}
// see https://github.com/kelemen/netbeans-gradle-project/issues/179
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
apply plugin: 'com.github.ben-manes.versions' // provides dependencyUpdates command
ext.platform = osdetector.os == 'osx' ? 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
// NetBeans will automatically add "run" and "debug" tasks relying on the
// "mainClass" property. You may however define the property prior executing
// tasks by passing a "-PmainClass=<QUALIFIED_CLASS_NAME>" argument.
//
// Note however, that you may define your own "run" and "debug" task if you
// prefer. In this case NetBeans will not add these tasks but you may rely on
// your own implementation.
if (!hasProperty('mainClass')) {
ext.mainClass = 'tf.gpx.edit.main.GPXEditorManager'
}
mainClassName = 'tf.gpx.edit.main.GPXEditorManager'
def appName='GPXEditor'
group='tf.GPXEditor'
version='5.9'
description = 'GPXEditor - JavaFX GPX file editor'
repositories {
mavenLocal() {
// breaking change in gradle 6.*: doesn't find jar files automatically when no pom.xml is present...
// https://discuss.gradle.org/t/how-to-fetch-maven-artifact-without-pom-file-in-gradle-6-0/33836
metadataSources {
mavenPom()
artifact()
}
}
mavenCentral()
// You may define additional repositories, or even remove "mavenCentral()".
// Read more about repositories here:
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories
maven {
url "https://maven.jzy3d.org/releases"
}
}
dependencies {
// JavaFX11 explicit dependencies
// def javafx_version='11.0.2'
// def javafx_version='14'
// def javafx_version='15.0.1'
// def javafx_version='17.0.1'
def javafx_version='19.0.2'
implementation "org.openjfx:javafx-base:$javafx_version:$platform"
implementation "org.openjfx:javafx-graphics:$javafx_version:$platform"
implementation "org.openjfx:javafx-controls:$javafx_version:$platform"
implementation "org.openjfx:javafx-fxml:$javafx_version:$platform"
implementation "org.openjfx:javafx-swing:$javafx_version:$platform"
implementation "org.openjfx:javafx-web:$javafx_version:$platform"
implementation "org.openjfx:javafx-media:$javafx_version:$platform"
// TFE, 20191209: our own helper library
implementation 'tf.JavaHelper:JavaHelper:1.16'
implementation 'commons-cli:commons-cli:1.5.0'
implementation 'commons-io:commons-io:2.11.0'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.10.0'
implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.22'
implementation 'me.himanshusoni.gpxparser:gpx-parser:1.14'
implementation group: 'org.controlsfx', name: 'controlsfx', version: '11.1.2'
implementation 'de.jensd:fontawesomefx:8.9'
// TFE, 20210310: not working since GlyphsDude not found
// https://bitbucket.org/Jerady/fontawesomefx/issues/72/glyphsdude-and-package
// compile 'de.jensd:fontawesomefx-commons:9.1.2'
// compile 'de.jensd:fontawesomefx-emojione:3.1.1-9.1.2'
// compile 'de.jensd:fontawesomefx-fontawesome:4.7.0-9.1.2'
// compile 'de.jensd:fontawesomefx-icons525:4.6.3'
// compile 'de.jensd:fontawesomefx-materialdesignfont:2.0.26-9.1.2'
// compile 'de.jensd:fontawesomefx-materialicons:2.2.0-9.1.2'
// compile 'de.jensd:fontawesomefx-materialstackicons:2.1-5-9.1.2'
// compile 'de.jensd:fontawesomefx-octicons:4.3.0-9.1.2'
// compile 'de.jensd:fontawesomefx-weathericons:2.0.10-9.1.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.14.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.2'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.14.2'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-csv', version: '2.14.2'
implementation group: 'de.grundid.opendatalab', name: 'geojson-jackson', version: '1.14'
implementation group: 'org.jfxtras', name: 'jfxtras-controls', version: '15-r2'
implementation group: 'org.jfxtras', name: 'jfxtras-labs', version: '9.0-r1'
implementation group: 'org.jfxtras', name: 'jmetro', version: '11.6.16'
implementation 'uk.com.robust-it:cloning:1.9.12'
implementation group: 'org.im4java', name: 'im4java', version: '1.4.0'
// TFE, 20211222: Savitzky-Golay-Filter for track smoothing
implementation group: 'io.github.ruozhuochen', name: 'savitzky-golay-filter', version: '1.0.1'
// TFE, 20220115: 3rd alternative: fxyz3d
implementation 'org.fxyz3d:fxyz3d:0.5.4'
// TFE, 20220201: faster list
implementation group: 'org.magicwerk.brownies', name: 'brownies-collections', version: '0.9.19'
// sun data
// TODO: upgrade to 0.1.7 and fix breaking changes
implementation group: 'net.e175.klaus', name: 'solarpositioning', version: '0.0.9'
// timezone provider
implementation group: 'us.dustinj.timezonemap', name: 'timezonemap', version: '4.5'
implementation group: 'com.github.luben', name: 'zstd-jni', version: '1.5.2-5'
// TFE, 20220320: change to charts based on canvas for performance
// latest version compatible with javafx 15 is for 11
implementation 'eu.hansolo.fx:charts:17.1.27'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.9.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.9.2'
// TFE, 20221231: build a test suite for all non-UI tests
testImplementation group: 'org.junit.platform', name: 'junit-platform-suite-engine', version: '1.9.2'
// TFE, 20210216: capture System.err() easily
testImplementation group: 'com.github.stefanbirkner', name: 'system-lambda', version: '1.2.1'
}
task unzip(type: Copy) {
def zipFile = file("${buildDir}/distributions/GPXEditor-${version}.zip")
def outputDir = file("dist")
from zipTree(zipFile)
into outputDir
}
compileJava {
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls,javafx.graphics,javafx.base,javafx.fxml,javafx.web,javafx.swing,javafx.media',
'-Xlint:unchecked',
'-Xlint:deprecation',
]
}
}
// see https://github.com/kelemen/netbeans-gradle-project/issues/403 on how to extend gradle tasks
def newArgs = [ '--add-modules', 'javafx.controls,javafx.graphics,javafx.base,javafx.fxml,javafx.web,javafx.swing,javafx.media',
// various exports needed at run time - see https://stackoverflow.com/a/52142071
'--add-exports', 'javafx.graphics/com.sun.javafx.util=ALL-UNNAMED',
'--add-exports', 'javafx.base/com.sun.javafx.reflect=ALL-UNNAMED',
'--add-exports', 'javafx.base/com.sun.javafx.beans=ALL-UNNAMED',
'--add-exports', 'javafx.base/com.sun.javafx.logging=ALL-UNNAMED',
'--add-exports', 'javafx.base/com.sun.javafx.runtime=ALL-UNNAMED',
'--add-exports', 'javafx.base/com.sun.javafx.collections=ALL-UNNAMED',
'--add-exports', 'javafx.base/com.sun.javafx.event=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.prism=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED',
'--add-exports', 'javafx.media/com.sun.media.jfxmedia=ALL-UNNAMED',
'--add-exports', 'javafx.media/com.sun.media.jfxmedia.events=ALL-UNNAMED',
'--add-exports', 'javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED',
'--add-exports', 'javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED',
'--add-exports', 'javafx.controls/com.sun.javafx.scene.control.inputmap=ALL-UNNAMED',
'--add-exports', 'javafx.controls/com.sun.javafx.charts=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.scene.traversal=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED',
'--add-exports', 'javafx.base/com.sun.javafx.collections=ALL-UNNAMED',
'--add-opens', 'javafx.graphics/javafx.scene.layout=ALL-UNNAMED',
// TFE, 20200803: workaround for "WARNING: Illegal reflective access by com.rits.cloning.Cloner"
// https://github.com/x-stream/xstream/issues/101#issuecomment-667734663
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
// TFE, 20230616: needed for cloning metadata
'--add-opens', 'java.base/java.time=ALL-UNNAMED',
'--add-opens', 'java.base/java.time.zone=ALL-UNNAMED',
'--add-opens', 'java.base/sun.util.calendar=ALL-UNNAMED',
]
// extend Netbeans Gradle "Run" task
run {
doFirst {
jvmArgs = jvmArgs.plus(['--module-path', classpath.asPath,])
jvmArgs = jvmArgs.plus(newArgs)
jvmArgs = jvmArgs.plus('-Xss80M')
jvmArgs = jvmArgs.plus('-Xmx4096M')
// profiler not working with netbeans...
// jvmArgs = jvmArgs.plus('-agentpath:"C:/PROGRA~1/NetBeans-12.0/netbeans/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll=C:/PROGRA~1/NetBeans-12.0/netbeans/profiler/lib",5140')
// jvmArgs = jvmArgs.plus('-agentpath:"C:/PROGRA~1/visualvm_212/visualvm/lib/deployed/jdk16/windows-amd64/profilerinterface.dll"="C:/PROGRA~1/visualvm_212/visualvm/lib",5140')
enableAssertions = true
}
args = ["-mapCenter", "46.660578140310854 11.15942716598511"]
// args = ["-mergeFiles", "P:/Pictures/Raw/GPX/*.gpx"]
}
test {
// exclude '**/*'
doFirst {
jvmArgs = jvmArgs.plus(['--module-path', classpath.asPath,])
jvmArgs = jvmArgs.plus(newArgs)
jvmArgs = jvmArgs.plus('-Xss80M')
jvmArgs = jvmArgs.plus('-Xmx4096M')
enableAssertions = true
}
// https://stackoverflow.com/a/35467005
testLogging.showStandardStreams true;
useJUnitPlatform()
}
// extend Netbeans Gradle "Debug" task
task(debug, dependsOn: 'classes', type: JavaExec) {
doFirst {
main = 'tf.gpx.edit.main.GPXEditorManager'
classpath = sourceSets.main.runtimeClasspath
jvmArgs = jvmArgs.plus([
'--module-path', classpath.asPath,
"-Xdebug",
"-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005",
])
jvmArgs = jvmArgs.plus(newArgs)
jvmArgs = jvmArgs.plus('-Xss80M')
jvmArgs = jvmArgs.plus('-Xmx4096M')
}
}
jar {
manifest {
attributes(
'Built-By' : System.properties['user.name'],
'Build-Timestamp': new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}",
'App-Name' : appName,
'App-Version' : archiveVersion,
'App-URL' : "https://github.com/ThomasDaheim/GPXEditor"
)
}
}
sourceSets {
main {
resources {
// only use minified files
exclude {
FileTreeElement elem -> ((elem.name.contains('.js') || elem.name.contains('.css')) && !elem.name.contains('.min.'))
}
}
}
}
build.finalizedBy(installDist)