-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
199 lines (178 loc) · 7.91 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
// support for javafx11 - see https://openjfx.io/openjfx-docs/#gradle
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.0'
// https://github.com/ben-manes/gradle-versions-plugin
// task: dependencyUpdates
classpath 'com.github.ben-manes:gradle-versions-plugin:0.42.0'
}
}
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.google.osdetector'
// apply plugin: 'maven' // - to be removed for Gradle 7.*
apply plugin: 'maven-publish'
apply plugin: 'distribution'
// see https://github.com/kelemen/netbeans-gradle-project/issues/179
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
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.helper.test.TestWebView'
}
mainClassName = 'tf.helper.test.TestWebView'
def appName='JavaHelper'
group='tf.JavaHelper'
version='1.15'
description = 'Helper for all ThomasDaheim Java applications'
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
}
dependencies {
// def javafx_version='11.0.2'
// def javafx_version='14'
def javafx_version='15.0.1'
// def javafx_version='17.0.1'
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"
implementation 'commons-io:commons-io:2.6'
implementation 'org.apache.commons:commons-lang3:3.9'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.15'
implementation group: 'org.controlsfx', name: 'controlsfx', version: '11.0.1'
implementation group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.14'
testImplementation "org.testfx:testfx-junit:4.0.+"
testImplementation "org.testfx:testfx-core:4.0.+"
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.2'
}
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.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.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.controls/com.sun.javafx.scene.control.skin.resources=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.graphics/com.sun.javafx.scene.input=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.util=ALL-UNNAMED',
'--add-exports', 'javafx.media/com.sun.media.jfxmedia=ALL-UNNAMED',
'--add-exports', 'javafx.media/com.sun.media.jfxmedia.events=ALL-UNNAMED',
'--add-opens', 'javafx.graphics/javafx.scene.layout=ALL-UNNAMED',
]
// extend Netbeans Gradle "Run" task
run {
doFirst {
jvmArgs = jvmArgs.plus(['--module-path', classpath.asPath,])
jvmArgs = jvmArgs.plus(newArgs)
jvmArgs '-Xss80M'
enableAssertions = true
}
}
test {
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;
}
// 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)
}
}
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' : version,
'App-URL' : "https://github.com/ThomasDaheim/JavaHelper"
)
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
build.finalizedBy(installDist, publishToMavenLocal)