annotate ssdt-common-build.xml @ 9:ae7d512164d0

TL-32: Add groovy and and allow scripts to "required" a script to be imported separately.
author smith@nwoca.org
date Sat, 18 Dec 2010 19:41:10 -0500
parents 9c847b8c7e9c
children d2901f1c52c3
rev   line source
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
1 <?xml version="1.0" encoding="UTF-8"?>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
2 <project name="ssdt-common-build" default="all" basedir="." xmlns:tomcat="http://ssdt-ohio.org/ant/tomcat">
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
3 <!--
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
4 ssdt common build functions. Contains generalized tasks to perform
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
5 common functions. Assumes some standard properties from a NetBeans
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
6 project are provided.
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
7
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
8 Properties used for webapps:
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
9
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
10 build.web.dir - docBase of build webapp.
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
11 web.docbase.dir - source docBase of webapp
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
12 web.context.path - path to install webapp in Tomcat
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
13 tomcat.username - Tomcat manager username
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
14 tomcat.password - Tomcat manager password
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
15
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
16 -->
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
17 <target name="project.cvs.update"
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
18 depends="project.init"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
19 unless="build.devel.bamboo">
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
20 <!-- Get the latest from CVS -->
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
21 <cvs command="up -d -P"/>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
22 </target>
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
23
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
24 <target name="project.init" depends="init">
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
25 <property file="build-number.txt" description="Bamboo build number"/>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
26 <property name="build.number" value="-1" description="Unknown build number"/>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
27 <property name="project.version" value="${ivy.revision}"/>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
28 <property name="project.name" value="${ivy.module}"/>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
29 <property name="project.version.file" value="${build.classes.dir}/version.properties"/>
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
30 </target>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
31
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
32 <target name="project.version" depends="project.init" >
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
33 <propertyfile file="${project.version.file}" comment="Version build information">
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
34 <entry key="projectName" value="${project.name}"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
35 <entry key="projectVersion" value="${project.version}"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
36 <entry key="buildDate" type="date" value="now"/>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
37 <entry key="buildNumber" value="${build.number}"/>
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
38 <entry key="built.by" value="${ant.version}"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
39 <entry key="build.java.version" value="${ant.java.version}"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
40 <entry key="built.on" value="${os.name} ${os.arch} ${os.version} (${user.name})"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
41 </propertyfile>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
42 </target>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
43
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
44 <target name="-project.pre-init" depends="init">
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
45 <condition property="tomcat.available">
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
46 <and>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
47 <available file="${tomcat.home}" type="dir"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
48 </and>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
49 </condition>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
50 </target>
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
51
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
52 <target name="-project.init-tomcat" depends="-project.pre-init" if="tomcat.available">
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
53 <property name="tomcat.url" value="http://localhost:8084"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
54 <property name="tomcat.manager.url" value="${tomcat.url}/manager"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
55
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
56 <taskdef resource="org/apache/catalina/ant/antlib.xml" uri="http://ssdt-ohio.org/ant/tomcat">
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
57 <classpath>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
58 <fileset dir="${tomcat.home}" includes="**/lib/catalina-ant.jar"/>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
59 </classpath>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
60 </taskdef>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
61 </target>
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
62
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
63 <target name="project.web.context" depends="-project.init-tomcat,init">
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
64 <dirname property="docBase.dir.name" file="${build.web.dir}/WEB-INF"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
65
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
66 <property name="project.context.file" value="${web.docbase.dir}/META-INF/context.xml"/>
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
67
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
68 <copy file="${project.context.file}"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
69 tofile="${build.web.dir}/META-INF/context-dev.xml"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
70 overwrite="true">
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
71 <filterchain>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
72 <tokenfilter>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
73 <filetokenizer/>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
74 <replaceregex
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
75 pattern="&lt;Context.*&gt;"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
76 replace="&lt;Context path=&quot;${web.context.path}&quot; docBase=&quot;@DOCBASE&quot; &gt;"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
77 />
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
78 </tokenfilter>
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
79 </filterchain>
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
80 </copy>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
81 <replace file="${build.web.dir}/META-INF/context-dev.xml"
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
82 token="@DOCBASE"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
83 value="${docBase.dir.name}"/>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
84 </target>
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
85
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
86 <target name="project.undeploy" depends="-project.init-tomcat">
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
87 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
88 <tomcat:undeploy password="${tomcat.password}"
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
89 url="${tomcat.manager.url}" username="${tomcat.username}"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
90 path="${web.context.path}"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
91 failonerror="false"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
92 />
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
93 </target>
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
94
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
95 <target name="project.deploy" depends="project.undeploy,project.web.context">
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
96 <dirname property="build.web.dir.path" file="${build.web.dir}/WEB-INF"/>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
97 <tomcat:deploy password="${tomcat.password}"
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
98 url="${tomcat.manager.url}" username="${tomcat.username}"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
99 path="${web.context.path}"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
100 config="${build.web.dir.path}/META-INF/context-dev.xml"
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
101 />
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
102 <delete file="${build.web.dir.path}/META-INF/context-dev.xml" failonerror="false"/>
5
9c847b8c7e9c TL-32: Update ssdt-common-build to remove obsolte tasks and remove CVS assumptions.
smith@nwoca.org
parents: 4
diff changeset
103 </target>
4
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
104
be1051bf262f add globally common ant scripts
smith@nwoca.org
parents:
diff changeset
105 </project>