Ant build.xml

<project name="JEDI" basedir="." default="buildAll">
	<property name="srcdir" value="src" />
	<property name="builddir" value="target" />
	<property name="distdir" value="dist" />
	<property name="axi2stagedir" value="axis2" />
	<property name="xsdschemasdir" value="xsdschemas" />
	<property name="javadocdir" value="javadoc" />
	<property name="tpcl" location="../../TPCL" />
	<property name="AXIS2_HOME" value="${tpcl}/axis2-1.3"/>
	<property name="configdir" value="../Config"/>
	<property name="utestdir" value="utest"/>
	<property name="testdir" value="test"/>
	<property name="instrumenteddir" value="${testdir}/instrumented"/>
	<property name="reportsdir" value="${testdir}/reports"/>
	<property name="testclassname"	value="*" />	

	<path id="axis2.classpath">
        <fileset dir="${AXIS2_HOME}/lib">
            <include name="*.jar"/>
        </fileset>
	</path>
	<path id="src.classpath">
        <fileset dir="${tpcl}">
            <include name="commons-collections.jar" />
			<include name="commons-dbcp-1.1.jar" />
			<include name="commons-pool-1.1.jar" />
			<include name="jakarta-oro.jar" />
			<include name="log4j-1.2.8.jar" />
			<include name="jms.jar" />
			<include name="tibrvj.jar" />
			<include name="tibjms.jar" />
			<include name="xalan.jar" />
			<include name="xercesImpl.jar" />
			<include name="xml-apis.jar" />
			<include name="mail.jar" />
			<include name="activation.jar" />
			<include name="weblogic.jar" />
			<include name="joda-time-1.5.2.jar" />
			<include name="wls-api.jar"    />
			<include name="saxon9.jar" />
			<include name="saxon9-dom.jar" />
			<include name="saxon9-xpath.jar" />
			<include name="mvel2-2.0.19.jar"/>
        </fileset>
        <fileset dir="${tpcl}">
           <include name="castor-0.9.7-xml.jar"/>
        </fileset>
	</path>
	<path id="test.classpath">
		<fileset dir="${tpcl}/utest">
			<include name="junit-4.6.jar" />
			<include name="privateaccessor.jar" />
			<include name="mock.jar" />
			<include name="jmsSender.jar"/>	
			<include name="ojdbc14.jar"/>	
		</fileset>
	</path>
	<path id="cobertura.classpath">
		<fileset dir="${tpcl}/utest/cobertura">
			<include name="*.jar" />
		</fileset>
		<path refid="test.classpath"/>
		<path refid="axis2.classpath"/>
	</path>	
	
    <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
	
	<target name="cleanup">
		<delete dir="${builddir}" />
		<delete dir="${distdir}" />		
		<delete file="${axi2stagedir}/repository/services/ExceptionMessageService.aar"/>
		<!-- clean up the test,report and instrumention dir -->
		<delete dir="${testdir}" />
		<!-- clean up the classes coverage log info-->
		<delete file="cobertura.ser"/>
	</target>

	<target name="init" depends="cleanup">
		<mkdir dir="${builddir}" />
		<mkdir dir="${distdir}" />
	</target>
	
	<target name="inittest" depends="cleanup">
		<mkdir dir="${testdir}" />
		<mkdir dir="${instrumenteddir}" />
		<mkdir dir="${reportsdir}/junitxml" />
		<mkdir dir="${reportsdir}/junithtml" />
	</target>
	
	<target name="compile" depends="init">
		
		<javac srcdir="${srcdir}" destdir="${builddir}" encoding="ISO-8859-1" debug="yes">
			<classpath refid="src.classpath"/>
			<classpath refid="axis2.classpath"/>
		</javac>
		<copy todir="${builddir}">
			<fileset dir="${srcdir}">
				<include name="**/*.xslt" />
				<include name="**/*.xml" />
				<include name="**/*.gif" />
				<include name="**/*.jpg" />
				<include name="**/*.aar" />
				<include name="**/*.list" />
				<include name="castor.properties" />
			</fileset>
			<fileset dir="${configdir}">
				<include name="GEHLicense.dat" />
				<include name="GALLicense.dat" />
			</fileset>
		</copy>
	</target>
	
	
	<target name="compiletestcode" depends="inittest,compile">
		<javac srcdir="${utestdir}/java;" destdir="${testdir}" debug="yes" >
		 	<classpath refid="src.classpath" />
			<classpath refid="test.classpath" />
			<classpath refid="axis2.classpath"/>
			<classpath>
				<pathelement location="${builddir}"/>
			</classpath>
		</javac>
		<copy todir="resources">
			<fileset dir="${utestdir}/resources">
				<include name="**/*.xml"  />
				<include name="**/*.properties"  />
				<include name="**/*.sql"  />
				<include name="**/*.gif"  />
			</fileset>
		</copy>
		<copy todir="${builddir}">
			<fileset dir="${UTGlobalEnvDir}">
				  <include name="GlobalEnvProperties.properties"  />
			</fileset>
			<fileset dir="${utestdir}/resources">
		    	<include name="GenericAuditLoggerEngineConfiguration.xml" />
		    	<include name="InvalidGenericAuditLoggerEngineConfiguration_NoGlobalVariables.xml" />
				<include name="InvalidGenericAuditLoggerEngineConfiguration_NoRVJMS.xml" />
				<include name="GenericExceptionHandlerEngineConfiguration.xml" />
				<include name="InvalidGenericExceptionHandlerEngineConfiguration_NoGlobalVariables.xml" />
				<include name="InvalidGenericExceptionHandlerEngineConfiguration_NoRVJMS.xml" />
		    </fileset>
		    <fileset dir="${utestdir}/resources/InvalidLicense"/>
			<fileset dir="${utestdir}/java">
				<include name="**/*.xml"  />
			</fileset>
		</copy>
	</target>
	
	<target name="buildJEDI" depends="compile">
		<tstamp/>
		<jar basedir="${builddir}" destfile="${distdir}/jedi.jar">
			<include name="com/prft/jedi/**/*.class" />
			<include name="com/prft/jedi/**/*.gif" />
			<include name="com/prft/jedi/**/*.jpg" />
		</jar>
	</target>
	
	<target name="buildTM" depends="compile">
		<tstamp/>
		<jar basedir="${builddir}" destfile="${distdir}/tm.jar">
			<include name="com/prft/tm/**/*.class" />
			<include name="com/prft/tm/**/*.xml" />
			<include name="castor.properties" />
		</jar>
	</target>

	<target name="buildGAL" depends="compile">
		<tstamp/>
		<jar basedir="${builddir}" destfile="${distdir}/gal.jar">
			<include name="com/prft/gal/**/*.class" />
			<include name="com/prft/gal/**/*.xml" />
			<include name="com/prft/geh/common/**/*.class" />
			<include name="com/prft/gal/xslt/*.xslt" />
			<include name="castor.properties" />
		</jar>
	</target>

	<target name="buildGEH" depends="compile">
		<tstamp />
		<jar basedir="${builddir}" destfile="${builddir}/com/prft/geh/soap/repository/services/ExceptionMessageService.aar">
			<include name="com/prft/geh/jedi/engine/handler/impl/soap/ExceptionMessageService.class"/>
			<metainf dir="${xsdschemasdir}/geh/soap">
				<include name="**/*.xml"/>
				<include name="**/*.wsdl"/>
			</metainf>
		</jar>
		<jar basedir="${builddir}" destfile="${distdir}/geh.jar">
			<include name="com/prft/geh/**/*.class" />
			<include name="com/prft/geh/**/*.xml" />
			<include name="com/prft/geh/**/*.aar" />
			<include name="com/prft/geh/**/*.list" />
			<include name="com/prft/gal/common/**/*.class" />
			<exclude name="com/prft/geh/jedi/engine/handler/impl/soap/ExceptionMessageService.class"/>
			<include name="castor.properties" />
		</jar>
	</target>
	
	<target name="buildDocs">
		<delete dir="${javadocdir}" />
		<javadoc packagenames="com.prft.*" sourcepath="${srcdir}" destdir="${javadocdir}" package="true">
			<classpath>
				<pathelement location="${tpcl}/castor-0.9.7-xml.jar" />
				<pathelement location="${tpcl}/commons-collections.jar" />
				<pathelement location="${tpcl}/commons-dbcp-1.1.jar" />
				<pathelement location="${tpcl}/commons-pool-1.1.jar" />
				<pathelement location="${tpcl}/jakarta-oro.jar" />
				<pathelement location="${tpcl}/log4j-1.2.8.jar" />
				<pathelement location="${tpcl}/jms.jar" />
				<pathelement location="${tpcl}/tibrvj.jar" />
				<pathelement location="${tpcl}/xalan.jar" />
				<pathelement location="${tpcl}/xercesImpl.jar" />
				<pathelement location="${tpcl}/xml-apis.jar" />
				<pathelement location="${tpcl}/mail.jar" />
				<pathelement location="${tpcl}/activation.jar" />
				<pathelement location="${tpcl}/weblogic.jar" />
				<pathelement location="${tpcl}/joda-time-1.5.2.jar" />
			</classpath>
			<classpath refid="axis2.classpath"/>
		</javadoc>
	</target>
	
	<!-- this part is for unit test and coverage -->
	
	<target name="instrument" >
		
		
		<cobertura-instrument todir="${instrumenteddir}">
			<!--
				The following line causes instrument to ignore any
				source line containing a reference to log4j, for the
				purposes of coverage reporting.
			-->
			<ignore regex="org.apache.log4j.*" />

			<fileset dir="${builddir}">
				
			</fileset>
		</cobertura-instrument>
	</target>
	
   <target name="instrumentGEH" >
		
		
		<cobertura-instrument todir="${instrumenteddir}">
			<!--
				The following line causes instrument to ignore any
				source line containing a reference to log4j, for the
				purposes of coverage reporting.
			-->
			<ignore regex="org.apache.log4j.*" />
             <!--
                This one using to know which will be show at coverage table
             -->
			<fileset dir="${builddir}">
				<include name="com/prft/geh/**/*.class" />
				<include name="com/prft/jedi/**/*.class"/>
				<include name="com/zw/geh/util/bw/listener/**/*.class"/>
				<exclude name="com/prft/geh/**/xmlimpl/**/*.class" />
				<exclude name="com/prft/**/rv/**/*.class" />
				<exclude name="com/prft/geh/**/mssql/*.class" />
				<exclude name="com/prft/geh/**/db2/*.class" />
				<exclude name="com/prft/geh/**/oracle/*.class" />
				<exclude name="com/prft/geh/**/dto/*.class" />
				<exclude name="com/prft/geh/**/configurator/**/*.class" />
				<exclude name="com/prft/jedi/configurator/ui/*.class"/>
				<exclude name="com/zw/geh/util/bw/listener/xmlimpl/**/*.class"/>
				<exclude name="com/prft/jedi/**/xmlimpl/**/*.class"/>
				<exclude name="com/prft/geh/jedi/engine/process/common/Rv*.class"/>
				<exclude name="com/prft/jedi/exceptions/common/XPathProcessorException.class"/>
				<exclude name="com/prft/jedi/exceptions/soap/manager/SoapManagerException.class"/>
				<exclude name="com/prft/jedi/exceptions/mail/manager/MailReceiverException.class"/>
				<exclude name="com/prft/jedi/jms/manager/JmsManagerConstants.class"/>
				<exclude name="com/prft/jedi/exceptions/jms/managerr/JmsQueueConnectionException.class" />
			</fileset>
		</cobertura-instrument>
	</target>
	
	<target name="instrumentGAL" >
		
		
		<cobertura-instrument todir="${instrumenteddir}">
			<!--
				The following line causes instrument to ignore any
				source line containing a reference to log4j, for the
				purposes of coverage reporting.
			-->
			<ignore regex="org.apache.log4j.*" />

			<fileset dir="${builddir}">
				<include name="com/prft/gal/**/*.class" />
				<include name="com/prft/tm/**/*.class" />
				<exclude name="com/prft/gal/**/xmlimpl/*.class" />
				<exclude name="com/prft/gal/**/rv/*.class" />
				<exclude name="com/prft/gal/**/mssql/*.class" />
				<exclude name="com/prft/gal/**/db2/*.class" />
				<exclude name="com/prft/gal/**/oracle/*.class" />
				<exclude name="com/prft/gal/**/dto/*.class" />
				<exclude name="com/prft/gal/**/configurator/*.class" />				
				<exclude name="com/prft/tm/common/castor/xmlbeans/trxdef/*.class" />
				<exclude name="com/prft/tm/**/mssql/*.class" />
				<exclude name="com/prft/tm/**/db2/*.class" />
				<exclude name="com/prft/tm/**/oracle/*.class" />
				<exclude name="com/prft/tm/**/dto/*.class" />
			</fileset>
		</cobertura-instrument>
	</target>

	<target name="testGEH" >
		<junit dir="./" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
			<!--
				Note the classpath order: instrumented classes are before the
				original (uninstrumented) classes.  This is important.
			-->
			<classpath location="${instrumenteddir}" />
			<classpath refid="src.classpath" />
			<classpath refid="test.classpath" />
			<classpath refid="axis2.classpath"/>
                <syspropertyset>
                    <propertyref prefix="test-sys-prop."/>
                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
                </syspropertyset>
			<classpath location="${builddir}" />
			<classpath location="${testdir}" />

			<!--
				The instrumented classes reference classes used by the
				Cobertura runtime, so Cobertura and its dependencies
				must be on your classpath.
			-->
			<classpath refid="cobertura.classpath" />
            <formatter type="brief" usefile="false"/>
			<formatter type="xml" />
			<test name="${testcase}" todir="${reportsdir}/junitxml" if="testcase" />
			<batchtest todir="${reportsdir}/junitxml" unless="testcase">
				<fileset dir="${utestdir}/java">
					<include name="com/prft/geh/**/*Test.java" />
					<include name="com/prft/jedi/**/*Test.java"/>
					<include name="com/zw/geh/util/bw/listener/**/*Test.java" />
				</fileset>
			</batchtest>
		</junit>

		<junitreport todir="${reportsdir}/junitxml">
			<fileset dir="${reportsdir}/junitxml">
				<include name="TEST-*.xml" />
			</fileset>
			<report format="frames" todir="${reportsdir}/junithtml" />
		</junitreport>
	</target>
	
	<target name="testGAL" >
		<junit dir="./" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
			<!--
				Note the classpath order: instrumented classes are before the
				original (uninstrumented) classes.  This is important.
			-->
			<classpath location="${instrumenteddir}" />
			<classpath refid="src.classpath" />
			<classpath refid="test.classpath" />
			<classpath refid="axis2.classpath"/>
                 <syspropertyset>
                     <propertyref prefix="test-sys-prop."/>
                     <mapper from="test-sys-prop.*" to="*" type="glob"/>
                 </syspropertyset>
			<classpath location="${builddir}" />
			<classpath location="${testdir}" />

			<!--
				The instrumented classes reference classes used by the
				Cobertura runtime, so Cobertura and its dependencies
				must be on your classpath.
			-->
			<classpath refid="cobertura.classpath" />
                        
            <formatter type="brief" usefile="false"/>
			<formatter type="xml" />
			<test name="${testcase}" todir="${reportsdir}/junitxml" if="testcase" />
			<batchtest todir="${reportsdir}/junitxml" unless="testcase">
				<fileset dir="${utestdir}/java">
					<include name="com/prft/gal/**/*Test.java" />
					<!-- also include TM cases in GAL-->
					<include name="com/prft/tm/**/*Test.java" />
				</fileset>
			</batchtest>
		</junit>
		<junitreport todir="${reportsdir}/junitxml">
			<fileset dir="${reportsdir}/junitxml">
				<include name="TEST-*.xml" />
			</fileset>
			<report format="frames" todir="${reportsdir}/junithtml" />
		</junitreport>
	</target>
		
	<target name="test" >
		<junit dir="./" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
			<!--
				Note the classpath order: instrumented classes are before the
				original (uninstrumented) classes.  This is important.
			-->
			<classpath location="${instrumenteddir}" />
			<classpath refid="src.classpath" />
			<classpath refid="test.classpath" />
			<classpath refid="axis2.classpath"/>
                 <syspropertyset>
                      <propertyref prefix="test-sys-prop."/>
                      <mapper from="test-sys-prop.*" to="*" type="glob"/>
                 </syspropertyset>
			<classpath location="${builddir}" />
			<classpath location="${testdir}" />

			<!--
				The instrumented classes reference classes used by the
				Cobertura runtime, so Cobertura and its dependencies
				must be on your classpath.
			-->
			<classpath refid="cobertura.classpath" />
                        
            <formatter type="brief" usefile="false"/>
			<formatter type="xml" />
			<test name="${testcase}" todir="${reportsdir}/junitxml" if="testcase" />
			<batchtest todir="${reportsdir}/junitxml" unless="testcase">
				<fileset dir="${utestdir}/java">
					<include name="**/${testclassname}Test.java" />
				</fileset>
			</batchtest>
		</junit>

		<junitreport todir="${reportsdir}/junitxml">
			<fileset dir="${reportsdir}/junitxml">
				<include name="TEST-*.xml" />
			</fileset>
			<report format="frames" todir="${reportsdir}/junithtml" />
		</junitreport>
	</target>

	<target name="coverage-check">
		<cobertura-check branchrate="34" totallinerate="100" />
	</target>

	<target name="coverage-report">
		<!--
			Generate an XML file containing the coverage data using
			the "srcdir" attribute.
		-->
		<cobertura-report srcdir="${srcdir}" destdir="${reportsdir}/coveragexml" format="xml" />
	</target>
	
	<target name="coverage-gal-report">
		<!--
			Generate an XML file containing the coverage data using
			the "srcdir" attribute.
		-->
		<cobertura-report destdir="${reportsdir}/gal/coveragexml" format="xml">
			<fileset dir="${srcdir}">
				<include name="com/prft/gal/**/*.java" />
				<include name="com/prft/tm/**/*.java" />
			</fileset>
		</cobertura-report>
	</target>
	
	<target name="coverage-geh-report">
		<!--
			Generate an XML file containing the coverage data using
			the "srcdir" attribute.
		-->
		<cobertura-report destdir="${reportsdir}/geh/coveragexml" format="xml">
			<fileset dir="${srcdir}">
				<include name="com/prft/geh/**/*.java" />
				<include name="com/prft/jedi/**/*.java"/>
				<include name="com/zw/geh/util/bw/listener/**/*.java"/>
			</fileset>
		</cobertura-report>
	</target>

	<target name="alternate-coverage-report">
		<!--
			Generate a series of HTML files containing the coverage
			data in a user-readable form using nested source filesets.
		-->
		<cobertura-report destdir="${reportsdir}/coveragehtml">
			<fileset dir="${srcdir}">
				<include name="**/*.java" />
			</fileset>
		</cobertura-report>
	</target>
	
	<target name="alternate-gal-coverage-report">
		<!--
			Generate a series of HTML files containing the coverage
			data in a user-readable form using nested source filesets.
		-->
		<cobertura-report destdir="${reportsdir}/gal/coveragehtml">
			<fileset dir="${srcdir}">
				<include name="com/prft/gal/**/*.java" />
				<include name="com/prft/tm/**/*.java" />
			</fileset>
		</cobertura-report>
	</target>
	
	<target name="alternate-geh-coverage-report">
		<!--
			Generate a series of HTML files containing the coverage
			data in a user-readable form using nested source filesets.
		-->
		<cobertura-report destdir="${reportsdir}/geh/coveragehtml">
			<fileset dir="${srcdir}">
				<include name="com/prft/geh/**/*.java" />
				<include name="com/prft/jedi/**/*.java"/>
				<include name="com/zw/geh/util/bw/listener/**/*.java"/>
			</fileset>
		</cobertura-report>
	</target>
	
	<target name="buildAll" depends="buildJEDI,buildGAL,buildTM,buildGEH"/>
	
	<target name="cleanupJMS">
		<echo message="cleanJMS"/>
		<ant antfile="cleanupJMS/build-cleanupJMS.xml" target="cleanupJMS"/>
		<echo message="clean up jms successful"/>
	</target>
	
	<target name="cleanupJMSForLocalMachine">
		<echo message="cleanJMS"/>
		<exec executable="/apps/tibco/ems/5.0/bin/cleanupJMSForUTLocal.sh" />
		<echo message="clean up jms successful"/>
	</target>
	
	<target name="clean">
		<antcall target="cleanupJMSForLocalMachine"/>
	</target>

	<target name="defineUSProp">
		<property name="UTGlobalEnvDir" value="${utestdir}/resources/GlobalEnvironment/US"/>
	</target>
	
	<target name="coverageGEHUS" depends="cleanupJMSForLocalMachine, defineUSProp, compiletestcode, instrumentGEH, testGEH, coverage-geh-report, alternate-geh-coverage-report" description="Compile, instrument ourself, run the tests and generate JUnit and coverage reports.">
		<antcall target="cleanupJMSForLocalMachine" />
	</target>
	<target name="allGEHUS" depends="coverageGEHUS, buildGEH, buildJEDI" />
	
	<target name="coverageGALUS" depends="cleanupJMSForLocalMachine, defineUSProp, compiletestcode, instrumentGAL, testGAL, coverage-gal-report, alternate-gal-coverage-report" description="Compile, instrument ourself, run the tests and generate JUnit and coverage reports.">
		<antcall target="cleanupJMSForLocalMachine" />
	</target>		
	<target name="allGALUS" depends="coverageGALUS, buildGAL, buildTM, buildJEDI" />	
</project>


 
  <role rolename="tomcat"/>
  <role rolename="manager"/>
  <role rolename="admin"/>
  <user username="hudson" password="hudson" roles="tomcat,manager,admin"/>

你可能感兴趣的:(build.xml)