diff ssdt-common-build.xml @ 5:9c847b8c7e9c

TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
author smith@nwoca.org
date Fri, 17 Dec 2010 18:23:14 -0500
parents be1051bf262f
children d2901f1c52c3
line wrap: on
line diff
--- a/ssdt-common-build.xml	Fri Dec 17 16:55:03 2010 -0500
+++ b/ssdt-common-build.xml	Fri Dec 17 18:23:14 2010 -0500
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="ssdt-common-build" default="all" basedir=".">
+<project name="ssdt-common-build" default="all" basedir="." xmlns:tomcat="http://ssdt-ohio.org/ant/tomcat">
 <!--
     ssdt common build functions.  Contains generalized tasks to perform
     common functions. Assumes some standard properties from a NetBeans
@@ -14,118 +14,53 @@
         tomcat.password     - Tomcat manager password
 
 -->
-<!--
-    <taskdef name="groovy"
-            classname="org.codehaus.groovy.ant.Groovy"
-            classpath="${tools.dir}/groovy-1.0/embeddable/groovy-all-1.0.jar"/>
-
-    <taskdef name="groovyc"
-            classname="org.codehaus.groovy.ant.Groovyc"
-            classpath="${tools.dir}/groovy-1.0/embeddable/groovy-all-1.0.jar"/>
-
--->
-     <target name="project.cvs.update"  
+    <target    name="project.cvs.update"
                 depends="project.init" 
                 unless="build.devel.bamboo">
        <!-- Get the latest from CVS -->
         <cvs command="up -d -P"/>
-     </target>
+    </target>
      
-     <target name="project.cc.init" depends="project.init" description="Deprecated use project.ini">
-         <echo level="warning" message="project.cc.init is deprecated. Use project.init"/>
-     </target>
-
-     <target name="project.init" depends="init,-project.cvs.version.init">
-         <property name="project.version" value="${ivy.revision}"/>
-         <property name="project.name" value="${ivy.module}"/>
-         <delete failonerror="false" quiet="true" dir="${build.dir}/checkstyle"/>
-         <delete failonerror="false" quiet="true" dir="${build.dir}/tests" />
-         <delete failonerror="false" quiet="true" dir="${build.dir}/findbugs" />
-         <property name="ssdt.tools.jar" value="${tools.dir}/dist/ssdt-tools.jar"/>
+    <target name="project.init" depends="init">
+        <property file="build-number.txt" description="Bamboo build number"/>
+        <property name="build.number" value="-1" description="Unknown build number"/>
+        <property name="project.version" value="${ivy.revision}"/>
+        <property name="project.name" value="${ivy.module}"/>
+        <property name="project.version.file" value="${build.classes.dir}/version.properties"/>
     </target>
 
-    <target name="-project.cvs.getbranch">
-        <property name="project.version.file" value="${src.dir}/version.properties"/>
-        <mkdir dir="${build.dir}"/>
-        <cvs command="status build.xml" output="${build.dir}/cvs-branch.txt"/> 
-        <loadfile srcfile="${build.dir}/cvs-branch.txt" property="project.cvs.branch">
-             <filterchain>
-                <tabstospaces tablength="1"/>
-                <linecontains>
-                  <contains value="Sticky Tag:"/>
-                </linecontains>
-                <replacestring from="Sticky Tag:" to=""/>
-                <replaceregex pattern="\(.*\)" replace=""/>
-                <replacestring from=" " to=""/>
-                <striplinebreaks/>
-            </filterchain>            
-        </loadfile>
-        <condition property="project.cvs.reset.version.branch"
-            value="-r ${project.cvs.branch}"
-            else="">
-                <isset property="project.cvs.branch"/>        
-        </condition>
-        
-    </target>
-
-    <target name="-project.cvs.version.reset">
-            <echo message="Resetting version file ${project.cvs.reset.version.branch}" level="info"/>
-            <cvs command="update -A -C ${project.cvs.reset.version.branch} ${project.version.file}"/>
-    </target>
-    
-    <target name="project.cvs.version" 
-        depends="project.init,-project.cvs.version.init"
-        if="build.devel">
-            <echo message="comitting project version file" level="info"/>
-            <cvs command="commit -n -mversion-update ${project.version.file}"/> 
-    </target>
-    
-    <target name="-project.cvs.version.init" 
-        depends="-project.cvs.getbranch,-project.cvs.version.reset">        
-    </target>
-
-
    <target name="project.version" depends="project.init" >
