Richard S. Hall | d9c80e4 | 2006-10-17 18:16:07 +0000 | [diff] [blame] | 1 | <project name="simplebundle" default="all" basedir="."> |
| 2 | |
| 3 | <!-- Set global properties. --> |
| 4 | <property name="bundle.name" value="simple"/> |
| 5 | <property name="src.dir" value="src"/> |
| 6 | <property name="lib.dir" value="lib"/> |
| 7 | <property name="output.dir" value="classes"/> |
| 8 | <property name="bundle.dir" value="."/> |
| 9 | <property name="doc.dir" value="doc"/> |
| 10 | <property name="apidoc.dir" value="${doc.dir}/api"/> |
| 11 | <property name="dist.dir" value="."/> |
| 12 | <property name="native.dir" value="native"/> |
| 13 | <property name="debug.flag" value="on"/> |
| 14 | |
| 15 | <!-- Create class path from lib and output directories. --> |
| 16 | <path id="classpath"> |
| 17 | <pathelement location="${output.dir}"/> |
| 18 | <fileset dir="${lib.dir}"> |
| 19 | <include name="*.jar"/> |
| 20 | </fileset> |
| 21 | </path> |
| 22 | |
| 23 | <!-- Create output directory. --> |
| 24 | <target name="init"> |
| 25 | <mkdir dir="${output.dir}"/> |
| 26 | </target> |
| 27 | |
| 28 | <!-- Compile and JAR everything --> |
| 29 | <target name="all" depends="init"> |
| 30 | <antcall target="compile"/> |
| 31 | <antcall target="jar"/> |
| 32 | </target> |
| 33 | |
| 34 | <!-- Compile everything. --> |
| 35 | <target name="compile" depends="init"> |
| 36 | <javac srcdir="${src.dir}" destdir="${output.dir}" |
| 37 | debug="${debug.flag}" verbose="no" deprecation="no"> |
| 38 | <classpath refid="classpath"/> |
| 39 | <include name="**/*.java"/> |
| 40 | </javac> |
| 41 | </target> |
| 42 | |
| 43 | <!-- JAR the bundle. --> |
| 44 | <target name="jar" depends="compile"> |
Richard S. Hall | dd94f28 | 2006-10-17 18:36:57 +0000 | [diff] [blame] | 45 | <jar jarfile="${output.dir}/org/apache/felix/examples/${bundle.name}/embedded.jar" |
Richard S. Hall | d9c80e4 | 2006-10-17 18:16:07 +0000 | [diff] [blame] | 46 | basedir="${output.dir}"> |
Richard S. Hall | dd94f28 | 2006-10-17 18:36:57 +0000 | [diff] [blame] | 47 | <include name="org/apache/felix/examples/${bundle.name}/embedded/**"/> |
Richard S. Hall | d9c80e4 | 2006-10-17 18:16:07 +0000 | [diff] [blame] | 48 | </jar> |
| 49 | |
| 50 | <copy todir="${output.dir}"> |
| 51 | <fileset dir="${native.dir}"> |
| 52 | <include name="libfoo.so"/> |
| 53 | </fileset> |
| 54 | </copy> |
| 55 | |
Richard S. Hall | dd94f28 | 2006-10-17 18:36:57 +0000 | [diff] [blame] | 56 | <jar manifest="${src.dir}/org/apache/felix/examples/${bundle.name}/manifest.mf" |
Richard S. Hall | d9c80e4 | 2006-10-17 18:16:07 +0000 | [diff] [blame] | 57 | jarfile="${bundle.dir}/${bundle.name}.jar" |
| 58 | basedir="${output.dir}"> |
Richard S. Hall | dd94f28 | 2006-10-17 18:36:57 +0000 | [diff] [blame] | 59 | <include name="org/apache/felix/examples/${bundle.name}/**"/> |
Richard S. Hall | d9c80e4 | 2006-10-17 18:16:07 +0000 | [diff] [blame] | 60 | <include name="libfoo.so"/> |
Richard S. Hall | dd94f28 | 2006-10-17 18:36:57 +0000 | [diff] [blame] | 61 | <exclude name="org/apache/felix/examples/${bundle.name}/embedded/"/> |
Richard S. Hall | d9c80e4 | 2006-10-17 18:16:07 +0000 | [diff] [blame] | 62 | </jar> |
| 63 | </target> |
| 64 | |
| 65 | <!-- Create the source distribution JAR file. --> |
| 66 | <target name="dist"> |
| 67 | <!-- Create API doc directory. --> |
| 68 | <mkdir dir="${apidoc.dir}"/> |
| 69 | <!-- Generate API documentation. --> |
| 70 | <javadoc sourcepath="${src.dir}" |
| 71 | packagenames="*" |
| 72 | destdir="${apidoc.dir}" |
| 73 | author="true" |
| 74 | windowtitle="${bundle.name} API Documentation"/> |
| 75 | <!-- JAR the source and doc trees. --> |
| 76 | <jar jarfile="${dist.dir}/${bundle.name}-src.jar" |
| 77 | basedir=".."> |
| 78 | <include name="${bundle.name}/LICENSE.txt"/> |
| 79 | <include name="${bundle.name}/build.xml"/> |
| 80 | <include name="${bundle.name}/${lib.dir}/**"/> |
| 81 | <include name="${bundle.name}/${doc.dir}/**"/> |
| 82 | <include name="${bundle.name}/${src.dir}/**"/> |
| 83 | </jar> |
| 84 | </target> |
| 85 | |
| 86 | <!-- Clean up everything. --> |
| 87 | <target name="clean"> |
| 88 | <delete dir="${output.dir}"/> |
| 89 | <delete dir="${apidoc.dir}"/> |
| 90 | <delete file="${bundle.dir}/${bundle.name}.jar"/> |
| 91 | <delete file="${dist.dir}/${bundle.name}-src.jar"/> |
| 92 | </target> |
| 93 | |
| 94 | </project> |