forked from freeplane/freeplane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac.dist.gradle
102 lines (87 loc) · 3 KB
/
mac.dist.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
import org.apache.tools.ant.taskdefs.condition.Os
import org.apache.tools.ant.filters.*
def appBundlerJar = 'freeplane_framework/mac-appbundler/appbundler-1.0.jar'
ant.taskdef(
name: "appbundler",
classname: 'com.oracle.appbundler.AppBundlerTask',
classpath: appBundlerJar,
onerror: "report"
)
def build4mac = globalDist + '/build4mac'
def macappfullpath = new File(build4mac, 'Freeplane.app')
task macosxapp {
doFirst {
delete build4mac + '/Freeplane.app'
mkdir build4mac
ant.appbundler(
outputdirectory: build4mac,
name: 'Freeplane',
displayname: 'Freeplane',
mainclassname: 'org.freeplane.launcher.Launcher',
shortversion: distVersion,
copyright: "Freeplane ${distVersion}",
identifier: 'org.freeplane.core',
icon: 'freeplane_framework/mac-appbundler/freeplane.icns',
signature: '????'
) {
classpath(dir: globalBuild, includes: '*.jar')
option(value: "-Xmx512m")
option(value: "-Dapple.laf.useScreenMenuBar=true")
option(value: "-Xdock:name=Freeplane")
}
def dist_macos_info = macappfullpath.path + '/Contents/Info.plist'
ant.xslt(in: new File(dist_macos_info),
style: new File('freeplane_framework/mac-appbundler/mac_info_plist.xslt'),
out: new File(dist_macos_info + '2')
)
java.nio.file.Files.move(java.nio.file.Paths.get(dist_macos_info + '2'),
java.nio.file.Paths.get(dist_macos_info),
java.nio.file.StandardCopyOption.REPLACE_EXISTING)
def macjavafullpath = macappfullpath.path + '/Contents/Java'
copy {
from(globalBuild) {
exclude('**/*.bat')
exclude('**/*.exe')
exclude('*.jar')
}
into(macjavafullpath)
}
def macresourcesfullpath = macappfullpath.path + '/Contents/Resources'
copy {
from('freeplane_framework/mac-appbundler') {
include('freeplanedoc.icns')
}
into(macresourcesfullpath)
}
}
for (p in subprojects) {
dependsOn p.tasks.getByPath("build")
}
}
task dmg4mac(type: Exec) {
onlyIf { Os.isFamily(Os.FAMILY_MAC) }
commandLine 'hdiutil', 'create', '-srcfolder', macappfullpath.path,
globalDist + '/freeplane_app-' + distVersion + '.dmg'
dependsOn macosxapp
}
task zip4mac(type: Zip) {
destinationDir = new File(globalDist)
archiveName = 'freeplane_macos_bin-' + distVersion + '.zip'
from(build4mac) {
exclude('**/JavaAppLauncher')
}
from(build4mac) {
include('**/JavaAppLauncher')
fileMode = 0775
}
into('freeplane-' + distVersion)
dependsOn macosxapp
}
// this grouping task is necessary so that we can clean up build4mac!
task macDist {
dependsOn dmg4mac
dependsOn zip4mac
doLast {
delete(build4mac)
}
}