source: branches/4.1/components/java.xml @ 5617

Revision 5617, 6.7 KB checked in by melissa, 11 years ago (diff)

Fixed compile errors, for real this time.

Line 
1<!--
2java.xml
3
4Ant build file for logic common to Java-based components.
5All Java-based component build files inherit from this build file.
6Download Apache Ant from http://ant.apache.org/.
7Type "ant -p" for a list of targets.
8-->
9
10<project>
11  <property file="${root.dir}/components/java.properties"/>
12  <import file="${root.dir}/components/common.xml"/>
13
14  <!-- Main build targets -->
15
16  <target name="compile" depends="copy-source" description="compile classes">
17    <javac debug="true" deprecation="${component.deprecation}"
18      source="${component.java-version}"
19      target="${component.java-version}"
20      srcdir="${dest.dir}" destdir="${classes.dir}"
21      classpath="${component.classpath}"
22      includes="${component.source}"/>
23  </target>
24
25  <target name="exec" depends="compile" description="execute package">
26    <java fork="true" classname="${component.main-class}"
27      classpath="${classes.dir}:${component.runtime-cp}"/>
28  </target>
29
30  <target name="findbugs" depends="jar"
31    description="check source code for bugs">
32    <if>
33      <isset property="findbugs.home"/>
34      <then>
35        <findbugs home="${findbugs.home}" jvmargs="-Xmx512m"
36          output="xml:withMessages" outputFile="${build.dir}/findbugs.xml"
37          excludeFilter="${root.dir}/excludebugs.xml" reportLevel="high">
38          <auxClasspath path="${component.classpath}"/>
39          <sourcePath path="${dest.dir}"/>
40          <class location="${classes.dir}"/>
41        </findbugs>
42      </then>
43      <else>
44<echo>
45Please set the findbugs.home property to point to
46your FindBugs installation's lib directory. E.g.:
47  ant -Dfindbugs.home=${user.home}/findbugs/lib findbugs
48</echo>
49        <fail message="FindBugs not found."/>
50      </else>
51    </if>
52  </target>
53
54  <target name="style" depends="compile"
55    description="check source code style">
56    <checkstyle config="${root.dir}/checkstyle.xml" failOnViolation="false"
57      classpath="${classes.dir}:${component.classpath}">
58      <fileset dir="${dest.dir}" includes="${component.source}"/>
59    </checkstyle>
60  </target>
61
62  <target name="jar" depends="compile"
63    description="generate JAR file">
64    <mkdir dir="${artifact.dir}"/>
65    <jar jarfile="${artifact.dir}/${component.jar}" basedir="${classes.dir}">
66<!--
67      <manifest>
68        <attribute name="Main-Class" value="${component.main-class}"/>
69        <attribute name="Class-Path" value="${component.manifest-cp}"/>
70      </manifest>
71-->
72    </jar>
73    <!-- NB: Add OSGi bundle metadata. -->
74    <echo>Injecting OSGi bundle information...</echo>
75    <bundle outputDir="${artifact.dir}"
76      bundleName="${component.name}"
77      bundleSymbolicName="${domain.prefix}.${component.name}"
78      bundleVersion="${component.version}.${svn.revision}"
79      classpath="${classes.dir}"
80      exportPackage="*;version=&quot;${component.version}&quot;"
81      filename="${component.name}">
82      <manifest>
83        <attribute name="Main-Class" value="${component.main-class}"/>
84        <attribute name="Class-Path" value="${component.manifest-cp}"/>
85      </manifest>
86    </bundle>
87  </target>
88
89  <target name="utils" depends="jar"
90    description="compile extra utilities">
91    <delete>
92      <fileset dir="${utils.dir}" includes="*.class"/>
93    </delete>
94    <javac debug="true" deprecation="true" source="1.5" target="1.5"
95      srcdir="${utils.dir}" includes="*.java"
96      classpath="${artifact.dir}/${component.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/visad-docs/javadoc/"/>
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-classes" description="remove classes from build folder">
118    <delete dir="${classes.dir}"/>
119  </target>
120
121  <target name="clean-dist"
122    description="remove distribution bundles from build folder">
123    <delete dir="${dist.dir}"/>
124  </target>
125
126  <target name="clean-docs" description="remove javadocs from build folder">
127    <delete dir="${docs.dir}"/>
128  </target>
129
130  <target name="clean-src" description="remove source files from build folder">
131    <delete dir="${dest.dir}"/>
132  </target>
133
134  <target name="clean-jar" description="remove JAR file from artifacts folder">
135    <delete>
136      <fileset dir="${artifact.dir}" includes="${component.jar}"/>
137    </delete>
138  </target>
139
140  <!-- Internal build targets -->
141
142  <target name="init"
143    depends="init-timestamp, init-revision, init-release, init-manifest-cp"/>
144
145  <target name="init-manifest-cp">
146    <!-- construct manifest classpath -->
147    <propertyregex property="component.manifest-cp-temp"
148      input="${component.runtime-cp}" replace=""
149      defaultValue="${component.runtime-cp}">
150      <regexp pattern="[^\:]*\/"/>
151    </propertyregex>
152    <propertyregex property="component.manifest-cp"
153      input="${component.manifest-cp-temp}" replace=" "
154      defaultValue="${component.manifest-cp-temp}">
155      <regexp pattern=":"/>
156    </propertyregex>
157    <!--<echo>Manifest-Classpath: ${component.manifest-cp}</echo>-->
158  </target>
159
160  <target name="copy-source" depends="init">
161    <!-- copy binary resources -->
162    <copy todir="${dest.dir}" preservelastmodified="true">
163      <!--
164        include (none) to prevent problems if component.resources-bin is empty
165      -->
166      <fileset dir="${src.dir}" includes="(none) ${component.resources-bin}"/>
167    </copy>
168    <!-- copy source files and text resources with filtering -->
169    <copy todir="${dest.dir}" preservelastmodified="true">
170      <fileset dir="${src.dir}"
171        includes="${component.source} ${component.resources-text}"/>
172      <filterset>
173        <filter token="date" value="${DATE}"/>
174        <filter token="year" value="${YEAR}"/>
175        <filter token="svn.revision" value="${svn.revision}"/>
176        <filter token="visbio.version" value="${visbio.version}"/>
177        <filter token="release.version" value="${release.version}"/>
178      </filterset>
179    </copy>
180    <!-- copy resources to classes folder -->
181    <copy todir="${classes.dir}" preservelastmodified="true">
182      <fileset dir="${dest.dir}" excludes="${component.source}"/>
183    </copy>
184  </target>
185
186</project>
Note: See TracBrowser for help on using the repository browser.