sysperfana/analyzetoolext/build.xml
changeset 6 f65f740e69f9
parent 5 844b047e260d
child 7 8e12a575a9b5
equal deleted inserted replaced
5:844b047e260d 6:f65f740e69f9
     1   
       
     2 <project name="com.nokia.s60tools.analyzetool" default="build.all">
       
     3 
       
     4   <!-- declare ant4eclipse -->
       
     5   <taskdef resource="net/sf/ant4eclipse/antlib.xml" />
       
     6 
       
     7   <!-- Name definitions -->
       
     8   <property name="feature.name" value="AnalyzeTool"/>
       
     9   <property name="project.name" value="com.nokia.carbide.extensions.analyzetool" />
       
    10   <property name="jar.filename" value="${ant.project.name}.jar"/>
       
    11   
       
    12   <!-- Folder definitions -->
       
    13   <property name="workspace.path" value="." />
       
    14   <property name="java.location" value="C:/APPS/j2sdk_1.5.0_12" />
       
    15   <property name="destination.path" value="." />
       
    16   
       
    17   <property name="carbide.folder" value="C:/Carbide_internal" />
       
    18 	<property name="carbide.int.folder" location="c:/Carbide_ADT/plugins"/>
       
    19 	<property name="carbide.dev.folder" location="c:/Carbide_development/plugins"/>
       
    20 	
       
    21 	<property name="test.folder" location="${ant.project.name}.tests"/>
       
    22 	<property name="test.cache.folder" location="${ant.project.name}.cache.tests"/>
       
    23 	<property name="test.ifsheets.folder" location="${ant.project.name}.ifsheets.tests"/>
       
    24 	<property name="test.web.folder" location="${ant.project.name}.web.tests"/> 
       
    25   <property name="reports.folder" location="reports"/>
       
    26 	<property name="reports.emma" location="${reports.folder}/emma"/>
       
    27 	<property name="instr.folder" location="instr"/>
       
    28 	<property name="binaries.folder" location="${feature.name}.binaries"/>
       
    29 	
       
    30 	
       
    31 	<!-- EMMA configuration -->
       
    32  	<path id="emma.lib" >
       
    33     	<pathelement location="${ant.home}/lib/emma.jar" />
       
    34     	<pathelement location="${ant.home}/lib/emma_ant.jar" />
       
    35   	</path>
       
    36 
       
    37   	<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
       
    38 	
       
    39 	<!-- PMD configuration -->
       
    40 	<path id="pmd.lib" >
       
    41     	<pathelement location="${ant.home}/lib/pmd-4.2.5.jar" />
       
    42     	<pathelement location="${ant.home}/lib/asm-3.1.jar" />
       
    43     	<pathelement location="${ant.home}/lib/jaxen-1.1.1.jar" />
       
    44   	</path>
       
    45 	
       
    46 	<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib" />
       
    47 	
       
    48 	<!-- Folders -->
       
    49 	<delete dir="${instr.folder}"/>
       
    50 	<mkdir dir="${instr.folder}"/>
       
    51 	
       
    52 	<delete dir="${reports.folder}"/>
       
    53 	<mkdir dir="${reports.folder}"/>
       
    54 	
       
    55 	<!-- Carbide_classpath -->
       
    56 	<path id="carbide_classpath">
       
    57 		<fileset dir="${carbide.int.folder}" includes="**/*.jar" />
       
    58 		<fileset dir="plugins" includes="**/*.jar" />
       
    59 	</path>
       
    60 	
       
    61   <!-- Delete old plugins and features -->
       
    62   <target name="delete">
       
    63 	  <delete dir="plugins" failonerror="false"/>
       
    64 	  <delete dir="features" failonerror="false"/>
       
    65 	  <delete dir="${ant.project.name}/bin/com" failonerror="false"/>
       
    66 	  <delete dir="${ant.project.name}.tests/bin/com" failonerror="false"/>
       
    67 	  <delete dir="${ant.project.name}.trace/bin/com" failonerror="false"/>
       
    68   </target>
       
    69  
       
    70    
       
    71   <!-- Target Plugin -->
       
    72   <target name="build.plugins" depends="">
       
    73   <buildPlugin workspace="${workspace.path}" targetPlatformLocation="${carbide.folder}" projectname="${ant.project.name}" destDir="${destination.path}" packageAsJar="true">
       
    74   	<javacLibraryCompiler>
       
    75   <compilerSettings debug="true" fork="true"/>
       
    76   </javacLibraryCompiler>
       
    77   </buildPlugin>
       
    78   <buildPlugin workspace="${workspace.path}" targetPlatformLocation="${carbide.folder}" projectname="${ant.project.name}.corecomponents" destDir="${destination.path}" packageAsJar="true">
       
    79   	<javacLibraryCompiler>
       
    80   <compilerSettings debug="true" fork="true"/>
       
    81   </javacLibraryCompiler>
       
    82   </buildPlugin>
       
    83   <buildPlugin workspace="${workspace.path}" targetPlatformLocation="${carbide.folder}" projectname="${ant.project.name}.help" destDir="${destination.path}" packageAsJar="true">
       
    84   	<javacLibraryCompiler>
       
    85   <compilerSettings debug="true" fork="true"/>
       
    86   </javacLibraryCompiler>
       
    87   </buildPlugin>
       
    88    <buildPlugin workspace="${workspace.path}" targetPlatformLocation="${carbide.folder}" projectname="${ant.project.name}.trace" destDir="${destination.path}" packageAsJar="true">
       
    89   	<javacLibraryCompiler>
       
    90   <compilerSettings debug="true" fork="true"/>
       
    91   </javacLibraryCompiler>
       
    92   </buildPlugin>
       
    93 
       
    94                 
       
    95                 
       
    96   <!-- Build MultiTestRunner feature -->
       
    97   <buildFeature workspace="${workspace.path}"
       
    98                targetPlatformLocation="${carbide.folder}"
       
    99                projectname="${project.name}"
       
   100                buildPluginTarget="build.plugin"
       
   101                destDir="${destination.path}" />
       
   102                
       
   103   </target>
       
   104   
       
   105   <!-- Empty target to do nothing --> 
       
   106   <target name="build.plugin">
       
   107   </target>	
       
   108   
       
   109   
       
   110   
       
   111   <!-- Instrumentation target, depends on build.mtrunner -->
       
   112 	<target name="instr" depends="build.plugins">
       
   113 		<!-- Instrument the source code -->
       
   114 		<emma>
       
   115 			<instr instrpath="${ant.project.name}/bin" destdir="${instr.folder}" metadatafile="${reports.emma}/metadata.emma" merge="true"/>
       
   116 		</emma>
       
   117 	</target>
       
   118   
       
   119   
       
   120   <target name="create.zip">
       
   121   
       
   122   	<delete dir="${binaries.folder}/nightly_builds"/>
       
   123   	<mkdir dir="${binaries.folder}/nightly_builds"/>
       
   124   	
       
   125  		 <!-- Zip jars to AnalyzeTool.zip -->
       
   126  		<tstamp>
       
   127 		   <format property="timestamp" pattern="dd-MM-yyyy" />
       
   128 		</tstamp> 
       
   129  		 
       
   130     <zip destfile="${binaries.folder}/nightly_builds/${feature.name}-${timestamp}.zip"
       
   131        basedir="."
       
   132        includes="plugins/*, features/com.nokia.carbide.extensions.*/"/>
       
   133   </target>
       
   134   
       
   135   <!-- Analyze target -->
       
   136 	<target name="analyze">
       
   137 		<!-- PMD -->
       
   138 		<pmd shortFileNames="true">
       
   139 			<!-- Rules -->
       
   140 			<ruleset>basic</ruleset>
       
   141 			<ruleset>codesize</ruleset>
       
   142 			<ruleset>coupling</ruleset>
       
   143 			<ruleset>design</ruleset>
       
   144 			<ruleset>strictexception</ruleset>
       
   145 			<ruleset>strings</ruleset>
       
   146 			<ruleset>sunsecure</ruleset>
       
   147 			<ruleset>unusedcode</ruleset>
       
   148 			<ruleset>junit</ruleset>
       
   149 			
       
   150 			<!-- XML output -->
       
   151 			<formatter type="xml" toFile="${reports.folder}/report.pmd.xml"/>
       
   152 			
       
   153 			<!-- Files to analyze -->
       
   154 			<!-- Files to analyze -->
       
   155 			<fileset dir="${ant.project.name}/src/">
       
   156 				<include name="**/*.java"/>
       
   157 			</fileset>
       
   158 			<fileset dir="${ant.project.name}.tests/src/">
       
   159 				<include name="**/*.java"/>
       
   160 			</fileset>
       
   161 			<fileset dir="${ant.project.name}.trace/src/">
       
   162 				<include name="**/*.java"/>
       
   163 			</fileset>
       
   164 		</pmd>
       
   165 	</target>
       
   166 	
       
   167 	<!-- Test target, depends on instrumentation and analyze -->
       
   168 	<target name="test" depends="instr, analyze" description="Run unit tests">
       
   169     	<!-- Test classpath -->
       
   170     	<path id="test_classpath">
       
   171 			<!-- Test classes -->
       
   172 			<pathelement location="${test.folder}/src"/>
       
   173 			
       
   174 			<!-- Instrumented class files -->
       
   175 		   	<pathelement location="${instr.folder}"/>
       
   176 		   	
       
   177 		   	<!-- EMMA -->
       
   178 		   	<pathelement path="${ant.home}/lib/emma.jar"/>
       
   179 		   	
       
   180 		   	<path refid="carbide_classpath" />
       
   181 		</path>
       
   182 	
       
   183 		<!-- Compile the tests -->
       
   184      	<javac srcdir="${test.folder}" verbose="${javacVerbose}">
       
   185       		<classpath refid="test_classpath"/>
       
   186 	    </javac>
       
   187 
       
   188 		<!-- Run JUnit -->
       
   189 	    <junit printsummary="yes" fork="yes" haltonfailure="no">
       
   190 	      	<classpath refid="test_classpath" />
       
   191 	      	
       
   192 	      	<!-- Plain format and XML -->
       
   193 	      	<formatter type="plain" />
       
   194 	      	<formatter type="xml" />
       
   195 			
       
   196 			<!-- Instrumentation arguments to JVM -->
       
   197 			<jvmarg value="-Demma.coverage.out.file=${reports.emma}/coverage.emma" />
       
   198 	    <jvmarg value="-Demma.coverage.out.merge=true" />
       
   199 
       
   200 			<!-- Test classes -->
       
   201 	      	<test name="com.nokia.s60tools.analyzetool.tests.AllPureJUnitTests" todir="${reports.folder}"/>
       
   202 	    </junit>
       
   203 	    
       
   204 	    <!-- Create EMMA report -->
       
   205 	    <emma>
       
   206 	    	<report sourcepath="src/" >
       
   207             	<fileset dir="${reports.emma}" >
       
   208                 	<include name="*.emma" />
       
   209             	</fileset>
       
   210             	<xml outfile="${reports.emma}/coverage.xml" />
       
   211         	</report>
       
   212 	    </emma>
       
   213 	</target>
       
   214 	
       
   215 	<target name="copy_to_carbide">
       
   216 	<!-- Copy the actual plug-ins to the carbide folders -->
       
   217 		<copy todir="${carbide.int.folder}" failonerror="true" overwrite="true">
       
   218 				<fileset dir="plugins"/>
       
   219 		</copy>
       
   220 		<copy todir="${carbide.dev.folder}" failonerror="true" overwrite="true">
       
   221 				<fileset dir="plugins"/>
       
   222 		</copy>
       
   223   </target>
       
   224   
       
   225   
       
   226   <!-- Target Build all -->
       
   227   <target name="build.all" depends="delete, build.plugins, instr, analyze, test, copy_to_carbide, create.zip" />
       
   228   
       
   229 </project>