-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
220 lines (198 loc) · 9.14 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
/*
* This build file was auto generated by running the Gradle 'init' task
* by 'markus' at '06.10.15 11:58' with Gradle 2.7
*
* This generated file contains a commented-out sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/2.7/userguide/tutorial_java_projects.html
*/
// 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.1'
// https://github.com/ben-manes/gradle-versions-plugin
// task: dependencyUpdates
classpath 'com.github.ben-manes:gradle-versions-plugin:0.44.0'
}
}
// TFE, 20220122: leads to errors with gradle 7.*...
// // Use a plugin (https://github.com/crotwell/gradle-macappbundle) to create a Mac OS X .app and .dmg
// plugins {
// id "edu.sc.seis.macAppBundle" version "2.3.0"
// }
// macAppBundle {
// mainClassName = "tf.ownnote.ui.main.OwnNoteEditorManager"
// icon = "src/main/resources/ownNoteEditor.icns"
// volumeName = "ownNoteEditor"
// dmgName = "ownNoteEditor"
// // TFE, 20200504: some change in Gradle now requires values for below attributes - but I have no clue what to put here...
// backgroundImage = "TBD"
// certIdentity = "TBD"
// jreHome = "TBD"
// keyChain = "TBD"
// javaProperties.put("apple.laf.useScreenMenuBar", "true")
// // Uncomment the next line to bundle the JRE with the Mac OS X application
// //bundleJRE = true
// }
// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.google.osdetector'
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'
// In this section you declare where to find the dependencies of your project
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()
}
}
// Use 'jcenter' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
if (!hasProperty('mainClass')) {
ext.mainClass = 'tf.ownnote.ui.main.OwnNoteEditorManager'
}
mainClassName = 'tf.ownnote.ui.main.OwnNoteEditorManager'
def appName='OwnNoteEditor'
group='tf.OwnNoteEditor'
version='6.1'
description = 'ownNoteEditor - JavaFX html notes editor'
// In this section you declare the dependencies for your production and test code
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'
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, 20200809: use our own helper library
implementation 'tf.JavaHelper:JavaHelper:1.15'
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 group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.15'
implementation group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.19'
implementation group: 'org.unbescape', name: 'unbescape', version: '1.1.6.RELEASE'
implementation group: 'org.jfxtras', name: 'jfxtras-controls', version: '15-r2'
implementation group: 'org.controlsfx', name: 'controlsfx', version: '11.1.2'
// new look & feel for old code :-)
implementation group: 'org.jfxtras', name: 'jmetro', version: '11.6.16'
implementation 'de.jensd:fontawesomefx:8.9'
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.9.1'
// TFE, 20210121: 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/OwnNoteEditor-${version}.zip")
def outputDir = file("dist")
from zipTree(zipFile)
into outputDir
}
compileJava {
doFirst {
options.compilerArgs = [
'-g',
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls,javafx.graphics,javafx.base,javafx.fxml,javafx.web,javafx.swing,javafx.media',
'-Xlint:unchecked',
'-Xlint:deprecation',
'-Xdiags:verbose'
]
}
}
// 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.collections=ALL-UNNAMED',
'--add-exports', 'javafx.controls/com.sun.javafx.scene.control=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.util=ALL-UNNAMED',
'--add-exports', 'javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED',
'--add-exports', 'javafx.media/com.sun.media.jfxmedia=ALL-UNNAMED',
'--add-exports', 'javafx.media/com.sun.media.jfxmedia.events=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',
'--add-opens', 'javafx.base/com.sun.javafx.collections=ALL-UNNAMED',
'--add-opens', 'javafx.graphics/javafx.scene.layout=ALL-UNNAMED',
]
// extend Netbeans Gradle "Run" task
run {
doFirst {
// show loaded jars & classes
// jvmArgs = jvmArgs.plus(['--module-path', classpath.asPath, '-Xlog:class+load=info:classloaded.txt',])
jvmArgs = jvmArgs.plus(['--module-path', classpath.asPath,])
jvmArgs = jvmArgs.plus(newArgs)
enableAssertions = true
}
}
test {
doFirst {
jvmArgs = jvmArgs.plus(['-Dtestfx.robot=awt'])
}
}
// extend Netbeans Gradle "Debug" task
task(debug, dependsOn: 'classes', type: JavaExec) {
doFirst {
main = 'tf.ownnote.ui.main.OwnNoteEditorManager'
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)
enableAssertions = true
}
}
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/ownNoteEditor"
)
}
}
sourceSets {
main {
resources {
// only use minified files
exclude {
FileTreeElement elem -> ((elem.name.contains('.js') || elem.name.contains('.css')) && !elem.name.contains('.min.'))
}
}
}
}