Massive indent of all codes:
[scilab.git] / scilab / build.qa.incl.xml
1     <project name="common_qa">
2         <!--  Unitary testing + code coverage -->
3         
4         <property name="base.dir" location="../../"/>
5         
6         <!-- JAR names -->
7         <property file="${base.dir}/scilab-lib.properties"/>
8         <property file="${base.dir}/scilab-lib-doc.properties"/>
9         <!-- Configure ANT flags -->
10         <property file="${base.dir}/scilab.properties"/>
11         
12         <!-- Where we can find the test sources -->
13         <property name="test.dir" location="tests/"/>
14         <property name="src.test.dir" location="${test.dir}/java/"/>
15         <property name="report.test.dir" location="${base.dir}/reports/"/>
16         <property name="report.xml.test.dir" location="${report.test.dir}/xml/"/>
17         <property name="report.html.test.dir" location="${report.test.dir}/html/"/>
18         <property name="report.codecoverage.dir" location="${report.test.dir}/codecoverage/"/>
19         <property name="report.codecoverage.html.dir" location="${report.test.dir}/html-codecoverage/"/>
20         <property name="report.codecoverage.xml.dir" location="${report.test.dir}/xml-codecoverage/"/>
21         
22         <!-- Check style definitions -->
23         <property name="checkstyle.config.file" value="${base.dir}/checkstyle/scilab_checkstyle_convention.xml"/>
24         <property name="checkstyle.stylesheet" value="${thirdparty.dir}/checkstyle/contrib/checkstyle-noframes-sorted.xsl"/>
25         <property name="checkstyle.report.dir" value="${build.dir}/checkstyle"/>
26         <property name="checkstyle.xml.report.file" value="${checkstyle.report.dir}/checkstyle_errors.xml"/>
27         <property name="checkstyle.html.report.file" value="${checkstyle.report.dir}/checkstyle_errors.htm"/>
28         
29         <path id="unittest.classpath">
30             <pathelement location="${junit4.jar}"/>
31         </path>
32         <path id="cobertura_classpath">
33             <pathelement location="${cobertura.jar}"/>
34         </path>
35         
36         <!-- Clean test -->
37         <target name="clean-test" description="Clean test files">
38             <delete dir="${build.test.dir}"/>
39         </target>
40         
41         <target name="existing-tests">
42             <available property="test-present" file="${src.test.dir}"/>
43         </target>
44         
45         <!-- Compile test sources -->
46         <target name="compile-test" description="Build tests" depends="existing-tests, clean-test, jar" if="test-present">
47             <!-- clean the test to make sure it will build properly -->
48             <javac srcdir="${src.test.dir}" destdir="${classes.test.dir}" deprecation="on" debug="${build.debug}" verbose="off" listfiles="on" includeAntRuntime="no" source="6" target="6" encoding="UTF-8">
49                 <classpath>
50                     <path refid="unittest.classpath"/>
51                     <path refid="compile.classpath"/>
52                 </classpath>
53             </javac>
54         </target>
55         
56         <taskdef resource="checkstyletask.properties" classpathref="checkstyle.classpath"/>
57         <!-- Checkstyle process -->
58         <target name="checkstyle" depends="checkstyle-init" description="Generates a report of code convention violations.">
59             <checkstyle config="${checkstyle.config.file}" failOnViolation="false">
60                 <fileset dir="${src.dir}" includes="**/*.java"/>
61                 <!-- Location of cache-file. -->
62                 <property key="checkstyle.cache.file" file="${cache.dir}"/>
63                 <formatter type="plain"/>
64                 <formatter type="xml" toFile="${checkstyle.xml.report.file}"/>
65             </checkstyle>
66             <xslt in="${checkstyle.xml.report.file}" out="${checkstyle.html.report.file}" style="${checkstyle.stylesheet}"/>
67         </target>
68         <!-- Create the build directory -->
69         <target name="checkstyle-init">
70             <mkdir dir="${checkstyle.report.dir}"/>
71         </target>
72         <!-- Delete the build directory -->
73         <target name="checkstyle-clean">
74             <delete dir="${checkstyle.report.dir}"/>
75         </target>
76         
77         
78         <!-- Allows the override of the forkMode by local build.xml -->
79         <condition property="forkModeAlreadySet">
80             <isset property="junit.forkMode" />
81         </condition>
82         
83         <target name="validate">
84             <!-- Empty target to be override by other build.xml -->
85         </target>
86         
87         <taskdef classpathref="cobertura_classpath" resource="tasks.properties" />
88         
89         <target name="instrument">
90             <cobertura-instrument todir="${instrumented.classes.test.dir}" datafile="${report.test.dir}/${library.name}.ser">
91                 <fileset dir="${classes.dir}">
92                     <include name="**/*.class" />
93                 </fileset>
94             </cobertura-instrument>
95         </target>
96         
97         <target name="codecoverage" depends="compile-test, instrument, test">
98             <cobertura-merge>
99                 <fileset dir="${report.test.dir}">
100                     <include name="*.ser" />
101                 </fileset>
102             </cobertura-merge>
103             
104             <cobertura-report format="html" destdir="${report.codecoverage.html.dir}"> 
105                 
106                 <fileset dir="${library.action_binding.src.dir}">
107                     <include name="**/*.java" />
108                 </fileset>
109                 <fileset dir="${library.commons.src.dir}">
110                     <include name="**/*.java" />
111                 </fileset>
112                 <fileset dir="${library.graph.src.dir}">
113                     <include name="**/*.java" />
114                 </fileset>
115                 <fileset dir="${library.graphic_objects.src.dir}">
116                     <include name="**/*.java" />
117                 </fileset>
118                 <fileset dir="${library.xcos.src.dir}">
119                     <include name="**/*.java" />
120                 </fileset>
121                 <fileset dir="${library.types.src.dir}">
122                     <include name="**/*.java" />
123                 </fileset>
124                 <fileset dir="${library.javasci.src.dir}">
125                     <include name="**/*.java" />
126                 </fileset>
127             </cobertura-report>
128             
129             <cobertura-report format="xml" destdir="${report.codecoverage.xml.dir}"> 
130                 
131                 <fileset dir="${library.action_binding.src.dir}">
132                     <include name="**/*.java" />
133                 </fileset>
134                 <fileset dir="${library.commons.src.dir}">
135                     <include name="**/*.java" />
136                 </fileset>
137                 <fileset dir="${library.graph.src.dir}">
138                     <include name="**/*.java" />
139                 </fileset>
140                 <fileset dir="${library.graphic_objects.src.dir}">
141                     <include name="**/*.java" />
142                 </fileset>
143                 <fileset dir="${library.xcos.src.dir}">
144                     <include name="**/*.java" />
145                 </fileset>
146                 <fileset dir="${library.types.src.dir}">
147                     <include name="**/*.java" />
148                 </fileset>
149                 <fileset dir="${library.javasci.src.dir}">
150                     <include name="**/*.java" />
151                 </fileset>
152             </cobertura-report>
153             
154         </target>
155         
156         
157         <target name="detectForkMode" unless="forkModeAlreadySet">
158             <property name="junit.forkMode" value="perBatch"/>
159         </target>
160         
161         <target name="test" depends="existing-tests, compile-test, validate, detectForkMode" if="test-present">
162             <mkdir dir="${report.xml.test.dir}" />
163             <mkdir dir="${report.html.test.dir}" />
164             <mkdir dir="${report.codecoverage.dir}/" />
165             <junit fork="yes" forkmode="${junit.forkMode}" failureproperty="junit.failure">
166                 <sysproperty key="net.sourceforge.cobertura.datafile"
167                  file="${report.test.dir}/${library.name}.ser" />
168                 
169                 
170                 <classpath location="${instrumented.classes.test.dir}"/>
171                 <classpath location="${classes.test.dir}"/>
172                 
173                 <classpath>
174                     <path refid="unittest.classpath"/>
175                     <path refid="compile.classpath"/>
176                     <pathelement location="${cobertura.jar}"/>
177                     <pathelement location="${classes.test.dir}"/>
178                     <pathelement location="${classes.dir}"/>
179                 </classpath>
180                 
181                 
182                 <!-- Where ${basedir} is the module base directory -->
183                 <env key="SCI" value="${basedir}/../.."/>
184                 <jvmarg value="-DtestngTests=1"/>
185                 <jvmarg value="-Djava.library.path=${base.dir}/modules/.libs/:${base.dir}/modules/javasci/.libs/:${base.dir}/modules/types/.libs/:${base.dir}/modules/localization/.libs/:${base.dir}/modules/commons/.libs/:${base.dir}/modules/action_binding/.libs/:${base.dir}/thirdparty/:${base.dir}/bin/:/usr/lib/jni/:/usr/lib64/jni:/usr/lib/java/:/usr/lib64/java:"/>
186                 
187                 <formatter type="brief" useFile="no" />
188                 <formatter type="xml" />
189                 
190                 <batchtest fork="yes" todir="${report.xml.test.dir}" >
191                     <fileset dir="tests/java/">
192                         <include name="**/*.java"/>
193                     </fileset>
194                 </batchtest>
195             </junit>
196             
197             <junitreport todir="${report.xml.test.dir}">
198                 <fileset dir="${report.xml.test.dir}">
199                     <include name="*.xml"/>
200                 </fileset>
201                 <report format="frames" todir="${report.html.test.dir}"/>
202             </junitreport>
203             
204             <fail if="junit.failure" message="Unit test(s) failed. See the report"/>
205         </target>
206     </project>