blob: d9a12ea745dbab099acc5f49ddd0e48ddade0a7a [file] [log] [blame]
dacarver789464c2010-06-08 15:48:27 +00001<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 /*******************************************************************************
4 * Copyright (c) 2010 Intalio Inc. and others.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors:
11 * David Carver (Intalio) - initial API and implementation
12 *******************************************************************************/
13-->
14<project name="Build Utilities">
15
16 <property name="downloadDir" location="${basedir}/downloads" />
17 <property name="libs" location="${basedir}/lib" />
18 <available file="${downloadDir}/findbugs.zip" property="findBugsAvailable" />
19 <available file="${downloadDir}/pmd.zip" property="pmdAvailable" />
20
21 <target name="init">
22 <mkdir dir="${downloadDir}" />
23 </target>
24
25 <target name="findbugs.init" depends="init" unless="findBugsAvailable">
26 <get src="http://downloads.sourceforge.net/project/findbugs/findbugs/1.3.9/findbugs-1.3.9.zip" dest="${downloadDir}/findbugs.zip" />
27 <unzip src="${downloadDir}/findbugs.zip" dest="${libs}" />
28 </target>
29
30 <target name="findbugs" depends="findbugs.init" description="Run FindBugs against eclipse jars.">
31 <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
32 <classpath>
33 <path>
34 <fileset dir="${libs}/findbugs-1.3.9/lib" includes="*.jar" />
35 </path>
36 </classpath>
37 </taskdef>
38
39 <mkdir dir="findbugs" />
40 <copy todir="findbugs">
41 <fileset dir="../../plugins">
42 <include name="**/org.eclipse.*/**/*-SNAPSHOT.jar" />
43 </fileset>
44 </copy>
45
46 <findbugs home="${libs}/findbugs-1.3.9/lib" output="xml" outputFile="${basedir}/fb.xml">
47 <class location="findbugs" />
48 </findbugs>
49
50 <delete dir="findbugs" failonerror="false" />
51
52 </target>
53
54 <target name="pmd.init" depends="init" unless="pmdAvailable">
55 <get src="http://downloads.sourceforge.net/project/pmd/pmd/4.2.5/pmd-bin-4.2.5.zip" dest="${downloadDir}/pmd.zip" usetimestamp="true" />
56 <unzip src="${downloadDir}/pmd.zip" dest="${libs}" />
57 </target>
58
59 <target name="dry" depends="pmd.init" description="Run Duplicate Code Detector against eclipse source code">
60 <taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask">
61 <classpath>
62 <path>
63 <fileset dir="${libs}/pmd-4.2.5/lib" includes="*.jar" />
64 </path>
65 </classpath>
66 </taskdef>
67 <cpd minimumTokenCount="100" format="xml" outputFile="dry-report.xml">
68 <fileset dir="../../plugins">
69 <include name="**/org.eclipse.*/**/*.java" />
70 <exclude name="**/StringLexer.java"/>
71 <exclude name="**/XMLLexer.java"/>
72 <exclude name="**/XQueryLexer.java"/>
73 <exclude name="**/XQueryParser.java"/>
74 </fileset>
75 </cpd>
76 </target>
77
78 <target name="pmd" depends="pmd.init" description="Run PMD Static Code Analysis against eclipse source code">
79 <path id="pmd.path">
80 <fileset dir="${libs}/pmd-4.2.5/lib">
81 <include name="*.jar" />
82 </fileset>
83 </path>
84 <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.path"/>
85 <pmd failonerror="true" encoding="utf-8" shortFilenames="true">
86 <ruleset>basic</ruleset>
87 <ruleset>braces</ruleset>
88 <ruleset>clone</ruleset>
89 <ruleset>finalizers</ruleset>
90 <ruleset>imports</ruleset>
91 <ruleset>strings</ruleset>
92 <ruleset>codesize</ruleset>
93 <ruleset>unusedcode</ruleset>
94 <formatter type="xml" toFile="pmd-report.xml" />
95 <fileset dir="../../plugins">
96 <include name="**/*.java" />
97 <exclude name="**/StringLexer.java"/>
98 <exclude name="**/XMLLexer.java"/>
99 <exclude name="**/XQueryLexer.java"/>
100 <exclude name="**/XQueryParser.java"/>
101 </fileset>
102 </pmd>
103 </target>
104
105</project>