forked from roborescue/rcrs-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-checkstyle.xml
44 lines (38 loc) · 1.92 KB
/
build-checkstyle.xml
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
<project>
<property name="checkstyle.version" value="all-5.0-beta2"/>
<property name="checkstyle.output.dir" value="${build.dir}/checkstyle-results"/>
<!-- Checkstyle task definition -->
<taskdef resource="checkstyletask.properties" classpath="${buildtools.dir}/checkstyle-${checkstyle.version}.jar"/>
<target name="checkstyle" depends="_run-checkstyle, _checkstyle-warnings" description="Run Checkstyle on all modules"/>
<target name="_init-checkstyle">
<mkdir dir="${checkstyle.output.dir}"/>
</target>
<target name="_run-checkstyle" depends="compile, _init-checkstyle, _generate-checkstyle-fileset">
<checkstyle config="${buildtools.dir}/checkstyle.xml" classpathref="path.common" failOnViolation="false" failureProperty="checkstyle.failure">
<fileset refid="checkstyle.files"/>
<formatter type="xml" toFile="${checkstyle.output.dir}/checkstyle_errors.xml"/>
</checkstyle>
<xslt in="${checkstyle.output.dir}/checkstyle_errors.xml" out="${checkstyle.output.dir}/checkstyle_errors.html" style="${buildtools.dir}/checkstyle-noframes-sorted.xsl"/>
</target>
<target name="_checkstyle-warnings" if="checkstyle.failure">
<echo message="Checkstyle warnings found"/>
</target>
<target name="_generate-checkstyle-fileset">
<script language="javascript">
<![CDATA[
importClass(org.apache.tools.ant.types.Path);
importClass(org.apache.tools.ant.types.FileSet);
importClass(java.lang.System);
importClass(java.io.File);
var modules = project.getProperty("modules").split(",");
var fileset = new FileSet();
fileset.setDir(new File(project.getProperty("modules.dir")));
for (var i = 0; i < modules.length; ++i) {
fileset.setIncludes(modules[i] + "/src/**/*.java");
}
project.addReference("checkstyle.files", fileset);
project.setProjectReference(fileset);
]]>
</script>
</target>
</project>