2002-10-28 22:36:20 +00:00
<project basedir= "." default= "nbm" name= "PMD netbeans module" >
2003-04-18 01:16:05 +00:00
2004-05-26 10:04:37 +00:00
<property name= "pmd.jar" value= "pmd-1.8.jar" />
<property file= "build.ant.properties" />
2003-08-12 23:23:42 +00:00
<property name= "keystore" value= "${user.home}/.pmdkeystore" />
2003-06-15 11:39:36 +00:00
<property name= "storepass" value= "?" />
2003-04-18 01:16:05 +00:00
2004-05-27 01:06:50 +00:00
<target name= "init" >
<fail unless= "nb.home" message= "To resolve library dependencies, you must indicate a NetBeans home directory. Use ant -Dnb.home=XXX or define it in build.ant.properties" />
<condition property= "nb.home.exists" >
<and >
<available file= "${nb.home}/lib/openide.jar" />
<available file= "${nb.home}/lib/openide-loaders.jar" />
<available file= "${nb.home}/modules/autoload/openide-io.jar" />
<available file= "${nb.home}/modules/autoload/java-api.jar" />
<available file= "${nb.home}/modules/autoload/java-src-model.jar" />
</and>
</condition>
<fail unless= "nb.home.exists" message= "The directory ${nb.home} does not exist or does not seem to be a NetBeans 3.6 installation" />
<property name= "pmdmodule.jar" value= "pmd.jar" />
<path id= "nb.cp" >
<pathelement location= "${nb.home}/lib/openide.jar" />
<pathelement location= "${nb.home}/lib/openide-loaders.jar" />
<pathelement location= "${nb.home}/modules/autoload/openide-io.jar" />
<pathelement location= "${nb.home}/modules/autoload/java-api.jar" />
<pathelement location= "${nb.home}/modules/autoload/java-src-model.jar" />
</path>
<patternset id= "pmd.files" >
<include name= "modules/${pmdmodule.jar}" />
<include name= "modules/ext/${pmd.jar}" />
<include name= "modules/ext/saxpath-1.0-fcs.jar" />
<include name= "modules/ext/jakarta-oro-2.0.jar" />
<include name= "modules/ext/jaxen-core-1.0-fcs.jar" />
</patternset>
</target>
<target name= "init-deploy" depends= "init" >
<property name= "nb36.user.dir" location= "${user.home}/.netbeans/3.6" />
<condition property= "netbeans.deploy.dir" value= "${nb36.user.dir}" >
<and >
<available file= "${nb36.user.dir}" />
<not >
<isset property= "netbeans.deploy.dir" />
</not>
</and>
</condition>
</target>
<target name= "compile" depends= "init" description= "Compiles all java files and copies property files to the classes dir" >
2002-11-03 14:22:41 +00:00
<mkdir dir= "build/classes" />
2004-05-27 01:06:50 +00:00
<javac debug= "on" debuglevel= "source,lines,vars" deprecation= "true" destdir= "build/classes" srcdir= "src" >
2002-11-03 14:22:41 +00:00
<include name= "**/*.java" />
<classpath >
2004-05-27 01:06:50 +00:00
<path refid= "nb.cp" />
2003-04-18 01:16:05 +00:00
<pathelement path= "lib/${pmd.jar}" />
2003-03-31 21:57:17 +00:00
<pathelement path= "lib/jakarta-oro-2.0.jar" />
2002-11-03 14:22:41 +00:00
</classpath>
</javac>
<copy todir= "build/classes" >
<fileset dir= "src" >
<include name= "**/*" />
<exclude name= "**/*.java" />
<exclude name= "**/.nbattrs" />
<exclude name= "manifest.mf" />
</fileset>
</copy>
</target>
2003-04-18 01:16:05 +00:00
2002-11-03 14:22:41 +00:00
<target depends= "compile" description= "Creates the jar" name= "jars" >
2003-04-18 01:16:05 +00:00
<mkdir dir= "work" />
<copy file= "src/manifest.mf" tofile= "work/manifest-filtered.mf" >
<filterset >
<filter token= "pmd.jar" value= "${pmd.jar}" />
</filterset>
</copy>
2004-05-27 01:06:50 +00:00
<jar compress= "false" jarfile= "build/${pmdmodule.jar}" manifest= "work/manifest-filtered.mf" >
2002-11-03 14:22:41 +00:00
<fileset dir= "build/classes" >
<include name= "**/*" />
</fileset>
2003-02-15 19:06:50 +00:00
</jar>
2003-04-18 01:16:05 +00:00
<delete dir= "work" />
2003-02-15 19:06:50 +00:00
</target>
2004-05-27 01:06:50 +00:00
<target name= "deploy" depends= "init-deploy,jars" >
<!--
If no deployment dir, then we fail rather than deploy globally; if you
do want to deploy globally, then set netbeans.deploy.dir explicitly.
-->
<fail unless= "netbeans.deploy.dir" message= "No NetBeans user directory to deploy into; either specify it in the property nb36.user.dir, or specify another NetBeans deployment directory (e.g. the install dir ${nb.home}) in the property netbeans.deploy.dir" />
<mkdir dir= "${netbeans.deploy.dir}/modules/ext" />
<copy todir= "${netbeans.deploy.dir}/modules/ext" taskname= "Deploy libraries" >
<fileset dir= "lib" >
<include name= "${pmd.jar}" />
<include name= "saxpath-1.0-fcs.jar" />
<include name= "jakarta-oro-2.0.jar" />
<include name= "jaxen-core-1.0-fcs.jar" />
</fileset>
</copy>
<copy file= "build/${pmdmodule.jar}" todir= "${netbeans.deploy.dir}/modules" taskname= "Deploy PMD module jar" />
</target>
<target name= "nbm" depends= "jars" description= "Prepare the module for distribution via Auto Update." >
2004-05-26 10:04:37 +00:00
<taskdef classname= "org.netbeans.nbbuild.MakeNBM" classpath= "lib/nbantext-3.6.jar" name= "makenbm" />
2004-05-27 01:06:50 +00:00
<property name= "tempdist.dir" location= "build/temp_distribution" />
<antcall target= "deploy" >
<param name= "netbeans.deploy.dir" value= "${tempdist.dir}/netbeans" />
</antcall>
2004-05-26 10:04:37 +00:00
<makenbm file= "build/pmd.nbm" homepage= "http://pmd.sourceforge.net/"
2004-05-27 01:06:50 +00:00
module="build/${pmdmodule.jar}" topdir="${tempdist.dir}"
2004-05-28 09:13:23 +00:00
needsrestart="true" distribution="http://www.netbeans.org/example/pmd.nbm">
2003-02-15 19:06:50 +00:00
<license file= "LICENSE.txt" />
2003-06-15 11:39:36 +00:00
<signature keystore= "${keystore}" storepass= "${storepass}" alias= "pmdkey" />
2003-02-15 19:06:50 +00:00
</makenbm>
</target>
2004-05-27 01:06:50 +00:00
2003-02-15 19:06:50 +00:00
<target depends= "clean, nbm" description= "Builds the distribution" name= "distribution" >
2004-05-27 01:06:50 +00:00
<fail unless= "VERSION" message= "Must define VERSION property with the version number for this distribution!" />
<zip compress= "true" destfile= "build/pmd-netbeans36-src-${VERSION}.zip" >
2003-02-15 19:06:50 +00:00
<zipfileset dir= "." >
<include name= "*.txt" />
<include name= "build.xml" />
<include name= "src/**/*" />
2003-08-12 23:23:42 +00:00
<include name= "lib/${pmd.jar}" />
2003-02-15 19:06:50 +00:00
<include name= "lib/nbantext.jar" />
2003-03-24 22:28:38 +00:00
<include name= "lib/saxpath-1.0-fcs.jar" />
<include name= "lib/jaxen-core-1.0-fcs.jar" />
2003-03-31 21:57:17 +00:00
<include name= "lib/jakarta-oro-2.0.jar" />
2003-02-15 19:06:50 +00:00
<exclude name= "**/.nbattrs" />
</zipfileset>
2003-04-11 01:16:12 +00:00
<zipfileset dir= "." fullpath= "pmd.nbm" includes= "build/pmd.nbm" />
2003-02-15 19:06:50 +00:00
</zip>
2004-05-27 01:06:50 +00:00
<zip compress= "true" destfile= "build/pmd-netbeans36-bin-${VERSION}.zip" >
2003-02-15 19:06:50 +00:00
<zipfileset dir= "." >
<include name= "*.txt" />
</zipfileset>
2003-04-11 01:16:12 +00:00
<zipfileset dir= "." fullpath= "pmd.nbm" includes= "build/pmd.nbm" />
2003-02-15 19:06:50 +00:00
</zip>
2002-11-03 14:22:41 +00:00
</target>
2004-05-27 01:06:50 +00:00
<target name= "clean-deploy" depends= "init-deploy" if= "netbeans.deploy.dir" >
<delete >
<fileset dir= "${netbeans.deploy.dir}" >
<patternset refid= "pmd.files" />
</fileset>
</delete>
</target>
<target description= "Clean all build products." name= "clean" depends= "clean-deploy" >
2002-11-03 14:22:41 +00:00
<delete dir= "build" />
</target>
2004-05-27 01:06:50 +00:00
2002-10-28 22:36:20 +00:00
</project>