2 <!-- build file for CaptureMJPEG library -->
3 <!-- Created by: Alessio Caiazza <ac@abisso.org> -->
5 <project name="CaptureMJPEG" default="build" basedir=".">
6 <import file="user_pref.xml"/>
9 <pathelement location="${commons-httpclient}"/>
10 <pathelement location="${commons-logging}"/>
11 <pathelement location="${commons-codec}"/>
12 <pathelement location="${processing-core}"/>
16 Build all Java source files into destdir. This is common in Java
17 projects: the compile target is trivial, since it just says to build
18 everything. Fancier compiler targets are easy if you want to build
19 just one file at a time.
21 <target name="build" depends="init">
22 <javac srcdir="${src}"
24 debug="${compile.debug}"
25 excludes="it/lilik/capturemjpeg/**/*Test.java,it/lilik/capturemjpeg/*Test.java"
28 <classpath refid="classpath"/>
30 <!-- <copy todir="${build}">
31 <fileset dir="${src}" excludes="**/*.java"/>
35 <target name="download_deps">
36 <mkdir dir="${libs}"/>
37 <!-- commons-httpclient -->
38 <get src="http://mirror.tomato.it/apache/httpcomponents/commons-httpclient/binary/commons-httpclient-3.1.tar.gz" dest="${libs}/commons-httpclient-3.1.tar.gz" verbose="on" usetimestamp="on" />
39 <gunzip src="${libs}/commons-httpclient-3.1.tar.gz" />
40 <untar src="${libs}/commons-httpclient-3.1.tar" dest="${libs}">
42 <include name="commons-httpclient-3.1/commons-httpclient-3.1.jar"/>
45 <move file="${libs}/commons-httpclient-3.1/commons-httpclient-3.1.jar" todir="${libs}" />
46 <delete file="${libs}/commons-httpclient-3.1.tar.gz" />
47 <delete file="${libs}/commons-httpclient-3.1.tar" />
48 <delete dir="${libs}/commons-httpclient-3.1" />
49 <!-- commons-logging -->
50 <get src="http://archive.apache.org/dist/commons/logging/binaries/commons-logging-1.0.4.tar.gz" dest="${libs}/commons-logging-1.0.4.tar.gz" verbose="on" usetimestamp="on" />
51 <gunzip src="${libs}/commons-logging-1.0.4.tar.gz" />
52 <untar src="${libs}/commons-logging-1.0.4.tar" dest="${libs}">
54 <include name="commons-logging-1.0.4/commons-logging.jar"/>
57 <move file="${libs}/commons-logging-1.0.4/commons-logging.jar" todir="${libs}" />
58 <delete file="${libs}/commons-logging-1.0.4.tar.gz" />
59 <delete file="${libs}/commons-logging-1.0.4.tar" />
60 <delete dir="${libs}/commons-logging-1.0.4" />
61 <!-- commons-codec -->
63 src="http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.2.tar.gz"
64 dest="${libs}/commons-codec-1.2.tar.gz"
65 verbose="on" usetimestamp="on" />
66 <gunzip src="${libs}/commons-codec-1.2.tar.gz" />
67 <untar src="${libs}/commons-codec-1.2.tar" dest="${libs}">
69 <include name="commons-codec-1.2/commons-codec-1.2.jar"/>
72 <move file="${libs}/commons-codec-1.2/commons-codec-1.2.jar" todir="${libs}" />
73 <delete file="${libs}/commons-codec-1.2.tar.gz" />
74 <delete file="${libs}/commons-codec-1.2.tar" />
75 <delete dir="${libs}/commons-codec-1.2" />
78 init is a target that sets things up for the build. Since we use the
79 built-in ant function mkdir, it will only make the directory if it
80 does not already exist.
83 <mkdir dir="${build}"/>
84 <mkdir dir="${docs}" />
85 <mkdir dir="${docs}/api" />
90 <target name="run" depends="build">
91 <java classname="${main.class}"
96 <classpath refid="classpath"/>
102 Always include a clean target to get rid of all the extra files
103 created by the build process, so you can save storage safely, without
104 thinking. Also: sometimes you'll want to do a completely fresh build,
105 such as when changing to a new version of the JDK.
107 <target name="clean" depends="clean-doc" description="Removes previous build">
108 <delete dir="${build}"/>
109 <delete dir="${release}"/>
114 <target name="jar" depends="build, deploy-init">
115 <jar jarfile="${release}/capturemjpeg/library/capturemjpeg.jar">
116 <fileset dir="${build}"
117 excludes="**/*Test.class,**/CaptureToFile.class"/>
119 <attribute name="Built-By" value="${user.name}"/>
126 <target name="deploy-init" depends="">
127 <mkdir dir="${release}"/>
128 <mkdir dir="${release}/capturemjpeg"/>
129 <mkdir dir="${release}/capturemjpeg/library"/>
130 <mkdir dir="${release}/capturemjpeg/licenses"/>
131 <mkdir dir="${release}/capturemjpeg/documentation"/>
134 <target name="deploy" depends="jar, doc">
136 <copy todir="${release}/capturemjpeg/library">
137 <fileset dir="${libs}"/>
139 <!-- copy licenses -->
140 <copy todir="${release}/capturemjpeg/licenses">
141 <fileset dir="./licenses"/>
143 <!-- copy documentation -->
144 <copy todir="${release}/capturemjpeg/documentation">
145 <fileset dir="${docs}/api"/>
147 <!-- create zip file -->
148 <zip destfile="${release}/capturemjpeg.zip"
150 excludes="capturemjpeg.zip"/>
153 <target name="doc" depends="init,clean-doc" description="generate docs">
154 <javadoc packagenames="it.lilik.capturemjpeg.*"
155 destdir="${docs}/api"
161 windowtitle="CaptureMJPEG API">
162 <classpath refid="classpath"/>
163 <fileset dir="${src}" defaultexcludes="yes">
164 <include name="it/lilik/capturemjpeg/**"/>
165 <!-- exclude JUnit from documentation -->
166 <exclude name="it/lilik/capturemjpeg/**/*Test.java"/>
167 <exclude name="it/lilik/capturemjpeg/*Test.java"/>
169 <doctitle><![CDATA[<h1>CaptureMJPEG</h1>]]></doctitle>
170 <bottom><![CDATA[<i>Copyright © 2008 Alessio Caiazza, Cosimo Cecchi All Rights Reserved.</i>]]></bottom>
171 <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
172 <link href="http://hc.apache.org/httpclient-3.x/apidocs/"/>
173 <link href="http://dev.processing.org/reference/core/javadoc/"/>
177 <target name="clean-doc">
178 <delete dir="${docs}/api"/>