Find file
Fetching contributors…
Cannot retrieve contributors at this time
242 lines (182 sloc) 8.19 KB
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:
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.1-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/jssc.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"/>
<!-- ide.main.class is the class which provides the IDE's main() method. -->
<property name="ide.main.class" value=""/>
<!-- * -->
<!-- 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.
* is the URL dependency foo's archive from.
* 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"
<property name="dep.reference.remote"
<property name="dep.reference.local"
<!-- ==================================
Platform Configuration and Targets
================================== -->
<!-- Detect platform, setting the "" property to "macosx",
"linux", or "windows". -->
<condition property="" value="macosx">
<os family="mac"/>
<condition property="" value="linux">
<!-- NB: this is true on all non-OS X Unices, not just Linux. -->
<os family="unix"/>
<not><os family="mac"/></not> <!-- Ant considers OS X a Unix -->
<condition property="" value="windows">
<os family="windows"/>
<!-- build.rsrc.plat: Platform-specific build resources -->
<property name="build.rsrc.plat" location="${build.rsrc.dir}/${}"/>
<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}"
source="1.5" target="1.5"
bootclasspath="${platform.bootclasspath}" extdirs=""
<jar destfile="${build.jar}" basedir="${build.classes}" update="true">
<attribute name="Main-Class" value=""/>
<!-- JavaDoc -->
<target name="javadoc" depends="init"
description="Generate JavaDoc HTML output">
<javadoc sourcepath="${ide.src}" destdir="${javadoc.dir}"
packagenames="*" classpathref="lib.class.path"
<!-- Dependency resolution -->
<!-- FIXME: Symlinks and permissions are not handled properly. We
currently resort to platform-specific workaround hacks. -->
<target name="resolve.deps"
description="Handle dependency resolution and retrieval">
<!-- 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"
<get src="${dep.toolchain.avr.remote}" dest="${dep.toolchain.avr.local}"/>
<untar src="${dep.toolchain.avr.local}"
dest="${deps.extract}" compression="gzip"/>
<target name="-check.dep.avr" depends="init">
<available property="exists.dep.avr" file="${dep.toolchain.avr.local}"/>
<target name="-resolve.dep.reference"
<get src="${dep.reference.remote}" dest="${dep.reference.local}"/>
<unzip src="${dep.reference.local}" dest="${deps.extract}"/>
<target name="-check.dep.reference" depends="init">
<available property="exists.dep.reference" file="${dep.reference.local}"/>
<!-- Cleanup -->
<target name="clean" depends="platform.-clean"
description="Remove built IDE files">
<delete dir="${out.dir}" quiet="true"/>
<delete dir="${dist.dir}" quiet="true"/>
<target name="clean.all"
description="Remove build files and downloaded dependencies">
<delete dir="${out.dir}" quiet="true"/>
<!-- 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}"/>