-        <propertyfile  
-            file="${project.version.file}" comment="Version build information">
+        <propertyfile  file="${project.version.file}" comment="Version build information">
             <entry key="projectName" value="${project.name}"/>
             <entry key="projectVersion" value="${project.version}"/>
             <entry key="buildDate" type="date" value="now"/>
-            <entry key="buildNumber" default="0" type="int" operation="+" value="1"/>
+            <entry key="buildNumber" value="${build.number}"/>
             <entry key="built.by" value="${ant.version}"/>
             <entry key="build.java.version" value="${ant.java.version}"/>
             <entry key="built.on" value="${os.name} ${os.arch} ${os.version} (${user.name})"/>
         </propertyfile>
-        <property file="${project.version.file}" prefix="version"/>
-        <copy failonerror="false" 
-            file="${project.version.file}" 
-            todir="${build.classes.dir}"/>
     </target>
-    
-     <target name="-project.pre-init" depends="init">         
+
+    <target name="-project.pre-init" depends="init">
         <condition property="tomcat.available">
             <and>
-                <available file="${tools.dir}/etc/tomcat_anttask.properties"/>
                 <available file="${tomcat.home}" type="dir"/>
             </and>
-        </condition>    
-     </target>
+        </condition>
+    </target>
      
     <target name="-project.init-tomcat" depends="-project.pre-init" if="tomcat.available">
         <property name="tomcat.url" value="http://localhost:8084"/>
         <property name="tomcat.manager.url" value="${tomcat.url}/manager"/>
-        <property name="ssdt.tools.jar" value="${tools.dir}/dist/ssdt-tools.jar"/>
           
-        <path id="project.tools.classpath">
-            <pathelement location="${ssdt.tools.jar}" />
-            <fileset dir="${tomcat.home}" includes="**/lib/catalina-ant.jar"/>
-        </path>        
-        
-        <taskdef resource="ssdttomcattasks.properties" classpathref="project.tools.classpath"/>
-        <taskdef file="${tools.dir}/etc/tomcat_anttask.properties" classpathref="project.tools.classpath"/>
-   </target>   
+        <taskdef resource="org/apache/catalina/ant/antlib.xml" uri="http://ssdt-ohio.org/ant/tomcat">
+            <classpath>
+                <fileset dir="${tomcat.home}" includes="**/lib/catalina-ant.jar"/>
+            </classpath>
+        </taskdef>
+    </target>
      
-     <target name="project.web.context" depends="-project.init-tomcat,init">
+    <target name="project.web.context" depends="-project.init-tomcat,init">
         <dirname property="docBase.dir.name" file="${build.web.dir}/WEB-INF"/>
 
         <property name="project.context.file"  value="${web.docbase.dir}/META-INF/context.xml"/>
@@ -133,38 +68,38 @@
         <copy file="${project.context.file}"
               tofile="${build.web.dir}/META-INF/context-dev.xml"
               overwrite="true">
-          <filterchain>
-            <tokenfilter>
-            <filetokenizer/>            
-            <replaceregex 
+            <filterchain>
+                <tokenfilter>
+                    <filetokenizer/>
+                    <replaceregex
                 pattern="&lt;Context.*&gt;" 
                 replace="&lt;Context path=&quot;${web.context.path}&quot; docBase=&quot;@DOCBASE&quot; &gt;"
                 />
-            </tokenfilter>
-          </filterchain>
+                </tokenfilter>
+            </filterchain>
         </copy>
-        <replace file="${build.web.dir}/META-INF/context-dev.xml" 
+        <replace file="${build.web.dir}/META-INF/context-dev.xml"
                  token="@DOCBASE"
                  value="${docBase.dir.name}"/>
-     </target>
+    </target>
      
-     <target name="project.undeploy" depends="-project.init-tomcat">
+    <target name="project.undeploy" depends="-project.init-tomcat">
         <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
-        <undeploy  password="${tomcat.password}" 
+        <tomcat:undeploy  password="${tomcat.password}"
             url="${tomcat.manager.url}" username="${tomcat.username}"
             path="${web.context.path}"
             failonerror="false"           
         /> 
-     </target>
+    </target>
 
-     <target name="project.deploy" depends="project.undeploy,project.web.context">
+    <target name="project.deploy" depends="project.undeploy,project.web.context">
         <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
-        <deploy  password="${tomcat.password}" 
+        <tomcat:deploy  password="${tomcat.password}"
             url="${tomcat.manager.url}" username="${tomcat.username}"
             path="${web.context.path}"
             config="${build.web.dir.path}/META-INF/context-dev.xml"
         /> 
         <delete file="${build.web.dir.path}/META-INF/context-dev.xml" failonerror="false"/>
-     </target>
+    </target>
         
 </project>