forked from DSheirer/sdrtrunk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
297 lines (260 loc) · 11.3 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
/*
* *****************************************************************************
* Copyright (C) 2014-2021 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ****************************************************************************
*/
plugins {
id 'application'
id 'java'
id 'idea'
id 'org.openjfx.javafxplugin' version '0.0.10'
id 'org.beryx.runtime' version '1.12.7'
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
version = '0.5.0-alpha8'
sourceCompatibility = '17'
javafx {
version = "17.0.1"
modules = ['javafx.base', 'javafx.controls', 'javafx.graphics', 'javafx.swing']
configuration = "implementation"
}
sourceSets {
main.java.srcDirs 'src/main'
test.java.srcDirs 'src/test'
}
test {
useJUnitPlatform()
}
configurations {
javafx_libs_linux
javafx_libs_osx
javafx_libs_win
}
dependencies {
// JUnit Tests
testImplementation 'junit:junit:4.12'
testImplementation 'org.assertj:assertj-core:3.8.0'
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
testImplementation 'org.mockito:mockito-core:3.+'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
//Jitpack imports
implementation 'com.github.dnault:libresample4j:master'
implementation 'com.github.DSheirer.jmbe:jmbe-api:1.0.0'
implementation 'com.github.nwaldispuehl:java-lame:v3.98.4'
//mavenCentral/jcenter imports
implementation 'ch.qos.logback:logback-classic:1.2.3'
implementation 'ch.qos.logback:logback-core:1.2.3'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.8'
implementation 'com.fazecast:jSerialComm:2.5.0'
implementation 'com.github.jiconfont:jiconfont-font_awesome:4.7.0.1'
implementation 'com.github.jiconfont:jiconfont-javafx:1.0.0'
implementation 'com.github.jiconfont:jiconfont-swing:1.0.1'
implementation 'com.github.wendykierp:JTransforms:3.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.guava:guava:27.0.1-jre'
implementation 'com.jidesoft:jide-oss:3.6.18'
implementation 'com.miglayout:miglayout-swing:5.2'
implementation 'com.mpatric:mp3agic:0.9.1'
implementation 'commons-io:commons-io:2.7'
implementation 'eu.hansolo:charts:1.0.5'
implementation 'io.github.dsheirer:radio-reference-api:15.1.8'
implementation 'javax.usb:usb-api:1.0.2'
implementation 'net.coderazzi:tablefilter-swing:5.4.0'
implementation 'org.apache.commons:commons-compress:1.20'
implementation 'commons-cli:commons-cli:1.4'
implementation 'commons-io:commons-io:2.7'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'org.apache.commons:commons-csv:1.9.0'
implementation 'org.apache.mina:mina-core:2.1.3'
implementation 'org.apache.mina:mina-http:2.1.3'
implementation 'org.controlsfx:controlsfx:11.1.0'
implementation 'org.rauschig:jarchivelib:1.0.0'
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'org.usb4java:libusb4java:1.3.0'
implementation 'org.usb4java:usb4java:1.3.0'
implementation 'org.usb4java:usb4java-javax:1.3.0'
implementation 'pl.edu.icm:JLargeArrays:1.6'
//JavaFX libraries for Linux
javafx_libs_linux "org.openjfx:javafx-base:$javafx.version:linux"
javafx_libs_linux "org.openjfx:javafx-controls:$javafx.version:linux"
javafx_libs_linux "org.openjfx:javafx-graphics:$javafx.version:linux"
javafx_libs_linux "org.openjfx:javafx-swing:$javafx.version:linux"
//JavaFX libraries for OSX
javafx_libs_osx "org.openjfx:javafx-base:$javafx.version:mac"
javafx_libs_osx "org.openjfx:javafx-controls:$javafx.version:mac"
javafx_libs_osx "org.openjfx:javafx-graphics:$javafx.version:mac"
javafx_libs_osx "org.openjfx:javafx-swing:$javafx.version:mac"
//JavaFX libraries for Windows
javafx_libs_win "org.openjfx:javafx-base:$javafx.version:win"
javafx_libs_win "org.openjfx:javafx-controls:$javafx.version:win"
javafx_libs_win "org.openjfx:javafx-graphics:$javafx.version:win"
javafx_libs_win "org.openjfx:javafx-swing:$javafx.version:win"
}
application {
mainClass.set("io.github.dsheirer.gui.SDRTrunk")
//Note: jide-oss.jar requires access to hidden windows look & feel
//Note: controlsfx.jar requires access to hidden javaFX classes
applicationDefaultJvmArgs = ['--add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED',
'--add-exports=javafx.base/com.sun.javafx.event=org.controlsfx.controls']
}
/**
* Runtime JVM arguments. JDK 17 has hidden a number of classes that are no longer exported from the
* modules. Some legacy support libraries still require access to these classes, so we explicitly
* add them to be exported from those modules here.
*/
import org.gradle.internal.os.OperatingSystem;
run {
if(OperatingSystem.current().isWindows()) {
//Note: jide-oss.jar requires access to hidden windows look & feel
//Note: controlsfx.jar requires access to hidden javaFX classes
jvmArgs = ['--add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED',
'--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED']
}
else {
//Note: controlsfx.jar requires access to hidden javaFX classes
jvmArgs = ['--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED']
}
}
jar {
manifest {
attributes (
'Implementation-Title' : 'sdrtrunk project',
'Implementation-Version' : archiveVersion,
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-Timestamp' : new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'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']}"
)
}
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
/**
* Java Development Kit (JDK) locations. In order to build OS-specific images, these paths must point to the parent
* directory containing the 'bin' directory within a JDK for each of the specified architectures. These JDKs are used
* by the runtime and runtimeZip tasks to produce platform-specific builds. If none of these paths exists, then an
* image will be created for the host OS using the installed JDK.
*/
def jdk_base = '/home/denny/java_jdks/'
def jdk_linux_arm64 = jdk_base + 'linux-arm64/jdk-17.0.1-full'
def jdk_linux_x86_64 = jdk_base + 'linux-x64/jdk-17.0.1-full'
def jdk_osx_x86_64 = jdk_base + 'osx-x64/jdk-17.0.1-full.jdk'
def jdk_windows_x86_64 = jdk_base + 'windows-x64/jdk-17.0.1-full'
def hasTargetJdk = file(jdk_linux_x86_64).exists() ||
file(jdk_linux_arm64) ||
file(jdk_osx_x86_64).exists() ||
file(jdk_windows_x86_64).exists()
/**
* Beryx Runtime plugin - adds operating system specific runtime build targets when the OS-specific JDK is
* found on the local file system. The runtime plugin enables you to optionally download these files,
* however I normally have them installed locally and use those versions.
*/
runtime {
if(file(jdk_linux_arm64).exists())
{
targetPlatform('linux-arm64-v' + version, jdk_linux_arm64)
}
else
{
println("Skipping OS Image - Linux ARM 64-bit JDK was not found at " + jdk_linux_arm64)
}
if(file(jdk_linux_x86_64).exists())
{
targetPlatform('linux-x86_64-v' + version, jdk_linux_x86_64)
}
else
{
println("Skipping OS Image - Linux x86 64-bit JDK was not found at " + jdk_linux_x86_64)
}
if(file(jdk_osx_x86_64).exists())
{
targetPlatform('osx-x86_64-v' + version, jdk_osx_x86_64)
}
else
{
println("Skipping OS Image - OSX x86 64-bit JDK was not found at " + jdk_osx_x86_64);
}
if(file(jdk_windows_x86_64).exists())
{
targetPlatform('windows-x86_64-v' + version, jdk_windows_x86_64)
}
else
{
println("Skipping OS Image - Windows x86 64-bit JDK was not found at " + jdk_windows_x86_64)
}
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
modules = ['java.desktop', 'java.naming', 'jdk.unsupported', 'jdk.unsupported.desktop', 'java.net.http',
'java.sql', 'jdk.crypto.ec']
imageZip = hasTargetJdk ? file("$buildDir/image/sdr-trunk.zip") : file("$buildDir/image/sdr-trunk-" + version + ".zip")
}
def image_lib_linux_arm64 = file("$buildDir/image/sdr-trunk-linux-arm64-v" + version + "/lib")
def image_lib_linux_x86_64 = file("$buildDir/image/sdr-trunk-linux-x86_64-v" + version + "/lib")
def image_lib_osx_x86_64 = file("$buildDir/image/sdr-trunk-osx-x86_64-v" + version + "/lib")
def image_lib_win_x86_64 = file("$buildDir/image/sdr-trunk-windows-x86_64-v" + version + "/lib")
/**
* Copy JavaFX OS-specific libraries for each JDK to each platform target directory
*/
tasks.runtime.doLast
{
if(file(jdk_linux_arm64).exists())
{
//Delete any host system OS-specific JavaFX JDK modules that were inserted as part of default build
delete(fileTree(image_lib_linux_arm64).include { it.name ==~ /javafx.*-(win|mac|linux)\.jar/ })
//Copy OS-specific JavaFX libraries
copy {
from configurations.javafx_libs_linux
into image_lib_linux_arm64
}
}
if(file(jdk_linux_x86_64).exists())
{
//Delete any host system OS-specific JavaFX JDK modules that were inserted as part of default build
delete(fileTree(image_lib_linux_x86_64).include { it.name ==~ /javafx.*-(win|mac|linux)\.jar/ })
//Copy OS-specific JavaFX libraries
copy {
from configurations.javafx_libs_linux
into image_lib_linux_x86_64
}
}
if(file(jdk_osx_x86_64).exists())
{
//Delete any host system OS-specific JavaFX JDK modules that were inserted as part of default build
delete(fileTree(image_lib_osx_x86_64).include { it.name ==~ /javafx.*-(win|mac|linux)\.jar/ })
//Copy OS-specific JavaFX libraries
copy {
from configurations.javafx_libs_osx
into image_lib_osx_x86_64
}
}
if(file(jdk_windows_x86_64).exists())
{
//Delete any host system OS-specific JavaFX JDK modules that were inserted as part of default build
delete(fileTree(image_lib_win_x86_64).include { it.name ==~ /javafx.*-(win|mac|linux)\.jar/ })
//Copy OS-specific JavaFX libraries
copy {
from configurations.javafx_libs_win
into image_lib_win_x86_64
}
}
}