changeset 15:d2901f1c52c3

Add common task for initialiaing groovy ant task.
author smith@nwoca.org
date Tue, 28 Dec 2010 14:48:36 -0500
parents 3cb1ff0297a8
children 5084ebcc8128
files ssdt-common-build.xml
diffstat 1 files changed, 41 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/ssdt-common-build.xml	Sun Dec 26 16:18:59 2010 -0500
+++ b/ssdt-common-build.xml	Tue Dec 28 14:48:36 2010 -0500
@@ -1,12 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="ssdt-common-build" default="all" basedir="." xmlns:tomcat="http://ssdt-ohio.org/ant/tomcat">
-<!--
+<project name="ssdt-common-build" default="all" basedir="." 
+         xmlns:tomcat="http://ssdt-ohio.org/ant/tomcat"
+         xmlns:ssdt="http://www.ssdt-ohio.org/ant/common">
+    <!--
     ssdt common build functions.  Contains generalized tasks to perform
     common functions. Assumes some standard properties from a NetBeans
     project are provided.
-    
+
     Properties used for webapps:
-    
+
         build.web.dir   - docBase of build webapp.
         web.docbase.dir - source docBase of webapp
         web.context.path    - path to install webapp in Tomcat
@@ -15,12 +17,26 @@
 
 -->
     <target    name="project.cvs.update"
-                depends="project.init" 
-                unless="build.devel.bamboo">
-       <!-- Get the latest from CVS -->
+               depends="project.init"
+               unless="build.devel.bamboo">
+        <!-- Get the latest from CVS -->
         <cvs command="up -d -P"/>
     </target>
-     
+
+    <target name="-project.init.groovy.task" depends="init">
+        <if>
+            <available classpath="${run.test.classpath}" classname="org.codehaus.groovy.ant.Groovy"/>
+            <then>
+                <taskdef 		name="groovy" classname="org.codehaus.groovy.ant.Groovy"  classpath="${run.test.classpath}"/>
+            </then>
+            <else>
+                <property		name="ssdt.groovy.jar.src" 					value="http://ivy.ssdt.nwoca.org/repository/groovy/groovy-all.jar"/>
+                <ssdt:fetch 	dest="${ssdt.devel.kit}/groovy-all.jar" 		src="${ssdt.groovy.jar.src}"/>
+                <taskdef 		name="groovy" classname="org.codehaus.groovy.ant.Groovy"  classpath="${ssdt.devel.kit}/groovy-all.jar"/>
+            </else>
+        </if>
+    </target>
+
     <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"/>
@@ -29,7 +45,7 @@
         <property name="project.version.file" value="${build.classes.dir}/version.properties"/>
     </target>
 
-   <target name="project.version" depends="project.init" >
+    <target name="project.version" depends="project.init" >
         <propertyfile  file="${project.version.file}" comment="Version build information">
             <entry key="projectName" value="${project.name}"/>
             <entry key="projectVersion" value="${project.version}"/>
@@ -48,18 +64,18 @@
             </and>
         </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"/>
-          
+
         <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">
         <dirname property="docBase.dir.name" file="${build.web.dir}/WEB-INF"/>
 
@@ -72,9 +88,9 @@
                 <tokenfilter>
                     <filetokenizer/>
                     <replaceregex
-                pattern="&lt;Context.*&gt;" 
-                replace="&lt;Context path=&quot;${web.context.path}&quot; docBase=&quot;@DOCBASE&quot; &gt;"
-                />
+                        pattern="&lt;Context.*&gt;"
+                        replace="&lt;Context path=&quot;${web.context.path}&quot; docBase=&quot;@DOCBASE&quot; &gt;"
+                        />
                 </tokenfilter>
             </filterchain>
         </copy>
@@ -82,24 +98,24 @@
                  token="@DOCBASE"
                  value="${docBase.dir.name}"/>
     </target>
-     
+
     <target name="project.undeploy" depends="-project.init-tomcat">
         <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
         <tomcat:undeploy  password="${tomcat.password}"
-            url="${tomcat.manager.url}" username="${tomcat.username}"
-            path="${web.context.path}"
-            failonerror="false"           
-        /> 
+                          url="${tomcat.manager.url}" username="${tomcat.username}"
+                          path="${web.context.path}"
+                          failonerror="false"
+                          />
     </target>
 
     <target name="project.deploy" depends="project.undeploy,project.web.context">
         <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
         <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"
-        /> 
+                        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>
-        
+
 </project>