forked from WiringProject/Wiring
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
241 lines (182 loc) · 8.17 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
<!--
Top-level TODO:
- get rid of unnecessary copying and work (e.g., apple.jar is copied
to out/dist/ under Linux). This can likely be handled by only fetching
the JARs needed for the current platform.
- align these files more with Ant build file conventions:
http://wiki.apache.org/ant/TheElementsOfAntStyle
In particular, the names of our main targets could probably use some work.
-->
<project name="wiring" default="make" basedir=".">
<description>Wiring IDE build file.</description>
<!-- ====================
Common Configuration
==================== -->
<!-- Current wiring version (FIXME: this is just a stub) -->
<property name="release.version" value="v1.0.0-dev"/>
<!-- out.dir: the parent directory for all build-generated files. -->
<property name="out.dir" location="${basedir}/out"/>
<!-- dist.dir: a staging area for the Wiring IDE distribution. -->
<property name="dist.dir" location="${out.dir}/dist"/>
<!-- deps.dir: dependencies fetched from the network. -->
<property name="deps.dir" location="${out.dir}/deps"/>
<property name="deps.archive" location="${deps.dir}/archive"/>
<property name="deps.extract" location="${deps.dir}/extract"/>
<!-- build.dir: IDE build artifacts (like .class files and pde.jar). -->
<property name="build.dir" location="${out.dir}/ide"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.jar" location="${build.dir}/pde.jar"/>
<!-- javadoc.dir: Contains javadoc output -->
<property name="javadoc.dir" location="${out.dir}/javadoc"/>
<!-- * -->
<!-- framework.dir: the Wiring Framework. -->
<property name="framework.dir" location="${basedir}/framework"/>
<!-- build.rsrc: Build resources. -->
<property name="build.rsrc.dir" location="${basedir}/build"/>
<property name="build.rsrc.shared" location="${build.rsrc.dir}/shared"/>
<property name="build.rsrc.ide-deps" location="${build.rsrc.shared}/lib"/>
<!-- ide.dir: the IDE sources. -->
<property name="ide.dir" location="${basedir}/IDE"/>
<property name="ide.src" location="${ide.dir}"/>
<!-- * -->
<!-- lib.class.path: the IDE's classpath dependencies. -->
<!-- TODO: turn these into external dependencies. -->
<path id="lib.class.path">
<pathelement location="${build.rsrc.ide-deps}/antlr.jar"/>
<pathelement location="${build.rsrc.ide-deps}/apple.jar"/>
<pathelement location="${build.rsrc.ide-deps}/jna.jar"/>
<pathelement location="${build.rsrc.ide-deps}/serial/serial.jar"/>
<pathelement location="${build.rsrc.ide-deps}/serial/RXTXcomm.jar"/>
<pathelement location="${build.rsrc.ide-deps}/processing.jar"/>
<!-- TODO: do we really still depend on ECJ? -->
<pathelement location="${build.rsrc.ide-deps}/ecj.jar"/>
</path>
<!-- ide.main.class is the class which provides the IDE's main() method. -->
<property name="ide.main.class" value="processing.app.Base"/>
<!-- * -->
<!-- External dependency configuration.
TODO use a real dependency management tool (e.g. Apache Ivy).
TODO sort out what to do about already-generated ANTLR java sources.
Notes:
* dep.foo.remote is the URL dependency foo's archive from.
* dep.foo.local is the local path to save foo's archive in.
* Remote URLs not given here are specified in the
platform-specific build.xml. -->
<property name="dep.toolchain.avr.local"
location="${deps.archive}/tools-avr.tgz"/>
<property name="dep.reference.remote"
value="http://wiring.googlecode.com/files/reference.zip"/>
<property name="dep.reference.local"
location="${deps.archive}/reference.zip"/>
<!-- ==================================
Platform Configuration and Targets
================================== -->
<!-- Detect platform, setting the "plat.name" property to "macosx",
"linux", or "windows". -->
<condition property="plat.name" value="macosx">
<os family="mac"/>
</condition>
<condition property="plat.name" value="linux">
<!-- NB: this is true on all non-OS X Unices, not just Linux. -->
<and>
<os family="unix"/>
<not><os family="mac"/></not> <!-- Ant considers OS X a Unix -->
</and>
</condition>
<condition property="plat.name" value="windows">
<os family="windows"/>
</condition>
<!-- build.rsrc.plat: Platform-specific build resources -->
<property name="build.rsrc.plat" location="${build.rsrc.dir}/${plat.name}"/>
<import file="${build.rsrc.plat}/plat-build.xml"/>
<!-- ==============
Common Targets
==============
Note that several of these are currently just aliases for
platform-specific targets (defined in the platform
plat-build.xml). Keep it this way; it will let us insert any
portable functionality easily in the future.
-->
<!-- dist -->
<target name="dist" depends="platform.-dist"
description="Build the Wiring IDE distributable"/>
<!-- make -->
<target name="make" depends="platform.-make"
description="Build Wiring IDE for local use"/>
<!-- run -->
<target name="run" depends="make,platform.-run"
description="Build and run Wiring IDE"/>
<!-- build -->
<target name="build" depends="init,resolve.deps"
description="Build Wiring IDE's Java source code">
<javac srcdir="${ide.src}"
destdir="${build.classes}"
includeAntRuntime="false"
source="1.5" target="1.5"
bootclasspath="${platform.bootclasspath}" extdirs=""
classpathref="lib.class.path"/>
<jar destfile="${build.jar}" basedir="${build.classes}" update="true">
<manifest>
<attribute name="Main-Class" value="processing.app.Base"/>
</manifest>
</jar>
</target>
<!-- JavaDoc -->
<target name="javadoc" depends="init"
description="Generate JavaDoc HTML output">
<javadoc sourcepath="${ide.src}" destdir="${javadoc.dir}"
packagenames="processing.app.*" classpathref="lib.class.path"
Bootclasspath="${platform.bootclasspath}"/>
</target>
<!-- Dependency resolution -->
<!-- FIXME: Symlinks and permissions are not handled properly. We
currently resort to platform-specific workaround hacks. -->
<target name="resolve.deps"
depends="-resolve.dep.avr,-resolve.dep.reference,platform.-resolve.deps"
description="Handle dependency resolution and retrieval">
</target>
<!-- The following if="dep.avr.default.ok" is an ugly hack to allow
individual platforms to override AVR toolchain retrieval. Sigh. -->
<target name="-resolve.dep.avr"
depends="-check.dep.avr"
if="dep.avr.default.ok"
unless="exists.dep.avr">
<get src="${dep.toolchain.avr.remote}" dest="${dep.toolchain.avr.local}"/>
<untar src="${dep.toolchain.avr.local}"
dest="${deps.extract}" compression="gzip"/>
</target>
<target name="-check.dep.avr" depends="init">
<available property="exists.dep.avr" file="${dep.toolchain.avr.local}"/>
</target>
<target name="-resolve.dep.reference"
depends="-check.dep.reference"
unless="exists.dep.reference">
<get src="${dep.reference.remote}" dest="${dep.reference.local}"/>
<unzip src="${dep.reference.local}" dest="${deps.extract}"/>
</target>
<target name="-check.dep.reference" depends="init">
<available property="exists.dep.reference" file="${dep.reference.local}"/>
</target>
<!-- Cleanup -->
<target name="clean"
description="Remove built IDE files">
<delete dir="${build.dir}" quiet="true"/>
<delete dir="${dist.dir}" quiet="true"/>
</target>
<target name="clean.all"
description="Remove build files and downloaded dependencies">
<delete dir="${out.dir}" quiet="true"/>
</target>
<!-- Initialization -->
<target name="init" depends="platform.-init"
description="Initialize output directories">
<mkdir dir="${out.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${deps.dir}"/>
<mkdir dir="${deps.archive}"/>
<mkdir dir="${deps.extract}"/>
<mkdir dir="${javadoc.dir}"/>
</target>
</project>