Migrate Vex Build to Maven/Tycho - Add FindBugs, Duplicate Code, and PMD
diff --git a/sourceediting/development/org.eclipse.wst.xml.vex.releng/buildUtils.xml b/sourceediting/development/org.eclipse.wst.xml.vex.releng/buildUtils.xml
new file mode 100644
index 0000000..d9a12ea
--- /dev/null
+++ b/sourceediting/development/org.eclipse.wst.xml.vex.releng/buildUtils.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ /*******************************************************************************
+ * Copyright (c) 2010 Intalio Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     David Carver (Intalio) - initial API and implementation
+ *******************************************************************************/
+-->
+<project name="Build Utilities">
+
+	<property name="downloadDir" location="${basedir}/downloads" />
+	<property name="libs" location="${basedir}/lib" />
+	<available file="${downloadDir}/findbugs.zip" property="findBugsAvailable" />
+	<available file="${downloadDir}/pmd.zip" property="pmdAvailable" />
+
+	<target name="init">
+		<mkdir dir="${downloadDir}" />
+	</target>
+
+	<target name="findbugs.init" depends="init" unless="findBugsAvailable">
+		<get src="http://downloads.sourceforge.net/project/findbugs/findbugs/1.3.9/findbugs-1.3.9.zip" dest="${downloadDir}/findbugs.zip" />
+		<unzip src="${downloadDir}/findbugs.zip" dest="${libs}" />
+	</target>
+
+	<target name="findbugs" depends="findbugs.init" description="Run FindBugs against eclipse jars.">
+		<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
+			<classpath>
+				<path>
+					<fileset dir="${libs}/findbugs-1.3.9/lib" includes="*.jar" />
+				</path>
+			</classpath>
+		</taskdef>
+
+		<mkdir dir="findbugs" />
+		<copy todir="findbugs">
+			<fileset dir="../../plugins">
+				<include name="**/org.eclipse.*/**/*-SNAPSHOT.jar" />
+			</fileset>
+		</copy>
+
+		<findbugs home="${libs}/findbugs-1.3.9/lib" output="xml" outputFile="${basedir}/fb.xml">
+			<class location="findbugs" />
+		</findbugs>
+
+		<delete dir="findbugs" failonerror="false" />
+
+	</target>
+
+	<target name="pmd.init" depends="init" unless="pmdAvailable">
+		<get src="http://downloads.sourceforge.net/project/pmd/pmd/4.2.5/pmd-bin-4.2.5.zip" dest="${downloadDir}/pmd.zip" usetimestamp="true" />
+		<unzip src="${downloadDir}/pmd.zip" dest="${libs}" />
+	</target>
+
+	<target name="dry" depends="pmd.init" description="Run Duplicate Code Detector against eclipse source code">
+		<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask">
+			<classpath>
+				<path>
+					<fileset dir="${libs}/pmd-4.2.5/lib" includes="*.jar" />
+				</path>
+			</classpath>
+		</taskdef>
+		<cpd minimumTokenCount="100" format="xml" outputFile="dry-report.xml">
+			<fileset dir="../../plugins">
+				<include name="**/org.eclipse.*/**/*.java" />
+				<exclude name="**/StringLexer.java"/>
+				<exclude name="**/XMLLexer.java"/>
+				<exclude name="**/XQueryLexer.java"/>
+				<exclude name="**/XQueryParser.java"/>
+			</fileset>
+		</cpd>
+	</target>
+
+	<target name="pmd" depends="pmd.init" description="Run PMD Static Code Analysis against eclipse source code">
+		<path id="pmd.path">
+			<fileset dir="${libs}/pmd-4.2.5/lib">
+				<include name="*.jar" />
+			</fileset>
+		</path>
+		<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.path"/>
+		<pmd failonerror="true" encoding="utf-8" shortFilenames="true">
+			<ruleset>basic</ruleset>
+			<ruleset>braces</ruleset>
+		    <ruleset>clone</ruleset>
+		    <ruleset>finalizers</ruleset>
+		    <ruleset>imports</ruleset>
+			<ruleset>strings</ruleset>
+			<ruleset>codesize</ruleset>
+			<ruleset>unusedcode</ruleset>
+			<formatter type="xml" toFile="pmd-report.xml" />
+			<fileset dir="../../plugins">
+				<include name="**/*.java" />
+				<exclude name="**/StringLexer.java"/>
+				<exclude name="**/XMLLexer.java"/>
+				<exclude name="**/XQueryLexer.java"/>
+				<exclude name="**/XQueryParser.java"/>
+			</fileset>
+		</pmd>
+	</target>
+
+</project>