source: tags/loci-tools-2008-Dec-29/common.xml @ 4712

Revision 4712, 7.5 KB checked in by melissa, 11 years ago (diff)

2008 Dec 29 release of LOCI Tools

Line 
1<!--
2common.xml
3
4Ant build file for logic common to every component.
5Download Apache Ant from http://ant.apache.org/.
6Type "ant -p" for a list of targets.
7-->
8
9<project>
10  <property file="${user.home}/.ant-global.properties"/>
11  <property file="${root.dir}/global.properties"/>
12  <property file="${root.dir}/common.properties"/>
13
14  <condition property="isUnix"><os family="unix"/></condition>
15
16  <!-- Non-core ant tasks -->
17
18  <!-- NB - We do not reference ${artifact.dir}/loci-checks.jar directly,
19    as doing so causes loci-checks.jar to be locked by some file systems
20    (Windows in particular), which causes the clean and clean-jars targets
21    to fail. -->
22  <taskdef resource="checkstyletask.properties"
23    classpath="${lib.dir}/checkstyle-all-4.2.jar:${lib.dir}/loci-checks.jar"/>
24
25  <taskdef resource="net/sf/antcontrib/antcontrib.properties"
26    classpath="${lib.dir}/ant-contrib-1.0b1.jar"/>
27  <!-- HACK - some environments do not install the antcontrib tasks properly
28  from antcontrib.properties above; also load them from antlib.xml -->
29  <taskdef resource="net/sf/antcontrib/antlib.xml"
30    classpath="${lib.dir}/ant-contrib-1.0b1.jar"/>
31
32  <taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties"
33    classpath="${lib.dir}/findbugs-ant.jar"/>
34
35  <!--
36  <taskdef resource="proguard/ant/task.properties"
37    classpath="${lib.dir}/proguard.jar"/>
38  -->
39
40  <!-- Main build targets -->
41
42  <target name="compile" depends="copy-source"
43    description="compile classes">
44    <javac debug="true" deprecation="true"
45      source="${component.java-version}"
46      target="${component.java-version}"
47      srcdir="${dest.dir}" destdir="${classes.dir}"
48      classpath="${component.classpath}"
49      includes="${component.source}"/>
50  </target>
51
52  <target name="exec" depends="compile" description="execute package">
53    <java fork="true" classname="${component.main-class}"
54      classpath="${classes.dir}:${component.runtime-cp}"/>
55  </target>
56
57  <target name="findbugs" depends="compile"
58    description="check source code for bugs">
59    <if>
60      <isset property="findbugs.home"/>
61      <then>
62        <findbugs home="${findbugs.home}" jvmargs="-Xmx512m"
63          output="xml" outputFile="${build.dir}/findbugs.xml">
64          <auxClasspath path="${component.classpath}"/>
65          <sourcePath path="${dest.dir}"/>
66          <class location="${classes.dir}"/>
67        </findbugs>
68        <java jar="${findbugs.home}/findbugs.jar" fork="true">
69          <arg value="${build.dir}/findbugs.xml"/>
70        </java>
71      </then>
72      <else>
73        <echo>Please set the findbugs.home property to point to your</echo>
74        <echo>FindBugs installation's lib directory. E.g.:</echo>
75        <echo>  ant -Dfindbugs.home=${user.home}/findbugs/lib findbugs</echo>
76      </else>
77    </if>
78  </target>
79
80  <target name="style" depends="compile"
81    description="check source code style">
82    <checkstyle config="${root.dir}/checkstyle.xml" failOnViolation="false"
83      classpath="${classes.dir}:${component.classpath}">
84      <fileset dir="${dest.dir}" includes="${component.source}"/>
85    </checkstyle>
86  </target>
87
88  <target name="jar" depends="compile"
89    description="generate JAR file">
90    <mkdir dir="${artifact.dir}"/>
91    <jar jarfile="${artifact.dir}/${component.jar}" basedir="${classes.dir}">
92      <manifest>
93        <attribute name="Main-Class" value="${component.main-class}"/>
94        <attribute name="Class-Path" value="${component.manifest-cp}"/>
95      </manifest>
96    </jar>
97  </target>
98
99  <target name="docs" depends="compile"
100    description="generate javadocs">
101    <javadoc sourcepath="${dest.dir}" destdir="${docs.dir}/api"
102      classpath="${component.classpath}:${classes.dir}"
103      author="true" version="true" use="true"
104      nodeprecated="true" windowtitle="Bio-Formats API">
105      <packageset dir="${dest.dir}"/>
106      <doctitle><![CDATA[<h1>Bio-Formats</h1>]]></doctitle>
107      <bottom><![CDATA[${copyright.begin} ${YEAR} ${copyright.end}]]></bottom>
108      <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
109      <link href="http://hudson.openmicroscopy.org.uk/job/OMEJAVA/javadoc/"/>
110      <link href="http://rsbweb.nih.gov/ij/developer/api/"/>
111      <link href="http://www.ssec.wisc.edu/~dglo/docs/"/>
112      <!--<link href="http://www.jdocs.com/formlayout/1.0.4/api/"/>-->
113      <!--<link href="http://www.jdocs.com/looks/1.2.2/api/"/>-->
114    </javadoc>
115  </target>
116
117  <target name="clean" description="remove all build files except artifacts">
118    <delete dir="${build.dir}"/>
119  </target>
120
121  <target name="clean-classes" description="remove classes from build folder">
122    <delete dir="${classes.dir}"/>
123  </target>
124
125  <target name="clean-dist"
126    description="remove distribution bundles from build folder">
127    <delete dir="${dist.dir}"/>
128  </target>
129
130  <target name="clean-docs" description="remove javadocs from build folder">
131    <delete dir="${docs.dir}"/>
132  </target>
133
134  <target name="clean-src" description="remove source files from build folder">
135    <delete dir="${dest.dir}"/>
136  </target>
137
138  <target name="clean-jar" description="remove JAR file from artifacts folder">
139    <delete>
140      <fileset dir="${artifact.dir}" includes="${component.jar}"/>
141    </delete>
142  </target>
143
144  <!-- Internal build targets -->
145
146  <target name="init">
147    <tstamp>
148      <format property="DATE" pattern="d MMMMM yyyy"/>
149      <format property="YEAR" pattern="yyyy"/>
150    </tstamp>
151    <!-- determine SVN revision number -->
152    <if>
153      <isset property="svn.revision"/>
154      <else>
155        <!--
156        Thanks to Chris Collins for this code snippet:
157          http://ccollins.wordpress.com/2008/01/30/
158            getting-subversion-revision-in-ant/
159        -->
160        <exec executable="svn" outputproperty="svn.log"
161          failifexecutionfails="false">
162          <arg line="info ${base.dir}"/>
163        </exec>
164        <if>
165          <isset property="svn.log"/>
166          <then>
167            <propertyregex property="svn.revision"
168              input="${svn.log}" select="\1">
169              <regexp pattern="Revision: ([0-9]*)"/>
170            </propertyregex>
171            <!--<echo>SVN revision: ${svn.revision}</echo>-->
172          </then>
173        </if>
174      </else>
175    </if>
176    <!-- construct manifest classpath -->
177    <propertyregex property="component.manifest-cp-temp"
178      input="${component.runtime-cp}" replace=""
179      defaultValue="${component.runtime-cp}">
180      <regexp pattern="[^\:]*\/"/>
181    </propertyregex>
182    <propertyregex property="component.manifest-cp"
183      input="${component.manifest-cp-temp}" replace=" "
184      defaultValue="${component.manifest-cp-temp}">
185      <regexp pattern=":"/>
186    </propertyregex>
187    <!--<echo>Manifest-Classpath: ${component.manifest-cp}</echo>-->
188  </target>
189
190  <target name="copy-source" depends="init">
191    <!-- copy binary resources without filtering -->
192    <copy todir="${dest.dir}" preservelastmodified="true">
193      <fileset dir="${src.dir}" includes="${component.resources-bin}"/>
194    </copy>
195    <!-- copy source files and text resources with filtering -->
196    <filter token="date" value="${DATE}"/>
197    <filter token="year" value="${YEAR}"/>
198    <filter token="svn.revision" value="${svn.revision}"/>
199    <filter token="visbio.version" value="${visbio.version}"/>
200    <copy todir="${dest.dir}" filtering="true" preservelastmodified="true">
201      <fileset dir="${src.dir}"
202        includes="${component.source} ${component.resources-text}"/>
203    </copy>
204    <!-- copy resources to classes folder -->
205    <copy todir="${classes.dir}" preservelastmodified="true">
206      <fileset dir="${dest.dir}" excludes="${component.source}"/>
207    </copy>
208  </target>
209
210</project>
Note: See TracBrowser for help on using the repository browser.