antlets/junit/src xbuild.xml,1.4,1.5

[email protected] Thu, 04 Mar 2004 04:51:51 -0800
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/antlets/junit/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30970/junit/src

Modified Files:
	xbuild.xml 
Log Message:
antlet standardisation

Index: xbuild.xml
===================================================================
RCS file: /cvsroot/metamorphosis/antlets/junit/src/xbuild.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** xbuild.xml	3 Mar 2004 21:02:53 -0000	1.4
--- xbuild.xml	4 Mar 2004 12:51:48 -0000	1.5
***************
*** 1,72 ****
  <?xml version="1.0"?>
! <project default="test" name="junit.antlet">
    <description>
      Perform the unit tests using JUnit, and generates reports.
    </description>
    <import file="usage.xml"/>
- 
     <!-- =================================================================== -->
     <!-- ================ Properties for this antlet   ===================== -->
     <!-- =================================================================== -->
!    <dirname property="junit.antlet.dir" file="${ant.file.junit.antlet}"/>
!    <property name="junit.antlet.build.dir" value="${project.build.dir}/junit"/>  
!    <property name="junit.repository" value="http://www.ibiblio.org/maven/junit/jars/"/>
!    <property name="junit.jar" value="junit-3.8.1.jar"/>
!    <property name="junit.antlet.docs.dir" value="${build.dir}/documentation/content/junit"/> 
!    <property name="junit.antlet.build.dir.passdown" value="${junit.antlet.build.dir}"/>
!    <property name="junit.antlet.work.dir" value="${work.dir}/junit"/> 
!    
!    <target name="-junit.init">
! 	   <mkdir dir="${junit.antlet.build.dir}"/>
! 	   <mkdir dir="${junit.antlet.work.dir}"/>
! 	   <mkdir dir="${junit.antlet.dir}/lib"/>
  
!     <get
!          src="${junit.repository}${junit.jar}"
!          dest="${junit.antlet.dir}/lib/${junit.jar}"
!          verbose="true" usetimestamp="true"/>
  
  	<!-- Classpath for my jars -->
  	 <path id="junit.classpath">
! 	    <fileset dir="${junit.antlet.dir}/lib/">
  	      <include name="*.jar"/>
  	    </fileset>
  	 </path>
  
! 	<taskdef file="${junit.antlet.dir}/tasks.properties" classpathref="junit.classpath"/>
   </target>
   
!     <property name="project.test.dir" 
!               value="${jxpath:/references/module.xml/root/module/project[@name=$project.name]/test[@type='test/junit']/@dir}"/>
!  
!    <!-- =================================================================== -->
!    <!-- ================ Checks jUnit antlet settings ===================== -->
!    <!-- =================================================================== -->
!   <target name="junit-check" description="Checks jUnit antlet settings">
!     <echo>
!     	antlets.dir                             ${antlets.dir}
!     	project.test.dir                        ${project.test.dir}
!     	junit.antlet.dir                        ${junit.antlet.dir}
!     	junit.antlet.build.dir                  ${junit.antlet.build.dir}
!     	junit.antlet.docs.dir                   ${junit.antlet.docs.dir}
!     	junit.antlet.work.dir                   ${junit.antlet.work.dir}
!     	build.compiler.debug                    ${build.compiler.debug}
!     	build.compiler.optimize                 ${build.compiler.optimize}
!     	build.compiler.vm                       ${build.compiler.vm}
!     	basedir                                 ${basedir}
!     	project.build.dir                       ${project.build.dir}
!     </echo>
     
-   </target>
    <!-- =================================================================== -->
!   <target name="junit-failsafe-test" description="Perform jUnit tests without failing; important to make it possible to generate a report on the failings">
      <property name="junit.test.haltonfailure" value="no"/>
!     <antcall target="junit-test"/>
    </target>
   
!   <target name="junit-compile" description="Compile tests">
       <!-- Compile tests -->
