comparison 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
comparison
equal deleted inserted replaced
4:be1051bf262f 5:9c847b8c7e9c
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="."> 2 <project name="ssdt-common-build" default="all" basedir="." xmlns:tomcat="http://ssdt-ohio.org/ant/tomcat">
3 <!-- 3 <!--
4 ssdt common build functions. Contains generalized tasks to perform 4 ssdt common build functions. Contains generalized tasks to perform
5 common functions. Assumes some standard properties from a NetBeans 5 common functions. Assumes some standard properties from a NetBeans
6 project are provided. 6 project are provided.
7 7
12 web.context.path - path to install webapp in Tomcat 12 web.context.path - path to install webapp in Tomcat
13 tomcat.username - Tomcat manager username 13 tomcat.username - Tomcat manager username
14 tomcat.password - Tomcat manager password 14 tomcat.password - Tomcat manager password
15 15
16 --> 16 -->
17 <!-- 17 <target name="project.cvs.update"
18 <taskdef name="groovy"
19 classname="org.codehaus.groovy.ant.Groovy"
20 classpath="${tools.dir}/groovy-1.0/embeddable/groovy-all-1.0.jar"/>
21
22 <taskdef name="groovyc"
23 classname="org.codehaus.groovy.ant.Groovyc"
24 classpath="${tools.dir}/groovy-1.0/embeddable/groovy-all-1.0.jar"/>
25
26 -->
27 <target name="project.cvs.update"
28 depends="project.init" 18 depends="project.init"
29 unless="build.devel.bamboo"> 19 unless="build.devel.bamboo">
30 <!-- Get the latest from CVS --> 20 <!-- Get the latest from CVS -->
31 <cvs command="up -d -P"/> 21 <cvs command="up -d -P"/>
32 </target> 22 </target>
33 23
34 <target name="project.cc.init" depends="project.init" description="Deprecated use project.ini"> 24 <target name="project.init" depends="init">
35 <echo level="warning" message="project.cc.init is deprecated. Use project.init"/> 25 <property file="build-number.txt" description="Bamboo build number"/>
36 </target> 26 <property name="build.number" value="-1" description="Unknown build number"/>
37 27 <property name="project.version" value="${ivy.revision}"/>
38 <target name="project.init" depends="init,-project.cvs.version.init"> 28 <property name="project.name" value="${ivy.module}"/>
39 <property name="project.version" value="${ivy.revision}"/> 29 <property name="project.version.file" value="${build.classes.dir}/version.properties"/>
40 <property name="project.name" value="${ivy.module}"/>
41 <delete failonerror="false" quiet="true" dir="${build.dir}/checkstyle"/>
42 <delete failonerror="false" quiet="true" dir="${build.dir}/tests" />
43 <delete failonerror="false" quiet="true" dir="${build.dir}/findbugs" />
44 <property name="ssdt.tools.jar" value="${tools.dir}/dist/ssdt-tools.jar"/>
45 </target> 30 </target>
46 31
47 <target name="-project.cvs.getbranch">
48 <property name="project.version.file" value="${src.dir}/version.properties"/>
49 <mkdir dir="${build.dir}"/>
50 <cvs command="status build.xml" output="${build.dir}/cvs-branch.txt"/>
51 <loadfile srcfile="${build.dir}/cvs-branch.txt" property="project.cvs.branch">
52 <filterchain>
53 <tabstospaces tablength="1"/>
54 <linecontains>
55 <contains value="Sticky Tag:"/>
56 </linecontains>
57 <replacestring from="Sticky Tag:" to=""/>
58 <replaceregex pattern="\(.*\)" replace=""/>
59 <replacestring from=" " to=""/>
60 <striplinebreaks/>
61 </filterchain>
62 </loadfile>
63 <condition property="project.cvs.reset.version.branch"
64 value="-r ${project.cvs.branch}"
65 else="">
66 <isset property="project.cvs.branch"/>
67 </condition>
68
69 </target>
70
71 <target name="-project.cvs.version.reset">
72 <echo message="Resetting version file ${project.cvs.reset.version.branch}" level="info"/>
73 <cvs command="update -A -C ${project.cvs.reset.version.branch} ${project.version.file}"/>
74 </target>
75
76 <target name="project.cvs.version"
77 depends="project.init,-project.cvs.version.init"
78 if="build.devel">
79 <echo message="comitting project version file" level="info"/>
80 <cvs command="commit -n -mversion-update ${project.version.file}"/>
81 </target>
82
83 <target name="-project.cvs.version.init"
84 depends="-project.cvs.getbranch,-project.cvs.version.reset">
85 </target>
86
87
88 <target name="project.version" depends="project.init" > 32 <target name="project.version" depends="project.init" >
89 <propertyfile 33 <propertyfile file="${project.version.file}" comment="Version build information">
90 file="${project.version.file}" comment="Version build information">
91 <entry key="projectName" value="${project.name}"/> 34 <entry key="projectName" value="${project.name}"/>
92 <entry key="projectVersion" value="${project.version}"/> 35 <entry key="projectVersion" value="${project.version}"/>
93 <entry key="buildDate" type="date" value="now"/> 36 <entry key="buildDate" type="date" value="now"/>
94 <entry key="buildNumber" default="0" type="int" operation="+" value="1"/> 37 <entry key="buildNumber" value="${build.number}"/>
95 <entry key="built.by" value="${ant.version}"/> 38 <entry key="built.by" value="${ant.version}"/>
96 <entry key="build.java.version" value="${ant.java.version}"/> 39 <entry key="build.java.version" value="${ant.java.version}"/>
97 <entry key="built.on" value="${os.name} ${os.arch} ${os.version} (${user.name})"/> 40 <entry key="built.on" value="${os.name} ${os.arch} ${os.version} (${user.name})"/>
98 </propertyfile> 41 </propertyfile>
99 <property file="${project.version.file}" prefix="version"/>
100 <copy failonerror="false"
101 file="${project.version.file}"
102 todir="${build.classes.dir}"/>
103 </target> 42 </target>
104 43
105 <target name="-project.pre-init" depends="init"> 44 <target name="-project.pre-init" depends="init">
106 <condition property="tomcat.available"> 45 <condition property="tomcat.available">
107 <and> 46 <and>
108 <available file="${tools.dir}/etc/tomcat_anttask.properties"/>
109 <available file="${tomcat.home}" type="dir"/> 47 <available file="${tomcat.home}" type="dir"/>
110 </and> 48 </and>
111 </condition> 49 </condition>
112 </target> 50 </target>
113 51
114 <target name="-project.init-tomcat" depends="-project.pre-init" if="tomcat.available"> 52 <target name="-project.init-tomcat" depends="-project.pre-init" if="tomcat.available">
115 <property name="tomcat.url" value="http://localhost:8084"/> 53 <property name="tomcat.url" value="http://localhost:8084"/>
116 <property name="tomcat.manager.url" value="${tomcat.url}/manager"/> 54 <property name="tomcat.manager.url" value="${tomcat.url}/manager"/>
117 <property name="ssdt.tools.jar" value="${tools.dir}/dist/ssdt-tools.jar"/>
118 55
119 <path id="project.tools.classpath"> 56 <taskdef resource="org/apache/catalina/ant/antlib.xml" uri="http://ssdt-ohio.org/ant/tomcat">
120 <pathelement location="${ssdt.tools.jar}" /> 57 <classpath>
121 <fileset dir="${tomcat.home}" includes="**/lib/catalina-ant.jar"/> 58 <fileset dir="${tomcat.home}" includes="**/lib/catalina-ant.jar"/>
122 </path> 59 </classpath>
123 60 </taskdef>
124 <taskdef resource="ssdttomcattasks.properties" classpathref="project.tools.classpath"/> 61 </target>
125 <taskdef file="${tools.dir}/etc/tomcat_anttask.properties" classpathref="project.tools.classpath"/>
126 </target>
127 62
128 <target name="project.web.context" depends="-project.init-tomcat,init"> 63 <target name="project.web.context" depends="-project.init-tomcat,init">
129 <dirname property="docBase.dir.name" file="${build.web.dir}/WEB-INF"/> 64 <dirname property="docBase.dir.name" file="${build.web.dir}/WEB-INF"/>
130 65
131 <property name="project.context.file" value="${web.docbase.dir}/META-INF/context.xml"/> 66 <property name="project.context.file" value="${web.docbase.dir}/META-INF/context.xml"/>
132 67
133 <copy file="${project.context.file}" 68 <copy file="${project.context.file}"
134 tofile="${build.web.dir}/META-INF/context-dev.xml" 69 tofile="${build.web.dir}/META-INF/context-dev.xml"
135 overwrite="true"> 70 overwrite="true">
136 <filterchain> 71 <filterchain>
137 <tokenfilter> 72 <tokenfilter>
138 <filetokenizer/> 73 <filetokenizer/>
139 <replaceregex 74 <replaceregex
140 pattern="&lt;Context.*&gt;" 75 pattern="&lt;Context.*&gt;"
141 replace="&lt;Context path=&quot;${web.context.path}&quot; docBase=&quot;@DOCBASE&quot; &gt;" 76 replace="&lt;Context path=&quot;${web.context.path}&quot; docBase=&quot;@DOCBASE&quot; &gt;"
142 /> 77 />
143 </tokenfilter> 78 </tokenfilter>
144 </filterchain> 79 </filterchain>
145 </copy> 80 </copy>
146 <replace file="${build.web.dir}/META-INF/context-dev.xml" 81 <replace file="${build.web.dir}/META-INF/context-dev.xml"
147 token="@DOCBASE" 82 token="@DOCBASE"
148 value="${docBase.dir.name}"/> 83 value="${docBase.dir.name}"/>
149 </target> 84 </target>
150 85
151 <target name="project.undeploy" depends="-project.init-tomcat"> 86 <target name="project.undeploy" depends="-project.init-tomcat">
152 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/> 87 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
153 <undeploy password="${tomcat.password}" 88 <tomcat:undeploy password="${tomcat.password}"
154 url="${tomcat.manager.url}" username="${tomcat.username}" 89 url="${tomcat.manager.url}" username="${tomcat.username}"
155 path="${web.context.path}" 90 path="${web.context.path}"
156 failonerror="false" 91 failonerror="false"
157 /> 92 />
158 </target> 93 </target>
159 94
160 <target name="project.deploy" depends="project.undeploy,project.web.context"> 95 <target name="project.deploy" depends="project.undeploy,project.web.context">
161 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/> 96 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
162 <deploy password="${tomcat.password}" 97 <tomcat:deploy password="${tomcat.password}"
163 url="${tomcat.manager.url}" username="${tomcat.username}" 98 url="${tomcat.manager.url}" username="${tomcat.username}"
164 path="${web.context.path}" 99 path="${web.context.path}"
165 config="${build.web.dir.path}/META-INF/context-dev.xml" 100 config="${build.web.dir.path}/META-INF/context-dev.xml"
166 /> 101 />
167 <delete file="${build.web.dir.path}/META-INF/context-dev.xml" failonerror="false"/> 102 <delete file="${build.web.dir.path}/META-INF/context-dev.xml" failonerror="false"/>
168 </target> 103 </target>
169 104
170 </project> 105 </project>