-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
242 lines (194 loc) · 9.43 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
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
<?xml version="1.0"?>
<project name="Processing JavaFX renderer" default="build">
<target name="core-check">
<property file="local.properties" />
<condition property="props.present">
<available file="local.properties" />
</condition>
<fail unless="processing.dir"
message="To make the build work, create a file named local.properties, with a line that reads:
${line.separator}processing.dir=/path/to/processing-git
${line.separator}with the path to where you have the code for Processing 4 checked out. ${line.separator}(This script will look for the 'core' directory inside that folder.)" />
<subant buildpath="${processing.dir}/core" />
<property name="core.dir" value="${processing.dir}/core/library" />
<property name="core.jar.path" location="${core.dir}/core.jar" />
<condition property="processing.built">
<available file="${core.jar.path}" />
</condition>
<fail unless="processing.built"
message="Please first build Processing (or at least core/build.xml) so that we have a usable core.jar to bundle with the app." />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Using 'location' here to resolve to an absolute path -->
<property name="library.path" location="./library" />
<target name="clean" description="Clean the build directories">
<delete dir="bin" />
<!-- Remove everything, which includes javafx.jar and files extracted
from the GluonHQ downloads, but those can be reproduced from the downloaded zips (which are not removed). -->
<delete dir="${library.path}" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!--
https://gluonhq.com/products/javafx/
# use the download file specified by the server
wget -\-content-disposition 'https://gluonhq.com/download/javafx-16-sdk-mac'
wget -\-content-disposition 'https://gluonhq.com/download/javafx-16-sdk-windows'
wget -\-content-disposition 'https://gluonhq.com/download/javafx-16-sdk-linux'
src (and therefore .jar files?) appear to be identical except for com.sun.javafx.runtime.VersionInfo which has a BUILD_TIMESTAMP variable
https://gluonhq.com/download/javafx-16-sdk-mac
https://gluonhq.com/download/javafx-16-sdk-windows
https://gluonhq.com/download/javafx-16-sdk-linux
-->
<!--
https://download2.gluonhq.com/openjfx/17.0.2/openjfx-17.0.2_osx-x64_bin-sdk.zip
https://download2.gluonhq.com/openjfx/17.0.2/openjfx-17.0.2_osx-aarch64_bin-sdk.zip
https://download2.gluonhq.com/openjfx/17.0.2/openjfx-17.0.2_windows-x64_bin-sdk.zip
https://download2.gluonhq.com/openjfx/17.0.2/openjfx-17.0.2_linux-x64_bin-sdk.zip
https://download2.gluonhq.com/openjfx/17.0.2/openjfx-17.0.2_linux-arm32_bin-sdk.zip
https://download2.gluonhq.com/openjfx/17.0.2/openjfx-17.0.2_linux-aarch64_bin-sdk.zip
-->
<target name="retrieve-gluon">
<property name="platform.zip"
value="javafx-${gluon.version}-${platform.variant}.zip" />
<property name="platform.path"
value="${library.path}/${platform.variant}" />
<get src="https://download2.gluonhq.com/openjfx/${gluon.version}/openjfx-${gluon.version}_${platform.name}-${platform.arch}_bin-sdk.zip"
dest="${platform.zip}"
usetimestamp="true" />
<antcall target="unzip-gluon-jars" />
<antcall target="unzip-gluon-natives" />
</target>
<target name="unzip-gluon-jars">
<property name="modules.path" value="${platform.path}/modules" />
<echo message="Extracting jars from ${platform.zip} to ${modules.path}" />
<!-- should javafx.properties be copied? is it used for anything? [fry 210620] -->
<!-- !#($*#! the builds have *slightly* different classes in each release
(WinPlatformFactory not in macOS .jar... FFS it's 1100 bytes of glue code) So the .jar files go into the native subdirectories as well. -->
<unzip dest="${modules.path}" src="${platform.zip}" overwrite="true">
<patternset>
<include name="**/*.jar" />
<!-- These two aren't supported/used -->
<!-- <exclude name="**/javafx.web.jar" /> -->
<exclude name="**/javafx-swt.jar" />
</patternset>
<!-- remove prefixes from folder paths when extracting -->
<mapper type="flatten" />
</unzip>
</target>
<target name="unzip-gluon-natives">
<echo message="Extracting native libs from ${platform.zip} to ${platform.path}" />
<unzip dest="${platform.path}" src="${platform.zip}" overwrite="true">
<patternset>
<include name="**/*.dll" />
<include name="**/*.dylib" />
<include name="**/*.so" />
<!-- The webkit library might be skipped because it is massive.
Un-comment this line for a smaller build. It will remove
libjfxwebkit.dylib, libjfxwebkit.so, jfxwebkit.dll -->
<!-- <exclude name="**/*jfxwebkit.*" /> -->
<!-- Not using this either, but since we're using 'include',
no need for an 'exclude' line -->
<!-- <exclude name="**/src.zip" /> -->
</patternset>
<!-- Ignore folder structure, which also helps because as of 210620,
the Windows build has a different folder for the binaries. -->
<mapper type="flatten" />
</unzip>
</target>
<target name="download-javafx">
<property name="gluon.version" value="17.0.2" />
<!-- Retrieves all six of our (un)officially supported platforms.
You can comment some of these out if you'd like a smaller build. -->
<antcall target="retrieve-gluon">
<param name="platform.name" value="osx" />
<param name="platform.arch" value="x64" />
<param name="platform.variant" value="macos-x86_64" />
</antcall>
<antcall target="retrieve-gluon">
<param name="platform.name" value="osx" />
<param name="platform.arch" value="aarch64" />
<param name="platform.variant" value="macos-aarch64" />
</antcall>
<antcall target="retrieve-gluon">
<param name="platform.name" value="windows" />
<param name="platform.arch" value="x64" />
<param name="platform.variant" value="windows-amd64" />
</antcall>
<antcall target="retrieve-gluon">
<param name="platform.name" value="linux" />
<param name="platform.arch" value="x64" />
<param name="platform.variant" value="linux-amd64" />
</antcall>
<antcall target="retrieve-gluon">
<param name="platform.name" value="linux" />
<param name="platform.arch" value="arm32" />
<param name="platform.variant" value="linux-arm" />
</antcall>
<antcall target="retrieve-gluon">
<param name="platform.name" value="linux" />
<param name="platform.arch" value="aarch64" />
<param name="platform.variant" value="linux-aarch64" />
</antcall>
</target>
<target name="compile" depends="download-javafx,core-check">
<!-- just pick a platform; any should be sufficient for building -->
<property name="javafx.jar.path" value="library/macos-x86_64/modules" />
<mkdir dir="bin" />
<javac source="11" target="11"
srcdir="src" destdir="bin"
encoding="UTF-8"
includeAntRuntime="false"
classpath="${core.jar.path};
${javafx.jar.path}/javafx.base.jar;
${javafx.jar.path}/javafx.controls.jar;
${javafx.jar.path}/javafx.fxml.jar;
${javafx.jar.path}/javafx.graphics.jar;
${javafx.jar.path}/javafx.media.jar;
${javafx.jar.path}/javafx.swing.jar"
nowarn="true" />
</target>
<target name="build" depends="compile" description="Build JavaFX renderer">
<jar basedir="bin" destfile="library/javafx.jar" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="dist" depends="revision-check, build">
<mkdir dir="dist" />
<zip destfile="dist/processing4-javafx.zip">
<zipfileset dir="." prefix="javafx" includes="library/**" />
<zipfileset dir="." prefix="javafx" includes="library.properties" />
</zip>
<copy file="library.properties" tofile="dist/processing4-javafx.txt" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="revision-check">
<!-- figure out the revision number -->
<loadfile srcfile="todo.txt" property="revision">
<filterchain>
<headfilter lines="1"/>
<tokenfilter>
<stringtokenizer suppressdelims="true" />
<!-- remove the preceding zeroes -->
<containsregex pattern="\d\d\d\d" />
</tokenfilter>
</filterchain>
</loadfile>
<!-- <echo message="revision is ${revision}." /> -->
<!-- figure out the revision number in library.properties -->
<loadfile srcfile="library.properties" property="properties.version">
<filterchain>
<tokenfilter>
<containsregex pattern="version\s*=\s*(\d+)*" replace="\1" />
</tokenfilter>
<striplinebreaks />
</filterchain>
</loadfile>
<!-- <echo message="properties.version is ${properties.version}." /> -->
<condition property="revision.correct">
<contains string="${revision}" substring="${properties.version}"/>
</condition>
<!-- the properties.version property won't be set
if $revision wasn't found... -->
<fail unless="revision.correct"
message="Fix version number in library.properties, it should be ${revision}" />
</target>
</project>