Mercurial > public > develkit
changeset 4:be1051bf262f
add globally common ant scripts
author | smith@nwoca.org |
---|---|
date | Fri, 17 Dec 2010 16:55:03 -0500 |
parents | d5c0421bfd57 |
children | 9c847b8c7e9c |
files | antcontrib-ant.xml bootstrap.xml ivy-ant.xml ssdt-common-build.xml |
diffstat | 4 files changed, 425 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/antcontrib-ant.xml Fri Dec 17 16:55:03 2010 -0500 @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="antcontrib-ant" basedir="."> + + <property name="ssdt.ant-contrib.jar.src" value="http://ivy.ssdt.nwoca.org/repository/ant-contrib/ant-contrib.jar"/> + + <get dest="${user.home.ant.lib}/ant-contrib.jar" + src="${ssdt.ant-contrib.jar.src}" usetimestamp="true"/> + + <taskdef resource="net/sf/antcontrib/antcontrib.properties"> + <classpath> + <pathelement location="${user.home.ant.lib}/ant-contrib.jar"/> + </classpath> + </taskdef> + + <target name="-ant-contrib-define"/> + +</project> \ No newline at end of file
--- a/bootstrap.xml Thu Dec 16 18:37:44 2010 -0500 +++ b/bootstrap.xml Fri Dec 17 16:55:03 2010 -0500 @@ -1,7 +1,45 @@ <?xml version="1.0" encoding="UTF-8"?> <project name="ssdt.bootstrap" basedir="."> - <echo message="invoking ssdt bootstrap"/> - <echoproperties prefix="ssdt"/> + <echo message="invoking ssdt bootstrap" level="info"/> + + <property file="${ssdt.devel.kit}/private.properties"/> + <property name="user.home.ant.lib" value="${user.home}/.ant/lib"/> + <mkdir dir="${ssdt.devel.kit}"/> + +<!-- <macrodef name="ssdt-import-ant"> + <attribute name="file"/> + <sequential> + <get dest="${ssdt.devel.kit}/ivy-ant.xml" + src="${ssdt.devel.kit.src}/ivy-ant.xml" + usetimestamp="true"/> + <import file="${ssdt.devel.kit}/ivy-ant.xml"/> + + </sequential> + </macrodef> --> + + <property name="ssdt.ivy.jar.src" value="http://ivy.ssdt.nwoca.org/repository/ivy/ivy.jar"/> + + <mkdir dir="${user.home.ant.lib}"/> + + <get dest="${user.home.ant.lib}/ivy.jar" + src="${ssdt.ivy.jar.src}" + usetimestamp="true"/> + + <get dest="${ssdt.devel.kit}/ivy-ant.xml" + src="${ssdt.devel.kit.src}/ivy-ant.xml" + usetimestamp="true"/> + <import file="${ssdt.devel.kit}/ivy-ant.xml"/> + + <get dest="${ssdt.devel.kit}/antcontrib-ant.xml" + src="${ssdt.devel.kit.src}/antcontrib-ant.xml" + usetimestamp="true"/> + <import file="${ssdt.devel.kit}/antcontrib-ant.xml"/> + + <get dest="${ssdt.devel.kit}/ssdt-common-build.xml" + src="${ssdt.devel.kit.src}/ssdt-common-build.xml" + usetimestamp="true"/> + + <import file="${ssdt.devel.kit}/ssdt-common-build.xml"/> </project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ivy-ant.xml Fri Dec 17 16:55:03 2010 -0500 @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="ivy-ant" basedir="." xmlns:ivy="antlib:fr.jayasoft.ivy.ant" > + + <dirname property="ivy.home" file="${ant.file.ivy-ant}"/> + <property name="ivy-ant.location" location="${ant.file.ivy-ant}"/> + <dirname property="ivy-ant.base" file="${ivy-ant.location}"/> + + <property name="ivy.default.cache.dir" + value="${user.home}/.ivy2/cache"/> + <property name="ivy.default.ivy.user.dir" + value="${user.home}/.ivy2"/> + <property name="ivy.local.default.root" + value="${user.home}/.ivy2/local"/> + + <target name="ivy-report" depends="init"> + <mkdir dir="${build.dir}/ivy"/> + <ivy:resolve log="quiet" file="ivy.xml"/> + <ivy:report todir="${build.dir}/ivy" conf="*"/> + </target> + + <target name="ivy-info" depends="init"> + <ivy:info file="ivy.xml" property="ivy.project"/> + <echoproperties prefix="ivy.project"/> + </target> + + <target name="ivy-clean" description="cleans ssdt caches and local builds" depends="init"> + <delete failonerror="false" includeemptydirs="true"> + <fileset dir="${user.home}/.ivy2/cache"> + <include name="org.ssdt_ohio/**"/> + <include name="org.nwoca.ssdt/**"/> + <include name="*org*.ssdt*.*"/> + </fileset> + </delete> + <delete dir="${user.home}/.ivy2/ssdt-cache" failonerror="false"/> + <delete dir="${user.home}/.ivy2/local" failonerror="false"/> + </target> + + <target name="-ivy-retrieve-custom" depends="-ivy-define-classpaths,-ivy-retrieve-web-jars"> + </target> + + <target name="-ivy-copy-webjars" if="build.web.dir"> + <ivy:resolve log="quiet" file="ivy.xml"/> + <ivy:retrieve pattern="${basedir}/${build.web.dir}/WEB-INF/lib/[artifact]-[revision].[ext]" type="jar"/> + </target> + + <target name="-ivy-retrieve-web-jars" if="build.web.dir"> + <ivy:retrieve pattern="${basedir}/${build.web.dir}/WEB-INF/lib/[artifact]-[revision].[ext]" type="jar"/> + </target> + + <target name="-ivy-define-classpaths"> + <!-- Custom SSDT retrieve target to replaced IvyBean's default -ivy-retrieve. + Builds a separate classpath for javac, javac.test, run, run.test, etc based + on the ivy configurations similer to how NetBeans would build them. + Uses "ivy:cachepath" instead of "ivy:retrieve". Although is is contrary + to "best practice" it avoids transfering all jars to build directory and + avoids problem with 'clean'. NetBeans and ant don't care where the files + are on disk and the builds are dependent on Ivy anyway. But the "runtime" jars + are still placed in dist/libs based on the correct run.classpath built by this + target. + --> + <ivy:settings file="ivysettings.xml"/> + <ivy:resolve log="download-only" file="ivy.xml"/> + + <ivy:cachepath pathid="ivy.javac.classpath.id" conf="compile" type="jar"/> + <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.javac.classpath"> + <path refid="ivy.javac.classpath.id"/> + <!--map from="${basedir}${file.separator}" to=""/--> + </pathconvert> + <property name="old.javac.classpath" value="${javac.classpath}"/> + <var name="javac.classpath" unset="true"/> + <if> + <equals arg1="${old.javac.classpath}" arg2=""/> + <then> + <property name="javac.classpath" value="${ivy.javac.classpath}"/> + </then> + <else> + <property name="javac.classpath" value="${old.javac.classpath}${path.separator}${ivy.javac.classpath}"/> + </else> + </if> + <echo level="debug" message="$${javac.classpath} : ${javac.classpath}"/> + + <ivy:cachepath pathid="ivy.javac.test.classpath.id" conf="compile,compile-test" type="jar"/> + <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.javac.test.classpath"> + <path refid="ivy.javac.test.classpath.id"/> + <!--map from="${basedir}${file.separator}" to=""/--> + </pathconvert> + <property name="old.javac.test.classpath" value="${javac.test.classpath}"/> + <var name="javac.test.classpath" unset="true"/> + <if> + <equals arg1="${old.javac.test.classpath}" arg2=""/> + <then> + <property name="javac.test.classpath" value="${ivy.javac.test.classpath}"/> + </then> + <else> + <property name="javac.test.classpath" value="${old.javac.test.classpath}${path.separator}${ivy.javac.test.classpath}"/> + </else> + </if> + <echo level="debug" message="$${javac.test.classpath} : ${javac.test.classpath}"/> + + <ivy:cachepath pathid="ivy.run.classpath.id" conf="compile,runtime" type="jar"/> + <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.run.classpath"> + <path refid="ivy.run.classpath.id"/> + <!--map from="${basedir}${file.separator}" to=""/--> + </pathconvert> + <property name="old.run.classpath" value="${run.classpath}"/> + <var name="run.classpath" unset="true"/> + <if> + <equals arg1="${old.run.classpath}" arg2="$${run.classpath}"/> + <then> + <property name="run.classpath" value="${ivy.run.classpath}"/> + </then> + <else> + <property name="run.classpath" value="${old.run.classpath}${path.separator}${ivy.run.classpath}"/> + </else> + </if> + <echo level="debug" message="$${run.classpath} : ${run.classpath}"/> + + + <ivy:cachepath pathid="ivy.run.test.classpath.id" conf="compile,compile-test,runtime,runtime-test" type="jar"/> + <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.run.test.classpath"> + <path refid="ivy.run.test.classpath.id"/> + <!--map from="${basedir}${file.separator}" to=""/--> + </pathconvert> + + <property name="old.run.test.classpath" value="${run.test.classpath}"/> + <var name="run.test.classpath" unset="true"/> + <if> + <equals arg1="${old.run.test.classpath}" arg2="$${run.test.classpath}"/> + <then> + <property name="run.test.classpath" value="${ivy.run.test.classpath}"/> + </then> + <else> + <property name="run.test.classpath" value="${old.run.test.classpath}${path.separator}${ivy.run.test.classpath}"/> + </else> + </if> + <echo level="debug" message="$${run.test.classpath} : ${run.test.classpath}"/> + + <ivy:cachepath pathid="ivy.debug.classpath.id" conf="compile,runtime" type="jar"/> + <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.debug.classpath"> + <path refid="ivy.debug.classpath.id"/> + <!--map from="${basedir}${file.separator}" to=""/--> + </pathconvert> + <property name="old.debug.classpath" value="${debug.classpath}"/> + <var name="debug.classpath" unset="true"/> + <if> + <equals arg1="${old.debug.classpath}" arg2="$${debug.classpath}"/> + <then> + <property name="debug.classpath" value="${ivy.debug.classpath}"/> + </then> + <else> + <property name="debug.classpath" value="${old.debug.classpath}${path.separator}${ivy.debug.classpath}"/> + </else> + </if> + <echo level="debug" message="$${debug.classpath} : ${debug.classpath}"/> + + <ivy:cachepath pathid="ivy.debug.test.classpath.id" conf="compile,compile-test,runtime,runtime-test" type="jar"/> + <pathconvert dirsep="/" pathsep="${path.separator}" property="ivy.debug.test.classpath"> + <path refid="ivy.debug.test.classpath.id"/> + <!--map from="${basedir}${file.separator}" to=""/--> + </pathconvert> + <property name="old.debug.test.classpath" value="${debug.test.classpath}"/> + <var name="debug.test.classpath" unset="true"/> + <if> + <equals arg1="${old.debug.test.classpath}" arg2="$${debug.test.classpath}"/> + <then> + <property name="debug.test.classpath" value="${ivy.debug.test.classpath}"/> + </then> + <else> + <property name="debug.test.classpath" value="${old.debug.test.classpath}${path.separator}${ivy.debug.test.classpath}"/> + </else> + </if> + <echo level="debug" message="$${debug.test.classpath} : ${debug.test.classpath}"/> + </target> + + + <target name="-ivy-javaagent" description="Retrieves load time weaver java agent"> + <property name="java.agent.org" value="org.springframework"/> + <property name="java.agent.module" value="org.springframework.instrument"/> + <property name="java.agent.revision" value="3.0.1.RELEASE-A"/> + <ivy:resolve resolveId="javaagentid" + organisation="${java.agent.org}" + module="${java.agent.module}" + revision="${java.agent.revision}" + type="jar" + inline="true" + keep="true" + log="quiet"/> + <ivy:retrieve + resolveid="javaagentid" + pattern="${basedir}/${build.dir}/${lib.dir}/java-agent.[ext]" + type="jar" + log="quiet"/> + <property name="java.agent.jar" + value="build/jar/java-agent.jar"/> + </target> + + +</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-common-build.xml Fri Dec 17 16:55:03 2010 -0500 @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="ssdt-common-build" default="all" basedir="."> +<!-- + 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 + tomcat.username - Tomcat manager username + tomcat.password - Tomcat manager password + +--> +<!-- + <taskdef name="groovy" + classname="org.codehaus.groovy.ant.Groovy" + classpath="${tools.dir}/groovy-1.0/embeddable/groovy-all-1.0.jar"/> + + <taskdef name="groovyc" + classname="org.codehaus.groovy.ant.Groovyc" + classpath="${tools.dir}/groovy-1.0/embeddable/groovy-all-1.0.jar"/> + +--> + <target name="project.cvs.update" + depends="project.init" + unless="build.devel.bamboo"> + <!-- Get the latest from CVS --> + <cvs command="up -d -P"/> + </target> + + <target name="project.cc.init" depends="project.init" description="Deprecated use project.ini"> + <echo level="warning" message="project.cc.init is deprecated. Use project.init"/> + </target> + + <target name="project.init" depends="init,-project.cvs.version.init"> + <property name="project.version" value="${ivy.revision}"/> + <property name="project.name" value="${ivy.module}"/> + <delete failonerror="false" quiet="true" dir="${build.dir}/checkstyle"/> + <delete failonerror="false" quiet="true" dir="${build.dir}/tests" /> + <delete failonerror="false" quiet="true" dir="${build.dir}/findbugs" /> + <property name="ssdt.tools.jar" value="${tools.dir}/dist/ssdt-tools.jar"/> + </target> + + <target name="-project.cvs.getbranch"> + <property name="project.version.file" value="${src.dir}/version.properties"/> + <mkdir dir="${build.dir}"/> + <cvs command="status build.xml" output="${build.dir}/cvs-branch.txt"/> + <loadfile srcfile="${build.dir}/cvs-branch.txt" property="project.cvs.branch"> + <filterchain> + <tabstospaces tablength="1"/> + <linecontains> + <contains value="Sticky Tag:"/> + </linecontains> + <replacestring from="Sticky Tag:" to=""/> + <replaceregex pattern="\(.*\)" replace=""/> + <replacestring from=" " to=""/> + <striplinebreaks/> + </filterchain> + </loadfile> + <condition property="project.cvs.reset.version.branch" + value="-r ${project.cvs.branch}" + else=""> + <isset property="project.cvs.branch"/> + </condition> + + </target> + + <target name="-project.cvs.version.reset"> + <echo message="Resetting version file ${project.cvs.reset.version.branch}" level="info"/> + <cvs command="update -A -C ${project.cvs.reset.version.branch} ${project.version.file}"/> + </target> + + <target name="project.cvs.version" + depends="project.init,-project.cvs.version.init" + if="build.devel"> + <echo message="comitting project version file" level="info"/> + <cvs command="commit -n -mversion-update ${project.version.file}"/> + </target> + + <target name="-project.cvs.version.init" + depends="-project.cvs.getbranch,-project.cvs.version.reset"> + </target> + + + <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}"/> + <entry key="buildDate" type="date" value="now"/> + <entry key="buildNumber" default="0" type="int" operation="+" value="1"/> + <entry key="built.by" value="${ant.version}"/> + <entry key="build.java.version" value="${ant.java.version}"/> + <entry key="built.on" value="${os.name} ${os.arch} ${os.version} (${user.name})"/> + </propertyfile> + <property file="${project.version.file}" prefix="version"/> + <copy failonerror="false" + file="${project.version.file}" + todir="${build.classes.dir}"/> + </target> + + <target name="-project.pre-init" depends="init"> + <condition property="tomcat.available"> + <and> + <available file="${tools.dir}/etc/tomcat_anttask.properties"/> + <available file="${tomcat.home}" type="dir"/> + </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"/> + <property name="ssdt.tools.jar" value="${tools.dir}/dist/ssdt-tools.jar"/> + + <path id="project.tools.classpath"> + <pathelement location="${ssdt.tools.jar}" /> + <fileset dir="${tomcat.home}" includes="**/lib/catalina-ant.jar"/> + </path> + + <taskdef resource="ssdttomcattasks.properties" classpathref="project.tools.classpath"/> + <taskdef file="${tools.dir}/etc/tomcat_anttask.properties" classpathref="project.tools.classpath"/> + </target> + + <target name="project.web.context" depends="-project.init-tomcat,init"> + <dirname property="docBase.dir.name" file="${build.web.dir}/WEB-INF"/> + + <property name="project.context.file" value="${web.docbase.dir}/META-INF/context.xml"/> + + <copy file="${project.context.file}" + tofile="${build.web.dir}/META-INF/context-dev.xml" + overwrite="true"> + <filterchain> + <tokenfilter> + <filetokenizer/> + <replaceregex + pattern="<Context.*>" + replace="<Context path="${web.context.path}" docBase="@DOCBASE" >" + /> + </tokenfilter> + </filterchain> + </copy> + <replace file="${build.web.dir}/META-INF/context-dev.xml" + 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"/> + <undeploy password="${tomcat.password}" + 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"/> + <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" + /> + <delete file="${build.web.dir.path}/META-INF/context-dev.xml" failonerror="false"/> + </target> + +</project>