Home | History | Annotate | Download | only in tests
      1 <project name="Build specific targets and properties" default="noDefault" basedir=".">
      2 
      3 <!-- ===================================================================== -->
      4 <!-- Run a given ${target} on all elements being built -->
      5 <!-- ===================================================================== -->
      6 <target name="allElements">
      7 
      8 	<ant antfile="${genericTargets}" target="${target}" >
      9 		<property name="type" value="feature" />
     10 		<property name="id" value="org.eclipse.ve.tests" />
     11 	</ant>
     12 </target>
     13 
     14 <!-- ===================================================================== -->
     15 <!-- Targets to assemble the built elements for particular configurations  -->
     16 <!-- These generally call the generated assemble scripts (named in -->
     17 <!-- ${assembleScriptName}) but may also add pre and post processing -->
     18 <!-- Add one target for each root element and each configuration -->
     19 <!-- ===================================================================== -->
     20 
     21 <target name="assemble.org.eclipse.ve.tests">
     22 	<property name="archiveName" value="VE-junit-tests-${buildId}.zip"/>
     23 	<ant antfile="${assembleScriptName}"/>
     24 <!-- ADD POST STEPS -->
     25 </target>
     26 
     27 <!-- ===================================================================== -->
     28 <!-- Check out map files from correct repository -->
     29 <!-- Replace values for cvsRoot, package and mapVersionTag as desired. -->
     30 <!-- ===================================================================== -->
     31 <target name="checkLocal">
     32 	<available property="mapsLocal" file="${buildDirectory}/maps/org.eclipse.ve.releng" />
     33 </target>
     34 
     35 <target name="getMapFiles" depends="checkLocal" unless="mapsLocal">
     36 
     37 	<!-- ***  change the repo info -->
     38 	<property name="mapCvsRoot" value=":pserver:anonymous (a] dev.eclipse.org:/home/tools" />
     39 
     40 	<property name="mapVersionTag" value="HEAD" />
     41 	<cvs cvsRoot="${mapCvsRoot}"
     42 		package="org.eclipse.ve.releng"
     43 		dest="${buildDirectory}/maps"
     44 		tag="${mapVersionTag}"
     45 	/>
     46 	<!--tag the map files project-->
     47 	<antcall target="tagMapFiles" />
     48 </target>
     49 
     50 <target name="tagMapFiles" if="tagMaps">
     51 	<cvs dest="${buildDirectory}/maps/org.eclipse.ve.releng" command="tag v${timestamp}" />
     52 </target>
     53 
     54 <!-- ===================================================================== -->
     55 <!-- Steps to do before setup -->
     56 <!-- ===================================================================== -->
     57 <target name="preSetup">
     58 </target>
     59 
     60 <!-- ===================================================================== -->
     61 <!-- Steps to do after setup but before starting the build proper -->
     62 <!-- ===================================================================== -->
     63 <target name="postSetup">
     64 </target>
     65 
     66 <!-- ===================================================================== -->
     67 <!-- Steps to do before fetching the build elements -->
     68 <!-- ===================================================================== -->
     69 <target name="preFetch">
     70 </target>
     71 
     72 <!-- ===================================================================== -->
     73 <!-- Steps to do after the fetch -->
     74 <!-- ===================================================================== -->
     75 <target name="postFetch">
     76 	<replace dir="${buildDirectory}/plugins" value="${buildId}" token="@buildid@">
     77 		<include name="**/about.mappings" />
     78 	</replace>
     79 </target>
     80 
     81 <!-- ===================================================================== -->
     82 <!-- Steps to do before generating build scripts -->
     83 <!-- ===================================================================== -->
     84 <target name="preGenerate">
     85 
     86 </target>
     87 
     88 <!-- ===================================================================== -->
     89 <!-- Steps to do after generating the build scripts -->
     90 <!-- ===================================================================== -->
     91 <target name="postGenerate">
     92 	<antcall target="clean" />
     93 </target>
     94 
     95 <!-- ===================================================================== -->
     96 <!-- Steps to do before assembling -->
     97 <!-- ===================================================================== -->
     98 <target name="preAssemble">
     99 
    100 </target>
    101 
    102 <!-- ===================================================================== -->
    103 <!-- Steps to do after assembling-->
    104 <!-- ===================================================================== -->
    105 <target name="postAssemble">
    106 </target>
    107 
    108 
    109 <!-- ===================================================================== -->
    110 <!-- Steps to do before running the build.xmls for the elements being built. -->
    111 <!-- ===================================================================== -->
    112 <target name="preProcess">
    113 	<replace dir="${buildDirectory}/plugins" value="${buildId}" token="@build@">
    114 		<include name="**/about.mappings" />
    115 	</replace>
    116 </target>
    117 
    118 <!-- ===================================================================== -->
    119 <!-- Steps to do after running the build.xmls for the elements being built. -->
    120 <!-- ===================================================================== -->
    121 <target name="postProcess">
    122 	<condition property="logsAvailable">
    123 		<istrue value="${javacVerbose}"/> 
    124 	</condition>
    125 	<antcall target="gatherLogs" />
    126 </target>
    127 
    128 <!-- ===================================================================== -->
    129 <!-- Steps to do after everything is built and assembled -->
    130 <!-- (e.g., testing, posting, emailing, ...) -->
    131 <!-- ===================================================================== -->
    132 <target name="postBuild">
    133 	<antcall target="packageTestFramework" />	
    134 </target>
    135 
    136 <!-- ===================================================================== -->
    137 <!-- Helper targets -->
    138 <!-- ===================================================================== -->
    139 <target name="gatherLogs" if="logsAvailable">
    140 	<mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
    141 	<antcall target="allElements">
    142 		<param name="target" value="gatherLogs" />
    143 	</antcall>
    144 
    145 	<unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
    146 		<fileset dir="${buildDirectory}/features/org.eclipse.ve.tests">
    147 			<include name="*.log.zip" />
    148 		</fileset>
    149 	</unzip>
    150 </target>
    151 <target name="clean" unless="noclean">
    152 	<antcall target="allElements">
    153 		<param name="target" value="cleanElement" />
    154 	</antcall>
    155 </target>
    156 
    157 <target name="packageTestFramework">
    158 	<!--package automated test framework used in GEF builds-->
    159 
    160 	<property name="workingDirectory" value="${buildDirectory}/test.assembly" />
    161 
    162 	<!--unzip the junit tests-->
    163 	<exec dir="${buildDirectory}/${buildLabel}" executable="unzip">
    164 		<arg line="-o -qq VE*junit*.zip -d ${workingDirectory}" />
    165 	</exec>
    166 	
    167 	<!-- create top level testing directory-->    
    168 	<delete dir="${workingDirectory}/ve-testing"/>
    169     <mkdir dir="${workingDirectory}/ve-testing" />
    170 	
    171 	<!--compile the tool used to generate the test.properties file, then run it.-->
    172 	<!--test.properties maps test plugin id's to the name of the plugin directory-->
    173     
    174     <!--eclipse.home is relative to the scripts directory in the org.eclipse.pde.build plugin.  Assume the plugins used in the classpath are in the same directory as org.eclipse.pde.build-->
    175     <property name="eclipse.home" value="../../.." />
    176 
    177     <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
    178     <javac verbose="true" failonerror="true" srcdir="${builderDirectory}/tools" destdir="${builderDirectory}/tools" classpath="${eclipse.home}/plugins/org.apache.xerces_4.0.13/xercesImpl.jar:${eclipse.home}/plugins/org.apache.xerces_4.0.13/xmlParserAPIs.jar"/>
    179    		
    180     <java classname="TestVersionTracker" >
    181          <arg line="${workingDirectory}/eclipse/features/org.eclipse.ve.tests_0.5.0/feature.xml  ${buildDirectory} ${workingDirectory}/ve-testing/test.properties" /> 
    182          <classpath>
    183             	<pathelement path="${eclipse.home}/plugins/org.apache.xerces_4.0.13/xercesImpl.jar:${eclipse.home}/plugins/org.apache.xerces_4.0.13/xmlParserAPIs.jar:${builderDirectory}/tools" />
    184          </classpath>
    185     </java>
    186 
    187 	<!--load the property file created with the directory names for all test plugins-->
    188 	<property file="${workingDirectory}/ve-testing/test.properties" />
    189 
    190 	<!-- Remove the plugin version number appended to the org.eclipse.test plugin directory.
    191    	     This is so that contributors of test.xml's do not have to update their paths to 
    192    	     library.xml in org.eclipse.test whenever its version is updated.
    193    	 -->
    194    	<move todir="${workingDirectory}/eclipse/plugins/org.eclipse.test">
    195     		<fileset dir="${workingDirectory}/eclipse/plugins/${org.eclipse.test}" />
    196   	</move>
    197   	
    198   	<!--the Ant move task leaves behind an empty directory-->
    199   	<delete dir="${workingDirectory}/eclipse/plugins/${org.eclipse.test}" includeEmptyDirs="true" />
    200 	
    201  	<!-- rezip the JUnit plugin tests -->
    202 	<exec dir="${workingDirectory}" executable="zip">
    203 			<arg line="-r -q VE-junit-tests-${buildId}.zip eclipse"/>
    204 	</exec>	
    205  
    206 	<delete dir="${workingDirectory}/eclipse" includeEmptyDirs="true" />
    207  	
    208  	<!--Copy scripts and doc used in the automated testing to the testing directory-->
    209     <copy todir="${workingDirectory}/ve-testing">
    210      	<fileset dir="${buildDirectory}/plugins/org.eclipse.test" includes="testframework.html,JUNIT.XSL" />
    211     </copy>
    212     <copy todir="${workingDirectory}/ve-testing">
    213      	<fileset dir="${builderDirectory}/testScripts" />
    214     </copy>
    215     <move file="${workingDirectory}/VE-junit-tests-${buildId}.zip" todir="${workingDirectory}/ve-testing"/>
    216 
    217 	<!--copy in the file containing the URL of the Eclipse build used for testing-->
    218     <copy todir="${workingDirectory}/ve-testing" file="${buildDirectory}/maps/org.eclipse.ve.releng/maps/build.cfg" />
    219 
    220 	<!--set execute permission on *nix shell script-->
    221 	<chmod file="${workingDirectory}/ve-testing/runtests" perm="755"/>
    222 
    223 	<!--create zip file of the automated testing framework-->	
    224 	<exec dir="${workingDirectory}" executable="zip">
    225 		<arg line="-r -q ${buildDirectory}/${buildLabel}/VE-Automated-Tests-${buildId}.zip ve-testing"/>
    226 	</exec>
    227 	
    228 	<delete file="${buildDirectory}/${buildLabel}/VE-junit-tests-${buildId}.zip"  />
    229 </target>
    230 
    231 <!-- ===================================================================== -->
    232 <!-- Default target                                                        -->
    233 <!-- ===================================================================== -->
    234 <target name="noDefault">
    235 	<echo message="You must specify a target when invoking this file" />
    236 </target>
    237 
    238 </project>