forked from freeplane/freeplane
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwin.dist.gradle
More file actions
196 lines (152 loc) · 6.1 KB
/
Copy pathwin.dist.gradle
File metadata and controls
196 lines (152 loc) · 6.1 KB
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
import groovy.io.FileType
import org.apache.tools.ant.taskdefs.condition.Os
String winapp_input_dir = 'BIN'
def defineWinDistTasks = { javaRuntime, distName ->
def appImageDir = file("build/winapp/${javaRuntime}")
def winapp_deleteAppImage = tasks.create("winapp_deleteAppImage_${javaRuntime}", Delete) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
delete "${appImageDir}"
}
def winapp_input = tasks.create("winapp_input_${javaRuntime}", Copy) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
from(winapp_input_dir) {
include '*.jar'
}
into "${appImageDir}"
doLast {
mkdir "${appImageDir}/input"
}
dependsOn winapp_deleteAppImage
for (p in subprojects) {
dependsOn p.tasks.getByPath("build")
}
}
def jpackage = 'jpackage'
def jpackage_winapp = tasks.create ("jpackage_winapp_${javaRuntime}", Exec) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
commandLine jpackage,
'--name' , 'freeplane',
'--type', 'app-image',
'--icon', 'freeplane_framework/launch4j/Freeplane_app.ico',
'--app-version', majorVersion,
'--java-options', "-XX:-IgnoreUnrecognizedVMOptions",
'--java-options', "-XX:MaxRAM=20g",
'--java-options', "-XX:MaxRAMPercentage=15.0",
'--java-options', '-Djava.security.manager=allow',
'--java-options', '-Dorg.freeplane.userfpdir=%APPDATA%\\Freeplane',
'--java-options', '--add-exports',
'--java-options', 'java.desktop/sun.awt=ALL-UNNAMED',
'--java-options', '--add-exports',
'--java-options', 'java.desktop/sun.awt.shell=ALL-UNNAMED',
'--java-options', '--add-exports',
'--java-options', 'java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED',
'--java-options', '--add-exports',
'--java-options', 'java.desktop/sun.swing=ALL-UNNAMED',
'--java-options', '--add-opens',
'--java-options', 'java.desktop/javax.swing.text.html=ALL-UNNAMED',
'--input', "build/winapp/${javaRuntime}/input",
'--main-class', 'org.freeplane.launcher.Launcher',
'--main-jar', '../freeplanelauncher.jar',
'--add-launcher', 'freeplaneConsole=freeplane_framework/launch4j/freeplaneConsole.properties',
'--runtime-image', "java-runtime-${javaRuntime}",
'--copyright', "Freeplane ${distVersion}",
'--dest', "${appImageDir}"
dependsOn winapp_deleteAppImage, winapp_input
for (p in subprojects) {
dependsOn p.tasks.getByPath("build")
}
}
def winapp_makeapp = tasks.create("winapp_makeapp_${javaRuntime}", Copy) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
dependsOn jpackage_winapp
from(winapp_input_dir) {
include '*/**'
exclude '/*.exe'
exclude '/*.l4j.ini'
}
into "${appImageDir}/Freeplane/"
}
def windowsInstaller = tasks.create("windowsInstaller_${javaRuntime}", Exec) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
ignoreExitValue = true
workingDir = rootDir.path + '/freeplane_framework/windows-installer'
commandLine 'cmd.exe', '/c', "ISCC.exe /DAppImage=${appImageDir} /Q Freeplane.iss "
doLast {
new File(workingDir, 'Freeplane-Setup.exe').renameTo(new File(globalDist, "Freeplane-Setup${distName}-${distVersion}.exe"))
}
dependsOn winapp_makeapp
}
dist {
dependsOn windowsInstaller
}
}
if ( Os.isFamily(Os.FAMILY_WINDOWS)) {
defineWinDistTasks('jbr', '')
defineWinDistTasks('zulu', '-touchscreen')
}
def portableInstallerDir = new File(globalDist, 'FreeplanePortable').path
task copyWindowsPortableInstallerBasicFiles(type: Copy) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
// copy windows-portable files
from(rootDir.path + '/freeplane_framework/windows-portable') {
include('**')
}
into(portableInstallerDir)
}
task copyWindowsPortableInstallerLicense(type: Copy) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
// copy license
from(rootDir.path + '/freeplane/resources/') {
include('license.txt')
rename('license.txt', 'EULA.txt')
}
into(portableInstallerDir + '/Other/Source/')
}
task copyWindowsPortableInstallerIcon(type: Copy) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
// copy icon
from(rootDir.path + '/freeplane_framework/launch4j') {
include('Freeplane_app.ico')
rename('Freeplane_app.ico', 'appicon.ico')
}
into(portableInstallerDir + '/App/AppInfo/')
}
task copyWindowsPortableInstallerFiles(type: Copy) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
// copy INI I
from(rootDir.path + '/freeplane_framework/portableApps') {
include('portable.ini')
rename('portable.ini', 'freeplane.l4j.ini')
}
// copy INI II
from(rootDir.path + '/freeplane_framework/portableApps') {
include('portable.ini')
rename('portable.ini', 'freeplaneConsole.l4j.ini')
}
// copy all other files
from (globalBin) {
exclude('*.bat', '*.ini', '*.sh')
}
into(portableInstallerDir + '/App/Freeplane/')
for (p in subprojects) {
dependsOn p.tasks.getByPath("build")
}
dependsOn copyWindowsPortableInstallerBasicFiles
dependsOn copyWindowsPortableInstallerLicense
dependsOn copyWindowsPortableInstallerIcon
}
task windowsPortableInstaller(type: Exec) {
onlyIf { Os.isFamily(Os.FAMILY_WINDOWS) }
// continue the build when running windows but PortableApps.comInstaller.exe is not installed?
ignoreExitValue = true
workingDir = rootDir.path + '/freeplane_framework'
commandLine 'cmd.exe', '/c', 'PortableApps.comInstaller.exe', portableInstallerDir
dependsOn copyWindowsPortableInstallerFiles
doLast {
new File(portableInstallerDir).deleteDir()
new File(globalDist).eachFileMatch(FileType.FILES, ~/FreeplanePortable_.*\.paf\.exe/) {
f ->
f.renameTo(new File(globalDist, "FreeplanePortable-${distVersion}.paf.exe"))
}
}
}