-
Notifications
You must be signed in to change notification settings - Fork 235
/
build.xml
193 lines (158 loc) · 6.64 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
<?xml version="1.0"?>
<project name="Processing PDE" default="build">
<!-- Current version of Ant that works with Processing -->
<!-- (Cannot use ant.version as the name of the property
because that conflicts with the built-in variable) -->
<property name="ant.version.num" value="1.10.12" />
<!-- the .zip file to be downloaded -->
<property name="ant.zip" value="apache-ant-${ant.version.num}-bin.zip" />
<!-- TODO implement a fallback URL that points to a location
on download.processing.org so it's available forever. -->
<property name="ant.url"
value="https://archive.apache.org/dist/ant/binaries/${ant.zip}" />
<fileset id="ant.files" dir="lib">
<include name="ant.jar" />
<include name="ant-launcher.jar" />
</fileset>
<condition property="ant.present">
<resourcecount refid="ant.files" when="eq" count="2" />
</condition>
<!-- ok to ignore failed downloads if we at least have a version that's local -->
<condition property="ant.ignorable" value="false" else="true">
<isset property="ant.present" />
</condition>
<target name="download-ant" unless="ant.present">
<get src="${ant.url}" dest="${ant.zip}"
ignoreerrors="${ant.ignorable}"
usetimestamp="true" />
<property name="ant.zip.prefix" value="apache-ant-${ant.version.num}/lib" />
<unzip src="${ant.zip}" dest="lib">
<patternset>
<!-- unzip a single jar from the ant.zip.prefix subdirectory in the .zip -->
<include name="${ant.zip.prefix}/ant.jar" />
<include name="${ant.zip.prefix}/ant-launcher.jar" />
</patternset>
<mapper>
<!-- remove the ant.zip.prefix from the path when saving the .jar -->
<globmapper from="${ant.zip.prefix}/*" to="*" />
</mapper>
</unzip>
<delete file="${ant.zip}" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Current version of JNA that works with Processing -->
<property name="jna.version" value="5.12.1" />
<!-- the .zip file to be downloaded -->
<property name="jna.zip" value="${jna.version}.zip" />
<!-- TODO implement a fallback URL that points to a location
on download.processing.org so it's available forever. -->
<property name="jna.url"
value="https://github.com/java-native-access/jna/archive/${jna.zip}" />
<fileset id="jna.files" dir="lib">
<include name="jna.jar" />
<include name="jna-platform.jar" />
</fileset>
<condition property="jna.present">
<resourcecount refid="jna.files" when="eq" count="2" />
</condition>
<!-- <available file="lib/jna.jar" property="jna.present" /> -->
<!-- ok to ignore failed downloads if we at least have a version that's local -->
<condition property="jna.ignorable" value="false" else="true">
<isset property="jna.present" />
</condition>
<target name="download-jna" unless="jna.present">
<get src="${jna.url}" dest="."
ignoreerrors="${jna.ignorable}"
usetimestamp="true" />
<property name="jna.zip.prefix" value="jna-${jna.version}/dist" />
<unzip src="${jna.zip}" dest="lib">
<patternset>
<!-- unzip a single jar from the jna.zip.prefix subdirectory in the .zip -->
<include name="${jna.zip.prefix}/jna.jar" />
<include name="${jna.zip.prefix}/jna-platform.jar" />
</patternset>
<mapper>
<!-- remove the jna.zip.prefix from the path when saving the .jar -->
<globmapper from="${jna.zip.prefix}/*" to="*" />
</mapper>
</unzip>
<delete file="${jna.zip}" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<property name="flatlaf.version" value="2.4" />
<fileset id="flatlaf.files" dir="lib">
<include name="flatlaf.jar" />
</fileset>
<!-- TODO implement a fallback URL that points to a location
on download.processing.org so it's available forever. -->
<property name="flatlaf.url"
value="https://repo1.maven.org/maven2/com/formdev/flatlaf/${flatlaf.version}/flatlaf-${flatlaf.version}.jar" />
<available file="lib/flatlaf.jar" property="flatlaf.present" />
<!-- ok to ignore failed downloads if we at least have a version that's local -->
<condition property="flatlaf.ignorable" value="false" else="true">
<isset property="flatlaf.present" />
</condition>
<target name="download-flatlaf" unless="flatlaf.present">
<get src="${flatlaf.url}" dest="lib/flatlaf.jar"
ignoreerrors="${flatlaf.ignorable}"
usetimestamp="true" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="compile" description="Compile sources"
depends="download-ant, download-jna, download-flatlaf">
<condition property="core-built">
<available file="../core/library/core.jar" />
</condition>
<fail unless="core-built" message="Please build the core library first and make sure it is located at ../core/library/core.jar" />
<mkdir dir="bin" />
<copy todir="bin">
<fileset dir="src">
<!-- copy languages files -->
<include name="processing/app/languages/*.properties" />
<!-- FlatLaf.properties and any others -->
<include name="processing/app/laf/*.properties" />
</fileset>
</copy>
<!-- in some cases, pde.jar was not getting built
https://github.com/processing/processing/issues/1792 -->
<delete file="pde.jar" />
<!-- env used to set classpath below -->
<property environment="env" />
<javac source="17"
target="17"
destdir="bin"
excludes="**/tools/format/**"
encoding="UTF-8"
includeAntRuntime="false"
classpath="../core/library/core.jar;
lib/ant.jar;
lib/ant-launcher.jar;
lib/flatlaf.jar;
lib/jna.jar;
lib/jna-platform.jar"
debug="on"
nowarn="true">
<compilerarg value="-Xlint:deprecation" />
<src path="src" />
</javac>
</target>
<target name="build" depends="compile" description="Build PDE">
<jar basedir="bin" destfile="pde.jar" />
</target>
<target name="clean-libs" description="Remove the downloaded libraries">
<delete>
<fileset refid="ant.files" />
<fileset refid="flatlaf.files" />
<fileset refid="jna.files" />
</delete>
<!--
<antcall target="download-ant" />
<antcall target="download-flatlaf" />
<antcall target="download-jna" />
-->
</target>
<target name="clean" description="Clean the build directories">
<delete dir="bin" />
<delete file="pde.jar" />
</target>
</project>