Mercurial > public > develkit
comparison ssdt-common-build.xml @ 4:be1051bf262f
add globally common ant scripts
author | smith@nwoca.org |
---|---|
date | Fri, 17 Dec 2010 16:55:03 -0500 |
parents | |
children | 9c847b8c7e9c |
comparison
equal
deleted
inserted
replaced
3:d5c0421bfd57 | 4:be1051bf262f |
---|---|
1 <?xml version="1.0" encoding="UTF-8"?> | |
2 <project name="ssdt-common-build" default="all" basedir="."> | |
3 <!-- | |
4 ssdt common build functions. Contains generalized tasks to perform | |
5 common functions. Assumes some standard properties from a NetBeans | |
6 project are provided. | |
7 | |
8 Properties used for webapps: | |
9 | |
10 build.web.dir - docBase of build webapp. | |
11 web.docbase.dir - source docBase of webapp | |
12 web.context.path - path to install webapp in Tomcat | |
13 tomcat.username - Tomcat manager username | |
14 tomcat.password - Tomcat manager password | |
15 | |
16 --> | |
17 <!-- | |
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" | |
29 unless="build.devel.bamboo"> | |
30 <!-- Get the latest from CVS --> | |
31 <cvs command="up -d -P"/> | |
32 </target> | |
33 | |
34 <target name="project.cc.init" depends="project.init" description="Deprecated use project.ini"> | |
35 <echo level="warning" message="project.cc.init is deprecated. Use project.init"/> | |
36 </target> | |
37 | |
38 <target name="project.init" depends="init,-project.cvs.version.init"> | |
39 <property name="project.version" value="${ivy.revision}"/> | |
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> | |
46 | |
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" > | |
89 <propertyfile | |
90 file="${project.version.file}" comment="Version build information"> | |
91 <entry key="projectName" value="${project.name}"/> | |
92 <entry key="projectVersion" value="${project.version}"/> | |
93 <entry key="buildDate" type="date" value="now"/> | |
94 <entry key="buildNumber" default="0" type="int" operation="+" value="1"/> | |
95 <entry key="built.by" value="${ant.version}"/> | |
96 <entry key="build.java.version" value="${ant.java.version}"/> | |
97 <entry key="built.on" value="${os.name} ${os.arch} ${os.version} (${user.name})"/> | |
98 </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> | |
104 | |
105 <target name="-project.pre-init" depends="init"> | |
106 <condition property="tomcat.available"> | |
107 <and> | |
108 <available file="${tools.dir}/etc/tomcat_anttask.properties"/> | |
109 <available file="${tomcat.home}" type="dir"/> | |
110 </and> | |
111 </condition> | |
112 </target> | |
113 | |
114 <target name="-project.init-tomcat" depends="-project.pre-init" if="tomcat.available"> | |
115 <property name="tomcat.url" value="http://localhost:8084"/> | |
116 <property name="tomcat.manager.url" value="${tomcat.url}/manager"/> | |
117 <property name="ssdt.tools.jar" value="${tools.dir}/dist/ssdt-tools.jar"/> | |
118 | |
119 <path id="project.tools.classpath"> | |
120 <pathelement location="${ssdt.tools.jar}" /> | |
121 <fileset dir="${tomcat.home}" includes="**/lib/catalina-ant.jar"/> | |
122 </path> | |
123 | |
124 <taskdef resource="ssdttomcattasks.properties" classpathref="project.tools.classpath"/> | |
125 <taskdef file="${tools.dir}/etc/tomcat_anttask.properties" classpathref="project.tools.classpath"/> | |
126 </target> | |
127 | |
128 <target name="project.web.context" depends="-project.init-tomcat,init"> | |
129 <dirname property="docBase.dir.name" file="${build.web.dir}/WEB-INF"/> | |
130 | |
131 <property name="project.context.file" value="${web.docbase.dir}/META-INF/context.xml"/> | |
132 | |
133 <copy file="${project.context.file}" | |
134 tofile="${build.web.dir}/META-INF/context-dev.xml" | |
135 overwrite="true"> | |
136 <filterchain> | |
137 <tokenfilter> | |
138 <filetokenizer/> | |
139 <replaceregex | |
140 pattern="<Context.*>" | |
141 replace="<Context path="${web.context.path}" docBase="@DOCBASE" >" | |
142 /> | |
143 </tokenfilter> | |
144 </filterchain> | |
145 </copy> | |
146 <replace file="${build.web.dir}/META-INF/context-dev.xml" | |
147 token="@DOCBASE" | |
148 value="${docBase.dir.name}"/> | |
149 </target> | |
150 | |
151 <target name="project.undeploy" depends="-project.init-tomcat"> | |
152 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/> | |
153 <undeploy password="${tomcat.password}" | |
154 url="${tomcat.manager.url}" username="${tomcat.username}" | |
155 path="${web.context.path}" | |
156 failonerror="false" | |
157 /> | |
158 </target> | |
159 | |
160 <target name="project.deploy" depends="project.undeploy,project.web.context"> | |
161 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/> | |
162 <deploy password="${tomcat.password}" | |
163 url="${tomcat.manager.url}" username="${tomcat.username}" | |
164 path="${web.context.path}" | |
165 config="${build.web.dir.path}/META-INF/context-dev.xml" | |
166 /> | |
167 <delete file="${build.web.dir.path}/META-INF/context-dev.xml" failonerror="false"/> | |
168 </target> | |
169 | |
170 </project> |