File: build.xml

package info (click to toggle)
libxjavadoc-java 1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 652 kB
  • ctags: 1,061
  • sloc: java: 6,259; xml: 505; makefile: 11
file content (238 lines) | stat: -rw-r--r-- 9,615 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<?xml version="1.0"?>

<project name="XJavaDoc" default="jar" basedir=".">
   <property name="version" value="1.1"/>
   <property name="build.dir" location="${basedir}/target"/>
   <property name="jardir" location="${build.dir}"/>
   <property name="rootdir" location="${basedir}"/>
   <property name="javacchome" location="${basedir}/lib"/>

   <!-- =================================================================== -->
   <!-- Initialization target.                                              -->
   <!-- =================================================================== -->
   <target name="init">

      <path id="classpath">
         <fileset dir="${basedir}/lib">
            <include name="*.jar"/>
         </fileset>
         <fileset dir="${ant.home}/lib">
            <include name="*.jar"/>
         </fileset>
         <pathelement path="${build.dir}/classes"/>
         <pathelement path="${build.dir}/test-classes"/>
         <pathelement path="${java.home}/../lib/tools.jar"/>
      </path>
   </target>

   <!-- =================================================================== -->
   <!-- Prepares the source code                                            -->
   <!-- =================================================================== -->
   <target name="prepare" depends="init">
      <mkdir dir="${build.dir}/src"/>
      <mkdir dir="${build.dir}/junit"/>
      <mkdir dir="${build.dir}/classes"/>
      <copy todir="${build.dir}/src">
         <fileset dir="${basedir}/src">
            <include name="**/*.java"/>
            <include name="**/package.html"/>
         </fileset>
      </copy>
      <copy todir="${build.dir}/junit">
         <fileset dir="${basedir}/junit">
            <include name="**/*.java"/>
            <include name="**/package.html"/>
         </fileset>
      </copy>
   </target>

   <!-- =================================================================== -->
   <!-- Compiles the source code                                            -->
   <!-- =================================================================== -->
   <target name="compile" depends="generate-parsers" description="Compiles the source code">
      <javac
         srcdir="${build.dir}/src"
         destdir="${build.dir}/classes"
         classpathref="classpath"
         debug="on"
         deprecation="on"
         optimize="off"
         nowarn="off"
      />
   </target>

   <!-- =================================================================== -->
   <!-- Makes the jar                                                       -->
   <!-- =================================================================== -->
   <target name="jar" depends="junit">
      <jar jarfile="${jardir}/xjavadoc-${version}.jar">
         <fileset dir="${build.dir}/classes">
            <exclude name="**/*Test.class"/>
         </fileset>
         <!--fileset dir="${log4j.dir}">
            <include name="${log4j.file}"/>
         </fileset-->
      </jar>
   </target>

   <!-- =================================================================== -->
   <!-- Generates JUnit tests                                               -->
   <!-- =================================================================== -->
   <target name="generate-tests" depends="compile" description="Generates JUnit tests">
      <!--
      WE'RE USING THE OLD XDOCLET, THE ONE THAT USES SUN'S JAVADOC.
      IT'S TO SEE IF XJAVADOC DOES THE SAME JOB AS JAVADOC
      -->
      <taskdef
         name="xdoclet"
         classname="xdoclet.DocletTask"
         classpathref="classpath"
      />

      <xdoclet
         sourcepath="${basedir}/src"
         destdir="${build.dir}/junit"
         classpathref="classpath"
      >
         <fileset dir="${build.dir}/src">
            <!-- Just run it over the biggest classes -->
            <include name="xjavadoc/XJavaDoc.java"/>
            <include name="xjavadoc/AbstractClass.java"/>
            <include name="xjavadoc/XDoc.java"/>
            <include name="xjavadoc/SourceClass.java"/>
            <include name="xjavadoc/DefaultXTag.java"/>
            <include name="xjavadoc/AbstractExecutableMember.java"/>
            <include name="xjavadoc/XClass.java"/>
            <exclude name="**/*__GENERATED__Test.java"/>
         </fileset>
         <template
            templateFile="${basedir}/etc/xjavadoctest.j"
            destinationFile="{0}__GENERATED__Test.java"
            subTaskClassName="xdoclet.NoInnerClassSubTask"
         />
      </xdoclet>

      <mkdir dir="${build.dir}/test-classes"/>
      <javac
         srcdir="${build.dir}/junit"
         destdir="${build.dir}/test-classes"
         classpathref="classpath"
         debug="on"
         deprecation="on"
         optimize="off"
         nowarn="off"
      />
   </target>

   <!-- =================================================================== -->
   <!-- Runs JUnit tests                                                    -->
   <!-- =================================================================== -->
   <target name="junit" depends="generate-tests" description="Runs All JUnit tests">
      <mkdir dir="${build.dir}/test-reports"/>
      <junit
         fork="yes"
         printsummary="yes"
         haltonfailure="true"
      >
         <classpath refid="classpath"/>
         <sysproperty key="basedir" value="${rootdir}"/>

         <batchtest todir="${build.dir}/test-reports">
            <fileset dir="${build.dir}/test-classes"/>

            <formatter type="xml"/>
         </batchtest>
      </junit>
   </target>

   <!-- =================================================================== -->
   <!-- Generates test reports                                              -->
   <!-- =================================================================== -->
   <target name="junit-report" depends="junit" description="Generates JUnit test reports">
      <mkdir dir="${build.dir}/docs/junit"/>
      <junitreport todir="${build.dir}/docs/junit">
         <fileset dir="${build.dir}/test-reports">
            <include name="TEST-*.xml"/>
         </fileset>
         <report format="frames" todir="${build.dir}/docs/junit"/>
      </junitreport>
   </target>

   <!-- =================================================================== -->
   <!-- Cleans targets                                                      -->
   <!-- =================================================================== -->
   <target name="clean" depends="init" description="Cleans the build directories">
      <delete dir="${build.dir}"/>
   </target>

   <!-- =================================================================== -->
   <!-- Copies the grammar, replacing @parser-class@ and                    -->
   <!-- @set-compilation-unit@ with a one-liner of java code                -->
   <!-- =================================================================== -->
   <target name="copy-grammar">
      <copy
         file="${basedir}/javacc/Java1.2-b.jjt"
         tofile="${build.dir}/src/xjavadoc/${destination-grammar}"
      >
         <filterset>
            <filter token="parser-class" value="${parser-class}" />
            <filter token="set-compilation-unit" value="${set-compilation-unit}" />
         </filterset>
      </copy>
   </target>

   <target name="generate-parsers" depends="generate-node-parser,generate-simple-parser"/>

   <!-- =================================================================== -->
   <!-- JavaCC                                                              -->
   <!-- =================================================================== -->
   <target name="generate-simple-parser" depends="prepare">
      <antcall target="copy-grammar">
         <param name="destination-grammar" value="simpleparser.jj"/>
         <param name="parser-class" value="SimpleParser"/>
         <param name="set-compilation-unit" value="// In SimpleParser we can't use nodes"/>
      </antcall>
      <javacc
         target="${build.dir}/src/xjavadoc/simpleparser.jj"
         javacchome="${javacchome}"
         javaunicodeescape="true"
         unicodeinput="false"
         static="false"
         cachetokens="true"
      />
   </target>

   <!-- =================================================================== -->
   <!-- JavaCC                                                              -->
   <!-- =================================================================== -->
   <target name="generate-node-parser" depends="jjtree">
      <javacc
         target="${build.dir}/src/xjavadoc/nodeparser.jj"
         javacchome="${javacchome}"
         javaunicodeescape="true"
         unicodeinput="false"
         static="false"
         cachetokens="true"
      />
   </target>

   <!-- =================================================================== -->
   <!-- JJTree                                                              -->
   <!-- =================================================================== -->
   <target name="jjtree" depends="prepare">
      <antcall target="copy-grammar">
         <param name="destination-grammar" value="nodeparser.jjt"/>
         <param name="parser-class" value="NodeParser"/>
         <param name="set-compilation-unit" value="sourceClass.setCompilationUnit( jjtThis );"/>
      </antcall>
      <jjtree
         target="${build.dir}/src/xjavadoc/nodeparser.jjt"
         outputdirectory="${build.dir}/src/xjavadoc"
         javacchome="${javacchome}"
         static="false"
         nodeusesparser="true"
         visitor="false"
         multi="false"
      />
   </target>
</project>