-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathbuild.gradle
207 lines (175 loc) · 6.98 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
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.14'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id "org.beryx.runtime" version "1.13.0"
}
apply plugin: 'org.openjfx.javafxplugin'
apply plugin: 'com.github.johnrengelman.shadow'
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
javafx {
version = javaFX_version
modules = [ 'javafx.base', 'javafx.controls', 'javafx.fxml', 'javafx.graphics', 'javafx.swing', 'javafx.web']
}
dependencies {
implementation "org.jetbrains:annotations:${jetbrains_version}"
//test dependencies
testImplementation "junit:junit:${junit_version}"
//shadowed dependencies
implementation "org.jfree:org.jfree.fxgraphics2d:${fxgraphics_version}"
implementation "com.itextpdf:itextpdf:${itext_version}"
implementation "org.imgscalr:imgscalr-lib:${imgscalr_version}"
implementation "com.google.code.gson:gson:${gson_version}"
implementation "org.locationtech.jts:jts-core:${jts_version}"
implementation "org.apache.xmlgraphics:batik-svggen:${xml_graphics_version}"
implementation "org.apache.xmlgraphics:batik-dom:${xml_graphics_version}"
implementation "com.jhlabs:filters:${jhlabs_version}"
implementation "org.joml:joml:${joml_version}"
implementation "org.jcodec:jcodec:${jcodec_version}"
implementation "org.jcodec:jcodec-javase:${jcodec_version}"
implementation "org.apache.bcel:bcel:${bcel_version}"
implementation "com.aparapi:aparapi:${aparapi_version}"
implementation "org.controlsfx:controlsfx:${controlsfx_version}"
implementation "org.sejda.imageio:webp-imageio:${webp_imageio_version}" //google webp support
implementation "org.fxmisc.easybind:easybind:${easy_bind_version}"
implementation "org.apache.commons:commons-lang3:${apache_commons_lang3}"
implementation "org.apache.commons:commons-compress:${apache_compress}"
}
targetCompatibility = "19"
sourceCompatibility = "19"
project.setArchivesBaseName(app_name + "-" + app_version + "-" + app_state)
project.setApplicationName(app_name)
application {
mainClassName = 'drawingbot.Launcher'
applicationName = 'drawingbot'
applicationDefaultJvmArgs = ["-Dprism.verbose=true", "-Dprism.maxTextureSize=0"]
}
runtime {
//using --compress=1 to avoid issues with zip.dll loading - see: https://bugs.openjdk.java.net/browse/JDK-8254920?attachmentViewMode=list
options = ['--strip-debug', '--compress', '1', '--no-header-files', '--no-man-pages']
modules = [
'java.sql',
'java.desktop',
'java.naming',
'java.compiler',
'java.scripting',
'java.logging',
'java.xml.crypto',
'jdk.unsupported.desktop',
'java.management',
'jdk.jfr',
'jdk.unsupported',
'java.datatransfer',
'java.xml',
'jdk.xml.dom', //for Documentation
'java.net.http', //for Documentation
'jdk.crypto.ec' //for Documentation / Changelog HTTPs connection
]
jpackage{
def currentOs = org.gradle.internal.os.OperatingSystem.current()
def imgType = currentOs.windows ? 'ico' : currentOs.macOsX ? 'icns' : 'png'
imageOptions += ['--icon', "src/main/resources/images/icon.$imgType"]
appVersion = "$app_version"
installerOptions += ['--resource-dir', "src/main/resources"]
installerOptions += ['--vendor', 'Oliver Edward Lansdell']
installerOutputDir = file("$buildDir/jpackage-installers")
if(currentOs.windows) {
installerOptions += ['--win-dir-chooser', '--win-menu', '--win-shortcut']
installerType = 'msi'
}
else if (currentOs.linux) {
installerOptions += ['--linux-package-name', "drawingbotv3",'--linux-shortcut']
}
else if (currentOs.macOsX) {
imageOptions += ["--verbose"]
installerOptions += ["--verbose", '--mac-package-name', "drawingbotv3"]
if(project.hasProperty("developer")){
String id = project.getProperty("developer")
project.logger.lifecycle('Found a developer id, adding mac-signing')
imageOptions += ['--mac-sign', "--mac-signing-key-user-name", id]
installerOptions += ['--mac-sign', "--mac-signing-key-user-name", id]
}else{
project.logger.lifecycle('No developer id, disabling mac-signing')
}
}
installerOptions += ['--file-associations', "src/main/resources/jpackage/FAprojects.properties"]
}
}
task jpackageImageZip(type: Zip){
dependsOn(jpackageImage)
getArchiveFileName().set("${app_name + "-" + app_version + "-" + app_state + "-win"}.zip")
getDestinationDirectory().set(file("$buildDir/release"))
from "$buildDir/jpackage/$app_name"
}
task renameLaunchers (type: Copy) { //temporary, due to bug in wix toolset
dependsOn(jpackage)
from ("$buildDir/jpackage-installers")
into ("$buildDir/release")
def baseName = "$app_name" + "-" + "$app_version"
//windows
include "*.exe"
rename "(.*).exe", baseName + "-" + app_state + "-win" + ".exe"
include "*.msi"
rename "(.*).msi", baseName + "-" + app_state + "-win" + ".msi"
//mac
include "*.pkg"
rename "(.*).pkg", baseName + "-" + app_state + "-mac" + ".pkg"
//linux deb
include "*.deb"
rename "(.*).deb", baseName + "-" + app_state + "-linux" + ".deb"
//linux rpm
include "*.rpm"
rename "(.*).rpm", baseName + "-" + app_state + "-linux" + ".rpm"
}
task moveShadowJar (type: Copy) {
dependsOn(shadowJar)
from ("$buildDir/libs")
into ("$buildDir/release")
include app_name + "-" + app_version + "-" + app_state + "-all.jar"
}
task prepareRelease{
dependsOn(renameLaunchers)
dependsOn(moveShadowJar)
}
// Used after signing the .exe in the application image
task rezipWindowsImage(type: Zip){
getArchiveFileName().set("${app_name + "-" + app_version + "-" + app_state + "-win"}.zip")
getDestinationDirectory().set(file("$buildDir/release"))
from "$buildDir/jpackage/$app_name"
}
////
class SimpleTestType extends Test {
SimpleTestType() {
minHeapSize = "128m"
maxHeapSize = "4g"
systemProperty "drawingbotv3_testrunner", System.getProperty("drawingbotv3_testrunner")
testLogging.showStandardStreams = true
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
onOutput { descriptor, event ->
logger.lifecycle("Test: " + descriptor + " " + event.message)
}
}
}
task testAll(type:SimpleTestType){
filter{
excludeTestsMatching "*Regression*"
}
}
task regressionTest(type:SimpleTestType){
filter{
includeTestsMatching "*Regression*"
}
}
task imageFilterTest(type:SimpleTestType){
filter{
includeTestsMatching "*ImageFilterRegressionTest*"
}
}