forked from mucommander/mucommander
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
435 lines (394 loc) · 14.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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:4.3.0'
}
}
plugins {
id 'com.athaydes.osgi-run' version '1.6.0'
id 'java'
id 'org.ajoberstar.grgit' version '3.1.1'
id 'nebula.ospackage' version '7.4.2'
id 'com.github.johnrengelman.shadow' version '5.1.0'
id 'edu.sc.seis.macAppBundle' version '2.3.0'
id 'edu.sc.seis.launch4j' version '2.4.6'
}
allprojects {
group = 'org.mucommander'
version = '0.9.5'
ext.release = 'snapshot'
configurations {
compileOnly.extendsFrom comprise
}
}
subprojects {
apply plugin: 'biz.aQute.bnd.builder'
compileJava.options.compilerArgs += ['--release', '8']
}
compileJava.options.encoding = 'UTF-8'
compileJava.options.compilerArgs += ['--release', '8']
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile 'org.apache.felix:org.apache.felix.main:6.0.3'
compile 'com.beust:jcommander:1.72'
osgiRuntime project('mucommander-core')
osgiRuntime project('mucommander-command')
osgiRuntime project('mucommander-commons-collections')
osgiRuntime project('mucommander-commons-conf')
osgiRuntime project('mucommander-commons-file')
osgiRuntime project('mucommander-commons-io')
osgiRuntime project('mucommander-commons-runtime')
osgiRuntime project('apache-bzip2')
osgiRuntime project('mucommander-encoding')
osgiRuntime project('mucommander-preferences')
osgiRuntime project('mucommander-process')
osgiRuntime project('mucommander-translator')
osgiRuntime project('mucommander-protocol-ftp')
osgiRuntime project('mucommander-protocol-sftp')
osgiRuntime project('mucommander-format-rar')
osgiRuntime project('mucommander-protocol-http')
osgiRuntime project('mucommander-protocol-nfs')
osgiRuntime project('mucommander-protocol-smb')
osgiRuntime project('mucommander-protocol-vsphere')
osgiRuntime project('mucommander-format-ar')
osgiRuntime project('mucommander-format-sevenzip')
osgiRuntime project('mucommander-format-zip')
osgiRuntime project('mucommander-format-tar')
osgiRuntime project('mucommander-format-bzip2')
osgiRuntime project('mucommander-format-gzip')
osgiRuntime project('mucommander-format-iso')
osgiRuntime project('mucommander-format-lst')
osgiRuntime project('mucommander-archiver')
// osgiRuntime project('mucommander-hadoop')
osgiRuntime project('mucommander-protocol-s3')
osgiRuntime project('mucommander-protocol-registry')
osgiRuntime project('mucommander-protocol-ovirt')
osgiRuntime project('mucommander-format-libguestfs') // Note that this is a work-in-progress
osgiRuntime project('mucommander-viewer-text')
osgiRuntime project('mucommander-viewer-image')
osgiRuntime project('mucommander-viewer-binary')
osgiRuntime project('mucommander-os-api')
osgiRuntime project('mucommander-os-macos')
osgiRuntime project('mucommander-os-linux')
osgiRuntime project('mucommander-os-win')
osgiRuntime project('mucommander-os-openvms')
}
createBundlesDir.doLast {
ant.move file: "${buildDir}/osgi/bundle/${project('mucommander-core').jar.archiveName}",
todir: "${buildDir}/osgi/app"
copy{
from "build/libs"
include project(':').jar.archiveName
into "${buildDir}/osgi"
}
}
runOsgi {
javaArgs = '-Djava.library.path=/usr/local/lib' // for Libguestfs
def port = System.getenv('DEBUG')
if (port) {
javaArgs += ' -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=' + port
}
configSettings = 'felix'
osgiMain = project(':')
config += [
'org.osgi.framework.storage': 'felix-cache',
'felix.auto.deploy.dir': 'bundle',
'mucommander.app.dir': 'app',
]
wrapInstructions {
manifest("httpclient.*") {
// enable httpclient to instantiate factories that reside in jets3t
instruction 'DynamicImport-Package', 'org.jets3t.service.utils', '*'
}
manifest("sdk-.*") {
instruction 'Bundle-Name', 'ovirt-sdk'
}
}
}
task run(dependsOn: 'runOsgi')
ext {
// Open the Git repository in the project's root directory.
git = grgit.open(dir: project.rootDir)
// Get commit id of HEAD.
revision = git.head().id
// Whether or not to bundle the JRE in order to create a 'standalone' executable
bundleJRE = project.hasProperty('mucommanderBundleJRE') ? mucommanderBundleJRE.toBoolean() : false
}
shadowJar.classifier = null
jar {
manifest {
attributes("Main-Class": "com.mucommander.main.muCommander",
"Specification-Title": "muCommander",
"Specification-Vendor": "Arik Hadas",
"Specification-Version": version,
"Implementation-Title": "muCommander",
"Implementation-Vendor": "Arik Hadas",
"Implementation-Version": revision.substring(0, 7),
"Build-Date": new Date().format('yyyyMMdd'),
"Build-URL": "https://www.mucommander.com/version/nightly.xml")
}
}
jar.enabled = false
test.useTestNG()
import org.apache.tools.ant.filters.ReplaceTokens
ospackage {
release = project.ext.release
postInstall file('package/unix/postinst')
postUninstall file('package/unix/postrm')
maintainer = 'Arik Hadas <arik.hadas1@gmail.com>'
summary = 'a lightweight, cross-platform file manager'
from ('package') { include 'license.txt', 'readme.txt' }
from ('package/unix/mucommander.sh') {
filter(ReplaceTokens, tokens: [MU_VERSION: project.version])
}
into '/usr/share/mucommander'
from ("$buildDir/osgi/") {
include '*.jar'
into '/usr/share/mucommander'
}
from ("$buildDir/osgi/bundle") {
include '*.jar'
into '/usr/share/mucommander/bundle'
}
from ("$buildDir/osgi/app") {
include '*.jar'
into '/usr/share/mucommander/app'
}
from ('mucommander-core/src/main/resources/images/mucommander/icon128_24.png') {
rename '.*', 'mucommander.png'
addParentDirs = false
into '/usr/share/pixmaps'
}
from ('package/unix') {
include 'mucommander.desktop'
addParentDirs = false
into '/usr/share/applications'
}
directory('/usr/share/mucommander/felix-cache')
}
// RPM packaging
buildRpm {
dependsOn createBundlesDir
suggests('java-11-openjdk')
os = LINUX
}
// Debian packaging
buildDeb {
dependsOn createBundlesDir
suggests('openjdk-11-jre')
recommends('java-virtual-machine')
}
macAppBundle {
appName = "muCommander"
dmgName = 'mucommander-'+project.version+'-'+project.ext.release
mainClassName = "com.mucommander.main.muCommander"
appStyle = "Oracle"
bundleJRE = true
jreHome = "jre/macOS/Contents/Home"
bundleIdentifier = "com.mucommander.muCommander"
jvmVersion = "1.6+"
icon = "package/osx/icon.icns"
bundleAllowMixedLocalizations = "true"
bundleExtras.put("NSHighResolutionCapable", "true")
bundleExtras.put("NSSupportsAutomaticGraphicsSwitching", "true")
backgroundImage = "package/osx/bg.gif"
backgroundImageWidth = 450
backgroundImageHeight = 475
appIconX = 225
appIconY = 75
appFolderX = 225
appFolderY = 350
backgroundScript = """
tell application "Finder"
tell disk "\${VOL_NAME}"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to { 0, 0, \${IMAGE_WIDTH}, \${IMAGE_HEIGHT} }
set the position of the container window to {400, 100}
set viewOptions to the icon view options of container window
set arrangement of viewOptions to not arranged
set icon size of viewOptions to 72
set background picture of viewOptions to file ".background:\${DMG_BACKGROUND_IMG}"
set position of item "\${APP_NAME}.app" of container window to { \${APPICONX}, \${APPICONY} }
set position of item "Applications" of container window to { \${APPFOLDERX}, \${APPFOLDERY} }
set position of item "license.txt" of container window to { 75, 75 }
set position of item "readme.txt" of container window to { 375, 75 }
close
open
update without registering applications
delay 2
end tell
end tell
"""
runtimeConfigurationName = 'shadow'
jarTask = 'shadowJar'
//javaProperties.put("java.system.class.loader", "com.mucommander.commons.file.AbstractFileClassLoader")
javaProperties.put("com.apple.smallTabs", "true")
javaProperties.put("com.apple.hwaccel", "true")
javaProperties.put("apple.laf.useScreenMenuBar", "true")
javaProperties.put("file.encoding", "UTF-8")
}
copyToResourcesJava.dependsOn createBundlesDir
copyToResourcesJava.doLast {
copy {
from "build/osgi"
include 'app/**'
include 'bundle/**'
into project.file("${->project.buildDir}/${->project.macAppBundle.appOutputDir}/${->project.macAppBundle.appName}.app/Contents/${->project.macAppBundle.jarSubdir}")
}
}
task copyInfoToAppOutputDir(type: Copy) {
from "package"
include "license.txt"
include "readme.txt"
into "${->project.buildDir}/${->project.macAppBundle.appOutputDir}/"
}
createDmg.dependsOn copyInfoToAppOutputDir
launch4j {
icon = "$projectDir/package/windows/mucommander.ico"
mainClassName = "com.mucommander.main.muCommander"
copyConfigurable = project.tasks.shadowJar.outputs.files
jar = "${project.tasks.shadowJar.archiveName}"
dontWrapJar = true
classpath = ['.']
headerType = "gui"
if (project.ext.bundleJRE) {
bundledJre64Bit = project.ext.bundleJRE
bundledJrePath = "jre"
}
outfile = "mucommander.exe"
}
// Windows installer
task nsis(type: Copy, dependsOn: [createExe, createBundlesDir]) {
from("$buildDir/launch4j/") {
include 'mucommander.exe'
}
if (project.ext.bundleJRE) {
from('jre/win') {
into "jre"
}
}
from("$buildDir/osgi/") {
include '*.jar'
}
from('package/windows') {
include 'mucommander.ico'
}
from('package/windows') {
include project.ext.bundleJRE ? 'mucommander-bundled.nsi' : 'mucommander.nsi'
filter(ReplaceTokens, tokens: [MU_VERSION: project.version,
MU_ICON: 'mucommander.ico',
MU_LICENSE: 'license.txt',
MU_README: 'readme.txt',
MU_OUT: 'mucommander-'+project.version+'-'+project.ext.release+'-setup.exe',
MU_EXE: 'mucommander.exe',
MU_JAR: project.tasks.shadowJar.archiveName])
}
from ('package') {
include 'license.txt', 'readme.txt'
}
from("$buildDir/osgi/app") {
include '*.jar'
into "app"
}
from("$buildDir/osgi/bundle") {
include '*.jar'
into "bundle"
}
into "$buildDir/tmp/nsis"
}
// Portable packaging
task portable(dependsOn: [createExe, createBundlesDir], type: Tar) {
from ("$buildDir/launch4j") {
include 'mucommander.exe'
}
from ("$buildDir/osgi") {
include '*.jar'
}
from ('package') { include 'license.txt', 'readme.txt' }
from ('package/unix') {
include 'felix-cache'
dirMode 0777
}
from ('package/unix/mucommander.sh') {
filter(ReplaceTokens, tokens: [MU_VERSION: project.version])
}
into "muCommander-$version"
from ("$buildDir/osgi/bundle") {
include '*.jar'
into 'bundle'
}
from ("$buildDir/osgi/app") {
include '*.jar'
into 'app'
}
classifier = 'portable'
extension = 'tar.gz'
compression = Compression.GZIP
version = project.version+'-'+project.ext.release
}
// Unix packaging
task tgz(dependsOn: createBundlesDir, type: Tar) {
from ("$buildDir/osgi") {
include '*.jar'
}
from ('package') { include 'license.txt', 'readme.txt' }
from ('package/unix') {
include 'felix-cache'
dirMode 0777
}
from ('package/unix/mucommander.sh') {
filter(ReplaceTokens, tokens: [MU_VERSION: project.version])
}
into "."
from ("$buildDir/osgi/bundle") {
include '*.jar'
into 'bundle'
}
from ("$buildDir/osgi/app") {
include '*.jar'
into 'app'
}
extension = 'tar.gz'
compression = Compression.GZIP
version = project.version+'-'+project.ext.release
}
task(afterEclipseImport).doLast {
File f = file('.settings/org.eclipse.core.resources.prefs')
f.write('eclipse.preferences.version=1\n')
f.append('encoding//src/main/resources/languages.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_ar.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_be.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_ca.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_cs.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_da.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_de.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_en.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_en_GB.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_es.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_fr.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_hu.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_it.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_ja.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_ko.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_nb.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_nl.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_pl.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_pt_BR.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_ro.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_ru.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_sk.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_sl.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_sv.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_tr.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_ua.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_zh_CN.properties=UTF-8\n')
f.append('encoding//src/main/resources/dictionary_zh_TW.properties=UTF-8\n')
}