!     <mkdir dir="${junit.antlet.build.dir}/classes"/>
!     <copy todir="${junit.antlet.build.dir}/classes">
      	<fileset dir="${project.test.dir}">
      		<exclude name="**/*.java"/> <!-- was include *.properties -->
--- 1,173 ----
  <?xml version="1.0"?>
! <project default="junit.test" name="junit.antlet">
    <description>
      Perform the unit tests using JUnit, and generates reports.
    </description>
    <import file="usage.xml"/>
     <!-- =================================================================== -->
     <!-- ================ Properties for this antlet   ===================== -->
+    <!-- ============== build the environment for jUnit ==================== -->
     <!-- =================================================================== -->
!    <target name="-junit.set-props">
! 	   <property name="junit-antlet:junitjar" value="junit-3.8.1.jar"/>
! 	   <dirname property="junit-antlet:dir" file="${ant.file.junit.antlet}"/>
! 	   <property name="junit-antlet:build.dir" value="${project.build.dir}/junit"/>  
! 	   <property name="junit-antlet:repository" value="http://www.ibiblio.org/maven/junit/jars/"/>
! 	   <property name="junit-antlet:docs.dir" value="${build.dir}/documentation/content/junit"/> 
! 	   <!-- property name="junit-antlet:build.dir.passdown" value="${junit-antlet:build.dir}"/ -->
! 	   <property name="junit-antlet:work.dir" value="${work.dir}/junit"/> 
! 		<!-- build the directories -->
!         <mkdir dir="${junit-antlet:docs.dir}"/>
! 		<mkdir dir="${junit-antlet:build.dir}"/>
! 		<mkdir dir="${junit-antlet:work.dir}"/>
! 		<mkdir dir="${junit-antlet:dir}/lib"/>
!         <mkdir dir="${junit-antlet:build.dir}/results"/>
!         <mkdir dir="${junit-antlet:build.dir}/classes"/>
! 	</target>
  
!   <!-- =================================================================== -->
!   <!-- ============ Compiles the jUnit sourcecode ======================== -->
!   <!-- =================================================================== -->
!   <target name="junit.compile" description="Compiles the jUnit sourcecode"
!   	   depends="-junit.init, -junit.compile" />
!   	
!   <!-- =================================================================== -->
!   <!-- Performs jUnit tests.   -->
!   <!-- =================================================================== -->
!   <target name="junit.test" description="Performs jUnit tests."  
!   	   depends="-junit.init, -junit.test"/>
!     
!   <!-- =================================================================== -->
!   <!-- Performs jUnit tests and generates reports                          -->
!   <!-- =================================================================== -->
!   <target name="junit.report" description="Performs jUnit tests and generates reports" 
!   	      depends="-junit.init, -junit.failsafe-test, -junit.test">
! 
!     
!    <junitreport todir="${junit-antlet:work.dir}">
!     <fileset dir="${junit-antlet:build.dir}/results">
!       <include name="TEST-*.xml"/>
!      </fileset>
!     <report format="frames" todir="${junit-antlet:docs.dir}"/>
!    </junitreport>
!   </target>
  
+    <!-- =================================================================== -->
+    <!-- Prints a list of possible tasks for this antlet  -->
+    <!-- =================================================================== -->
+    <target name="junit.list" description="Prints a list of possible tasks for this antlet">
+     <echo>
+     ------------------------------------------------------------------
+     -------- List of possible targets for junit antlet      ----------
+     ------------------------------------------------------------------
+     -        junit.report              - Perform jUnit tests and generate reports
+     -        junit.list                - Print this list
+     -        junit.test                - Perform jUnit tests
+     -        junit.compile             - Compile the test sources
+     ------------------------------------------------------------------
+     </echo>
+   </target>
+  
+    <!-- =================================================================== -->
+    <!-- ========= Initialise jUnit environment ============================ -->
+    <!-- =================================================================== -->
+    <target name="-junit.init" depends="-junit.set-props, -junit.check-env">
  	<!-- Classpath for my jars -->
  	 <path id="junit.classpath">
