comparison ssdt-common-build.xml @ 15:d2901f1c52c3

Add common task for initialiaing groovy ant task.
author smith@nwoca.org
date Tue, 28 Dec 2010 14:48:36 -0500
parents 9c847b8c7e9c
children ad0a75e20f7b
comparison
equal deleted inserted replaced
14:3cb1ff0297a8 15:d2901f1c52c3
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="ssdt-common-build" default="all" basedir="." xmlns:tomcat="http://ssdt-ohio.org/ant/tomcat"> 2 <project name="ssdt-common-build" default="all" basedir="."
3 <!-- 3 xmlns:tomcat="http://ssdt-ohio.org/ant/tomcat"
4 xmlns:ssdt="http://www.ssdt-ohio.org/ant/common">
5 <!--
4 ssdt common build functions. Contains generalized tasks to perform 6 ssdt common build functions. Contains generalized tasks to perform
5 common functions. Assumes some standard properties from a NetBeans 7 common functions. Assumes some standard properties from a NetBeans
6 project are provided. 8 project are provided.
7 9
8 Properties used for webapps: 10 Properties used for webapps:
9 11
10 build.web.dir - docBase of build webapp. 12 build.web.dir - docBase of build webapp.
11 web.docbase.dir - source docBase of webapp 13 web.docbase.dir - source docBase of webapp
12 web.context.path - path to install webapp in Tomcat 14 web.context.path - path to install webapp in Tomcat
13 tomcat.username - Tomcat manager username 15 tomcat.username - Tomcat manager username
14 tomcat.password - Tomcat manager password 16 tomcat.password - Tomcat manager password
15 17
16 --> 18 -->
17 <target name="project.cvs.update" 19 <target name="project.cvs.update"
18 depends="project.init" 20 depends="project.init"
19 unless="build.devel.bamboo"> 21 unless="build.devel.bamboo">
20 <!-- Get the latest from CVS --> 22 <!-- Get the latest from CVS -->
21 <cvs command="up -d -P"/> 23 <cvs command="up -d -P"/>
22 </target> 24 </target>
23 25
26 <target name="-project.init.groovy.task" depends="init">
27 <if>
28 <available classpath="${run.test.classpath}" classname="org.codehaus.groovy.ant.Groovy"/>
29 <then>
30 <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${run.test.classpath}"/>
31 </then>
32 <else>
33 <property name="ssdt.groovy.jar.src" value="http://ivy.ssdt.nwoca.org/repository/groovy/groovy-all.jar"/>
34 <ssdt:fetch dest="${ssdt.devel.kit}/groovy-all.jar" src="${ssdt.groovy.jar.src}"/>
35 <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${ssdt.devel.kit}/groovy-all.jar"/>
36 </else>
37 </if>
38 </target>
39
24 <target name="project.init" depends="init"> 40 <target name="project.init" depends="init">
25 <property file="build-number.txt" description="Bamboo build number"/> 41 <property file="build-number.txt" description="Bamboo build number"/>
26 <property name="build.number" value="-1" description="Unknown build number"/> 42 <property name="build.number" value="-1" description="Unknown build number"/>
27 <property name="project.version" value="${ivy.revision}"/> 43 <property name="project.version" value="${ivy.revision}"/>
28 <property name="project.name" value="${ivy.module}"/> 44 <property name="project.name" value="${ivy.module}"/>
29 <property name="project.version.file" value="${build.classes.dir}/version.properties"/> 45 <property name="project.version.file" value="${build.classes.dir}/version.properties"/>
30 </target> 46 </target>
31 47
32 <target name="project.version" depends="project.init" > 48 <target name="project.version" depends="project.init" >
33 <propertyfile file="${project.version.file}" comment="Version build information"> 49 <propertyfile file="${project.version.file}" comment="Version build information">
34 <entry key="projectName" value="${project.name}"/> 50 <entry key="projectName" value="${project.name}"/>
35 <entry key="projectVersion" value="${project.version}"/> 51 <entry key="projectVersion" value="${project.version}"/>
36 <entry key="buildDate" type="date" value="now"/> 52 <entry key="buildDate" type="date" value="now"/>
37 <entry key="buildNumber" value="${build.number}"/> 53 <entry key="buildNumber" value="${build.number}"/>
46 <and> 62 <and>
47 <available file="${tomcat.home}" type="dir"/> 63 <available file="${tomcat.home}" type="dir"/>
48 </and> 64 </and>
49 </condition> 65 </condition>
50 </target> 66 </target>
51 67
52 <target name="-project.init-tomcat" depends="-project.pre-init" if="tomcat.available"> 68 <target name="-project.init-tomcat" depends="-project.pre-init" if="tomcat.available">
53 <property name="tomcat.url" value="http://localhost:8084"/> 69 <property name="tomcat.url" value="http://localhost:8084"/>
54 <property name="tomcat.manager.url" value="${tomcat.url}/manager"/> 70 <property name="tomcat.manager.url" value="${tomcat.url}/manager"/>
55 71
56 <taskdef resource="org/apache/catalina/ant/antlib.xml" uri="http://ssdt-ohio.org/ant/tomcat"> 72 <taskdef resource="org/apache/catalina/ant/antlib.xml" uri="http://ssdt-ohio.org/ant/tomcat">
57 <classpath> 73 <classpath>
58 <fileset dir="${tomcat.home}" includes="**/lib/catalina-ant.jar"/> 74 <fileset dir="${tomcat.home}" includes="**/lib/catalina-ant.jar"/>
59 </classpath> 75 </classpath>
60 </taskdef> 76 </taskdef>
61 </target> 77 </target>
62 78
63 <target name="project.web.context" depends="-project.init-tomcat,init"> 79 <target name="project.web.context" depends="-project.init-tomcat,init">
64 <dirname property="docBase.dir.name" file="${build.web.dir}/WEB-INF"/> 80 <dirname property="docBase.dir.name" file="${build.web.dir}/WEB-INF"/>
65 81
66 <property name="project.context.file" value="${web.docbase.dir}/META-INF/context.xml"/> 82 <property name="project.context.file" value="${web.docbase.dir}/META-INF/context.xml"/>
67 83
70 overwrite="true"> 86 overwrite="true">
71 <filterchain> 87 <filterchain>
72 <tokenfilter> 88 <tokenfilter>
73 <filetokenizer/> 89 <filetokenizer/>
74 <replaceregex 90 <replaceregex
75 pattern="&lt;Context.*&gt;" 91 pattern="&lt;Context.*&gt;"
76 replace="&lt;Context path=&quot;${web.context.path}&quot; docBase=&quot;@DOCBASE&quot; &gt;" 92 replace="&lt;Context path=&quot;${web.context.path}&quot; docBase=&quot;@DOCBASE&quot; &gt;"
77 /> 93 />
78 </tokenfilter> 94 </tokenfilter>
79 </filterchain> 95 </filterchain>
80 </copy> 96 </copy>
81 <replace file="${build.web.dir}/META-INF/context-dev.xml" 97 <replace file="${build.web.dir}/META-INF/context-dev.xml"
82 token="@DOCBASE" 98 token="@DOCBASE"
83 value="${docBase.dir.name}"/> 99 value="${docBase.dir.name}"/>
84 </target> 100 </target>
85 101
86 <target name="project.undeploy" depends="-project.init-tomcat"> 102 <target name="project.undeploy" depends="-project.init-tomcat">
87 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/> 103 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
88 <tomcat:undeploy password="${tomcat.password}" 104 <tomcat:undeploy password="${tomcat.password}"
89 url="${tomcat.manager.url}" username="${tomcat.username}" 105 url="${tomcat.manager.url}" username="${tomcat.username}"
90 path="${web.context.path}" 106 path="${web.context.path}"
91 failonerror="false" 107 failonerror="false"
92 /> 108 />
93 </target> 109 </target>
94 110
95 <target name="project.deploy" depends="project.undeploy,project.web.context"> 111 <target name="project.deploy" depends="project.undeploy,project.web.context">
96 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/> 112 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
97 <tomcat:deploy password="${tomcat.password}" 113 <tomcat:deploy password="${tomcat.password}"
98 url="${tomcat.manager.url}" username="${tomcat.username}" 114 url="${tomcat.manager.url}" username="${tomcat.username}"
99 path="${web.context.path}" 115 path="${web.context.path}"
100 config="${build.web.dir.path}/META-INF/context-dev.xml" 116 config="${build.web.dir.path}/META-INF/context-dev.xml"
101 /> 117 />
102 <delete file="${build.web.dir.path}/META-INF/context-dev.xml" failonerror="false"/> 118 <delete file="${build.web.dir.path}/META-INF/context-dev.xml" failonerror="false"/>
103 </target> 119 </target>
104 120
105 </project> 121 </project>