-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
188 lines (162 loc) · 7.99 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="build">
<tstamp>
<format property="timestamp" pattern="yyyyMMdd-HHmm"/>
</tstamp>
<property name="app" value="swtapp"/>
<property name="version" value="0.0.0"/>
<property name="folder" value="swt-template"/>
<property name="mac-folder" value="SWT Template"/>
<property name="package" value="com.maccasoft.template_${version}.v${timestamp}"/>
<property name="work" value="build/work"/>
<property name="launch4j.dir" location="/opt/launch4j" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="build/macosx/appbundler-1.0.jar" />
<target name="build">
<antcall target="build-linux" />
<antcall target="build-windows" />
<antcall target="build-macosx" />
</target>
<!-- Linux x86/64 -->
<target name="build-linux">
<delete dir="${work}" includeemptydirs="true"/>
<mkdir dir="${work}/${folder}" />
<mkdir dir="${work}/bin" />
<javac target="1.8" source="1.8" destdir="${work}/bin" srcdir="src" debug="true" includeantruntime="false">
<classpath refid="lib.path.ref"/>
<classpath>
<pathelement location="lib/org.eclipse.swt.gtk.linux.x86_64_3.117.0.v20210906-0842.jar"/>
</classpath>
</javac>
<antcall target="copy-common-files" />
<copy todir="${work}/${folder}/lib">
<fileset file="lib/org.eclipse.swt.gtk.linux.x86_64_3.117.0.v20210906-0842.jar"/>
<fileset file="build/linux/desktop.template" />
</copy>
<copy todir="${work}/${folder}/lib/icons">
<fileset dir="build/linux/icons" />
</copy>
<copy todir="${work}/${folder}">
<fileset file="build/linux/launcher" />
<fileset file="build/linux/launcher.png" />
<fileset file="build/linux/install.sh" />
<fileset file="build/linux/uninstall.sh" />
</copy>
<chmod file="${work}/${folder}/launcher" perm="755"/>
<chmod file="${work}/${folder}/install.sh" perm="755"/>
<chmod file="${work}/${folder}/uninstall.sh" perm="755"/>
<exec executable="tar" dir="${work}" failonerror="true">
<arg value="czf"/>
<arg value="../${folder}-linux64-${version}.tar.gz"/>
<arg value="${folder}"/>
</exec>
</target>
<!-- Windows x86/64 -->
<target name="build-windows">
<delete dir="${work}" includeemptydirs="true"/>
<mkdir dir="${work}/${folder}" />
<mkdir dir="${work}/bin" />
<javac target="1.8" source="1.8" destdir="${work}/bin" srcdir="src" debug="true" includeantruntime="false">
<classpath refid="lib.path.ref"/>
<classpath>
<pathelement location="lib/org.eclipse.swt.win32.win32.x86_64_3.117.0.v20210906-0842.jar"/>
</classpath>
</javac>
<antcall target="copy-common-files" />
<copy todir="${work}/${folder}/lib">
<fileset file="lib/org.eclipse.swt.win32.win32.x86_64_3.117.0.v20210906-0842.jar"/>
</copy>
<copy todir="${work}/${folder}">
<fileset file="build/windows/launcher.l4j.ini" />
</copy>
<launch4j configFile="build/windows/config64.xml"
outfile="${work}/${folder}/launcher.exe"
fileVersion="${version}.0"
txtFileVersion="${version}.0"
productVersion="${version}.0"
txtProductVersion="${version}.0" />
<exec executable="zip" dir="${work}" failonerror="true">
<arg value="-q"/>
<arg value="-r"/>
<arg value="../${folder}-windows64-${version}.zip"/>
<arg value="${folder}"/>
</exec>
</target>
<!-- MacOS/X -->
<target name="build-macosx">
<delete dir="${work}" includeemptydirs="true"/>
<mkdir dir="${work}/${folder}" />
<mkdir dir="${work}/bin" />
<javac target="1.8" source="1.8" destdir="${work}/bin" srcdir="src" debug="true" includeantruntime="false">
<classpath refid="lib.path.ref"/>
<classpath>
<pathelement location="lib/org.eclipse.swt.cocoa.macosx.x86_64_3.117.0.v20210906-0842.jar"/>
</classpath>
</javac>
<antcall target="copy-common-files" />
<copy todir="${work}/${folder}/lib" file="lib/org.eclipse.swt.cocoa.macosx.x86_64_3.117.0.v20210906-0842.jar"/>
<bundleapp
outputdirectory="${work}"
name="${mac-folder}"
displayname="${mac-folder}"
identifier="com.maccasoft.template"
icon="build/macosx/app.icns"
shortversion="${version}"
signature="????"
copyright="Marco Maccaferri"
applicationCategory="public.app-category.education"
mainclassname="com.maccasoft.template.Main">
<classpath file="${work}/${folder}/lib/*.jar"/>
<option value="-DAPP_DIR=$APP_ROOT/Contents/Java"/>
<option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
<option value="-Xms128M"/>
<option value="-Xmx512M"/>
<option value="-XstartOnFirstThread"/>
</bundleapp>
<copy todir="${work}/${mac-folder}.app/Contents/Java" includeemptydirs="false">
<fileset dir="${work}/${folder}" excludes="**/*.jar" />
</copy>
<exec executable="tar" dir="${work}" failonerror="true">
<arg value="czf"/>
<arg value="../${folder}-macosx-${version}.tar.gz"/>
<arg value="${mac-folder}.app"/>
</exec>
</target>
<path id="lib.path.ref">
<pathelement location="lib/org.eclipse.core.commands_3.10.100.v20210722-1426.jar"/>
<pathelement location="lib/org.eclipse.core.databinding_1.10.100.v20200926-1123.jar"/>
<pathelement location="lib/org.eclipse.core.databinding.beans_1.8.0.v20210619-1111.jar"/>
<pathelement location="lib/org.eclipse.core.databinding.observable_1.11.0.v20210722-1426.jar"/>
<pathelement location="lib/org.eclipse.core.databinding.property_1.9.0.v20210619-1129.jar"/>
<pathelement location="lib/org.eclipse.equinox.common_3.15.0.v20210518-0604.jar"/>
<pathelement location="lib/org.eclipse.jface_3.23.0.v20210723-1324.jar"/>
<pathelement location="lib/org.eclipse.jface.databinding_1.13.0.v20210619-1146.jar"/>
<pathelement location="lib/org.eclipse.jface.text_3.18.100.v20210820-1651.jar"/>
</path>
<target name="copy-common-files">
<jar destfile="${work}/${folder}/lib/${package}.jar">
<fileset dir="${work}/bin"/>
<fileset dir="src">
<exclude name="**/*.java"/>
</fileset>
</jar>
<copy todir="${work}/${folder}/lib">
<fileset dir="lib" includes="org.eclipse.core.commands_3.10.100.v20210722-1426.jar"/>
<fileset dir="lib" includes="org.eclipse.core.databinding_1.10.100.v20200926-1123.jar"/>
<fileset dir="lib" includes="org.eclipse.core.databinding.beans_1.8.0.v20210619-1111.jar"/>
<fileset dir="lib" includes="org.eclipse.core.databinding.observable_1.11.0.v20210722-1426.jar"/>
<fileset dir="lib" includes="org.eclipse.core.databinding.property_1.9.0.v20210619-1129.jar"/>
<fileset dir="lib" includes="org.eclipse.equinox.common_3.15.0.v20210518-0604.jar"/>
<fileset dir="lib" includes="org.eclipse.jface_3.23.0.v20210723-1324.jar"/>
<fileset dir="lib" includes="org.eclipse.jface.databinding_1.13.0.v20210619-1146.jar"/>
<fileset dir="lib" includes="org.eclipse.jface.text_3.18.100.v20210820-1651.jar"/>
</copy>
<copy todir="${work}/${folder}">
<fileset file="epl-v10.html"/>
</copy>
</target>
</project>