! 	    <fileset dir="${junit-antlet:dir}/lib/">
  	      <include name="*.jar"/>
  	    </fileset>
  	 </path>
  
! 	<taskdef file="${junit-antlet:dir}/tasks.properties" classpathref="junit.classpath"/>
   </target>
   
!   <!-- =================================================================== -->
!   <!-- Checks the envoironment for this antlet                             -->
!   <!-- =================================================================== -->
!    <target name="-junit.check-env" description="Checks the envoironment for this antlet"
! 		depends="-junit.check-not-present-in-ant-lib
! 		       , -junit.check-fail
! 		       " />
!    
!    <target name="-junit.check-not-present-in-ant-lib">
! 	   <condition property="junit-antlet:check-fail" value="true">
!             <not>
!                 <available  file="${ant.home}/lib/${junit-antlet:junitjar}"/>
! 	        </not>
!        </condition>
!    </target>
     
    <!-- =================================================================== -->
!   <!-- Print the FAIL message and fail                                     -->
!   <!-- =================================================================== -->
!    <target name="-junit.check-fail" if="junit-antlet:check-fail">
!    	<fail>
!    		
!         *******************************************************************************
!         *	
!         *	The initialisation of jUnit tasks has failed.  
!         *	
!         *******************************************************************************
!         *	
!         *   ${junit-antlet:junitjar} was not found in ${ant.home}/lib
!         *	
!         *   Please download the jar from the jUnit project or from ${junit-antlet:repository}
!         *	
!         *******************************************************************************
!    </fail>
!    </target>
!    
!   <!-- =================================================================== -->
!   <!-- Download the jar if necessary -->
!   <!-- Not used anymore. There are too many dependencies on jars in the anthome/lib directory -->
!    <target name="-junit.getjar" description="download the jar if necessary">
!     <get
!          src="${junit-antlet:repository}${junit-antlet:junitjar}"
!          dest="${junit-antlet:dir}/lib/${junit-antlet:junitjar}"
!          verbose="true" usetimestamp="true"/>
!    </target>
!    
!   <!-- =================================================================== 
!   	   Turn off halt-on-failure to perform jUnit tests without failing; 
!   	   important to make it possible to generate a report on the failings
!   	-->
!   <target name="-junit.failsafe-test" 
!   	      description="Perform jUnit tests without failing; important to make it possible to generate a report on the failings">
      <property name="junit.test.haltonfailure" value="no"/>
!     <!-- antcall target="junit.test"/-->
    </target>
   
!   <!-- =================================================================== -->
!   <!-- Perform jUnit tests. Add the junit-antlet:extra.sysproperty elements in
!        properties.xml to add sys properties.  -->
!   <!-- =================================================================== -->
!   <target name="-junit.test"  
!   	      description="Perform jUnit tests. Add the junit-antlet:extra.sysproperty 
!   	                   elements in properties.xml to add sys properties."
!   	      depends=" compile, -junit.compile">
!    <!-- Initialising  -->
! 	<echo message="Testing..."/>
!     <property name="junit.test.haltonfailure" value="yes"/>
!     <property name="testcase" value=""/> 
!     
!     <!-- create property file to be used by junit antlet -->
!     <xslt in="properties.xml" out="${junit-antlet:work.dir}/test.xml"
!           style="${junit-antlet:dir}/resources/stylesheets/test.xsl"
!           force="true">
!      <param name="testcase" expression="${testcase}"/>
!      <param name="projectName" expression="${project.name}"/>
!     </xslt>
!        
!     <ant antfile="${junit-antlet:work.dir}/test.xml" inheritRefs="true"/>
!    
!   </target>
! 
!   <!-- =================================================================== 
!   	   Compile the source code of the test files
!   	-->
!   <target name="-junit.compile" description="Compile tests" depends="-junit.init">
       <!-- Compile tests -->
