-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
295 lines (258 loc) · 8.9 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
/*
* Copyright (C) 2013-2024 Martin Goellnitz
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301, USA
*/
plugins {
id "edu.sc.seis.launch4j" version "2.5.4"
id "net.ossindex.audit" version "0.4.11"
id "com.netflix.nebula.ospackage" version "11.8.1"
}
def l4j = true
apply plugin: 'java'
apply plugin: 'application'
defaultTasks 'clean', 'build'
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
compileJava.options.deprecation = true
sourceSets {
main {
java {
srcDir 'src'
exclude 'jfs/sync/fileencrypted/*.java'
exclude '**/HeapSort.java'
}
resources {
srcDir 'src'
exclude '**/*.7z'; // I tend to hide some experimental codes here
exclude '**/*.java'; // result of the exclusions above: this is necessary
}
}
test {
java {
srcDir 'test'
}
resources {
srcDir 'test'
exclude '**/*.zip'; // test folders zip file
}
}
}
dependencies {
// dropbox client
// implementation files(fileTree(dir: 'lib', includes: ['*.jar']))
implementation 'org.slf4j:slf4j-api:2.0.16'
implementation ('com.github.lookfirst:sardine:5.12') {
exclude group: 'commons-logging', module: 'commons-logging'
}
// Use later versions than required by sardine to address vulnerabilities
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
implementation 'commons-codec:commons-codec:1.17.1'
implementation 'org.slf4j:jcl-over-slf4j:2.0.16' // httpclient and vfs use JCL
implementation 'org.slf4j:jul-to-slf4j:2.0.16' // Sardine uses JUL
// Cifs code looks good but I don't have shares to use so I skip this
// implementation 'jcifs:jcifs:1.3.17'
implementation ('org.apache.commons:commons-vfs2:2.9.0') {
exclude group: 'commons-logging', module: 'commons-logging'
}
// Update transitive dependency from vfs due to vulnerability
implementation 'org.apache.hadoop:hadoop-hdfs-client:3.4.1'
implementation 'org.apache.commons:commons-compress:1.27.1'
implementation ('net.sf.jsignature.io-tools:easystream:1.2.15') {
exclude group: 'org.slf4j', module: 'slf4j-api'
exclude group: 'commons-io', module: 'commons-io'
}
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
implementation 'javax.servlet:javax.servlet-api:4.0.1'
// Logging:
runtimeOnly 'ch.qos.logback:logback-classic:1.5.12'
}
audit {
ignore = [ 'org.bouncycastle:bcprov-jdk15on:1.70' ]
user = "$ossindexUser"
token = "$ossindexToken"
}
repositories {
mavenCentral()
}
mainClassName = 'jfs.JFileSync'
distTar.enabled = false
if (l4j) {
launch4j {
mainClassName = project.mainClassName
version = '3.0-SNAPSHOT'
textVersion = 'Executables Release'
fileDescription = 'Java based encrypting File Syncing Tool'
errTitle = project.name
// jreMinVersion = '11'
// splashFileName= 'win/JFileSync3-640x350-splash.bmp'
copyright = '(C) 2002-2024, J. Heidrich, M. Goellnitz'
downloadUrl = 'https://adoptium.net/de/temurin/releases'
supportUrl = 'https://github.com/mgoellnitz/JFileSync3'
icon = "$project.projectDir/win/JFileSync3.ico"
dontWrapJar = true
initialHeapSize = 1280
maxHeapSize = 1536
}
task createApplication(type: edu.sc.seis.launch4j.tasks.Launch4jExternalTask) {
outfile = 'JFileSync3.exe'
xmlFileName = 'JFileSync3.xml'
}
startScripts.dependsOn createApplication
}
startScripts {
doLast {
// Add some more reasonable memory settings to JFileSync3
unixScript.text = unixScript.text.replace('DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="-splash:$APP_HOME/bin/JFileSync3-640x350-splash.png -ms1280m -mx1536m -Xms1280m -Xmx1536m"')
windowsScript.text = windowsScript.text.replace('DEFAULT_JVM_OPTS=', 'DEFAULT_JVM_OPTS=-ms1280m -mx1536m -Xms1280m -Xmx1536m')
// Armor start script to use javaw and start when not used as a command line tool
windowsScript.text = windowsScript.text.replace('java.exe', '%JAVA_CMD%')
windowsScript.text = windowsScript.text.replace('@rem Find %JAVA_CMD%', 'set JAVA_PREFIX=start "JFileSync3 starting..."\nset JAVA_CMD=javaw.exe\nif "x%~1" == "x" goto noparams\nset JAVA_PREFIX=\nset JAVA_CMD=java.exe\n:noparams\n\n@rem Find java.exe')
windowsScript.text = windowsScript.text.replace('"%JAVA_EXE%" %DEFAULT_JVM_OPTS%', '%JAVA_PREFIX% "%JAVA_EXE%" %DEFAULT_JVM_OPTS%')
}
}
ospackage {
packageName = 'jfilesync'
version = '3.0-SNAPSHOT'
maintainer = 'Martin Goellnitz'
url = 'https://mgoellnitz.github.io/JFileSync3'
into("/usr/share/applications") {
from 'xdg'
include '*.desktop'
}
into("/usr/share/icons/hicolor/64x64") {
from 'xdg'
include '*.png'
}
into("/usr/share/$project.name") {
from '.'
include 'legal/*.*'
include 'profiles/*.*'
include 'README.md'
}
into("/usr/lib/$packageName/lib") {
from "build/install/$project.name/lib"
include '*.jar'
}
into("/usr/lib/$packageName/script") {
from "build/install/$project.name/bin"
include "$project.name"
}
}
installDist.dependsOn startScripts
buildDeb.dependsOn installDist
buildDeb {
link("/usr/bin/$project.name", "/usr/lib/$packageName/script/$project.name")
}
buildRpm.dependsOn buildDeb
buildRpm {
link("/usr/bin/$project.name", "/usr/lib/$packageName/script/$project.name")
}
distZip.dependsOn buildRpm
distZip {
// TODO: later...
// into(project.name+"/bin") {
// from 'bin'
// include 'E*.bat'
//}
into("$project.name") {
from "$buildDir/launch4j"
include '*.exe'
}
// Sometimes I want to have the icon file at hand
into("$project.name/bin") {
from 'win'
include '*.ico'
}
// Spash screen for windows
into("$project.name/bin") {
from 'win'
include '*.bmp'
}
// For the FreeDesktop.org desktop integration this looks better
into("$project.name/bin") {
from 'xdg'
include '*.desktop'
include '*.png'
include 'prepare*.sh'
}
// legal stuff, examples, and documentation
into(project.name) {
from '.'
include 'legal/*.*'
include 'profiles/*.*'
include 'README.md'
}
/*
// You might package your personal profiles in here
into(project.name) {
from '..'
include 'profiles/**'
}
*/
}
private List<String> getCmd(String cmd) {
// TODO: OS-Switch
def prefix = "" // "cmd /c " for windows
List<String> result = new ArrayList<>(2)
"$prefix$cmd".split(" ").each {
result.add(it)
}
return result
}
task prepareTestee(type:Copy) {
from zipTree("$buildDir/distributions/${project.name}.zip")
into "$buildDir"
}
task prepareTest(type:Copy) {
from zipTree("test/test-folders.zip")
into "$buildDir/${project.name}"
}
task makeTestExecutable(type:Exec) {
// Only for linux
workingDir "$buildDir/${project.name}"
commandLine "chmod", "755", "bin${File.separator}${project.name}"
}
task encrypt(type:Exec) {
// Encrypt
workingDir "$buildDir/${project.name}"
commandLine getCmd("bin${File.separator}${project.name} -config ..${File.separator}..${File.separator}test${File.separator}1-encrypt-with-metadata.xml -nogui -nohistory -quiet")
}
task decrypt(type:Exec) {
// Decrypt taking every folder metadata into account
workingDir "$buildDir/${project.name}"
commandLine getCmd("bin${File.separator}${project.name} -config ..${File.separator}..${File.separator}test${File.separator}2-decrypt-with-metadata.xml -nogui -nohistory -quiet")
}
task decryptIgnoring(type:Exec) {
// Decrypt ignoring any folder's metadata
commandLine getCmd("bin${File.separator}${project.name} -config ..${File.separator}..${File.separator}test${File.separator}3-decrypt-without-metadata.xml -nogui -nohistory -quiet")
workingDir "$buildDir/${project.name}"
}
task encryptionTest(type:Exec) {
// Compare by hand
commandLine getCmd("bin${File.separator}${project.name} -config ..${File.separator}..${File.separator}test${File.separator}4-compare-resulting-folders.xml -nohistory")
workingDir "$buildDir/${project.name}"
}
encryptionTest.dependsOn decryptIgnoring
decryptIgnoring.dependsOn decrypt
decrypt.dependsOn encrypt
encrypt.dependsOn makeTestExecutable
makeTestExecutable.dependsOn prepareTest
prepareTest.dependsOn prepareTestee
prepareTestee.dependsOn check
// Project specific default output directory for eclipse users
// apply plugin: 'eclipse'
// eclipse.classpath.conventionMapping.defaultOutputDir = { new File(project.projectDir, 'build/classes/main') }