!     <copy todir="${junit-antlet:build.dir}/classes">
      	<fileset dir="${project.test.dir}">
      		<exclude name="**/*.java"/> <!-- was include *.properties -->
***************
*** 75,79 ****
      	
      <javac srcdir="${project.test.dir}"
!             destdir="${junit.antlet.build.dir}/classes"
              debug=      "${build.compiler.debug}"
              optimize=   "${build.compiler.optimize}"
--- 176,180 ----
      	
      <javac srcdir="${project.test.dir}"
!             destdir="${junit-antlet:build.dir}/classes"
              debug=      "${build.compiler.debug}"
              optimize=   "${build.compiler.optimize}"
***************
*** 90,137 ****
    </target>
   
!   <!-- Initialize for testing.  -->
!   <target name="junit-test-init" description="Initialize for testing">
!     <property name="junit.test.haltonfailure" value="yes"/>
! 	<echo message="Testing..."/>
!     <mkdir dir="${junit.antlet.build.dir}/results"/>
!   </target>  
!   
!   <!-- Perform jUnit tests. Add the junit.antlet.extra.sysproperty elements in
!        properties.xml to add sys properties.  -->
!   <target name="junit-test"  
!   	      description="Perform jUnit tests. Add the junit.antlet.extra.sysproperty 
!   	                   elements in properties.xml to add sys properties."
!   	      depends="-junit.init, compile, junit-compile, junit-test-init">
!    
!     <property name="testcase" value=""/> 
!     
!     <!-- create property file to be used by junit antlet -->
!     <xslt in="properties.xml" out="${junit.antlet.work.dir}/test.xml"
!           style="${junit.antlet.dir}/resources/stylesheets/test.xsl"
!           force="true">
!      <param name="testcase" expression="${testcase}"/>
!      <param name="projectName" expression="${project.name}"/>
!     </xslt>
!        
!     <ant antfile="${junit.antlet.work.dir}/test.xml" inheritRefs="true"/>
     
!   </target>
! 
!     
!   <!-- =================================================================== -->
!   <!-- Test reports                                                       -->
!   <!-- =================================================================== -->
!   <target name="junit-report" description="Perform jUnit test reports" depends="junit-failsafe-test">
! 
!    <mkdir dir="${junit.antlet.docs.dir}"/>
!     <mkdir dir="${junit.antlet.work.dir}"/>
!     
!    <junitreport todir="${junit.antlet.work.dir}">
!     <fileset dir="${junit.antlet.build.dir}/results">
!       <include name="TEST-*.xml"/>
!      </fileset>
!     <report format="frames" todir="${junit.antlet.docs.dir}"/>
!    </junitreport>
!   </target>
! 
  </project>  
--- 191,215 ----
    </target>
   
!    <!-- =================================================================== -->
!    <!-- =========== prints the settings of used properties ================ -->
!    <!-- =================================================================== -->
!   <!-- target name="junit-check" description="prints the settings of used properties"
!   	      depends="-junit.init">
!     <echo>
!     	ant.home                                ${ant.home}
!     	ant.lib.dir                             ${ant.lib.dir}
!     	antlets.dir                             ${antlets.dir}
!     	project.test.dir                        ${project.test.dir}
!     	junit-antlet:dir                        ${junit-antlet:dir}
!     	junit-antlet:build.dir                  ${junit-antlet:build.dir}
!     	junit-antlet:docs.dir                   ${junit-antlet:docs.dir}
!     	junit-antlet:work.dir                   ${junit-antlet:work.dir}
!     	build.compiler.debug                    ${build.compiler.debug}
!     	build.compiler.optimize                 ${build.compiler.optimize}
!     	build.compiler.vm                       ${build.compiler.vm}
!     	basedir                                 ${basedir}
!     </echo>
     
!   </target -->
!   
  </project>  



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click