common/build.xml
changeset 84 fcf94a72b33e
parent 81 5e724ff842b4
child 85 834b82541047
equal deleted inserted replaced
83:add0abfa2371 84:fcf94a72b33e
    31     <!-- import common references -->
    31     <!-- import common references -->
    32     <import file="${sf.common.config.dir}/common_refs.ant.xml" />
    32     <import file="${sf.common.config.dir}/common_refs.ant.xml" />
    33              
    33              
    34     <!-- conditional import of generated source spec if available -->
    34     <!-- conditional import of generated source spec if available -->
    35     <if><available  file="${sf.common.config.dir}/generated/source-spec.ant.xml" />
    35     <if><available  file="${sf.common.config.dir}/generated/source-spec.ant.xml" />
    36         <then>		    		
    36         <then>
    37             <echo message="Generated source spec found, importing..." />
    37             <echo message="Generated source spec found, importing..." />
    38     				<import file="${sf.common.config.dir}/generated/source-spec.ant.xml"/>
    38             <import file="${sf.common.config.dir}/generated/source-spec.ant.xml"/>
    39     		</then>
    39         </then>
    40     </if>
    40     </if>
    41      
    41      
    42     
    42     
    43     <target name="sf-prep" depends="sf-generate-source-spec,prep-drive,init-build-area,check-tool-dependencies,create-bom,log-build-env">
    43     <target name="sf-prep" depends="sf-generate-source-spec,prep-drive,init-build-area,check-tool-dependencies,create-bom,log-build-env">
    44         <echo>[SF-PREP]</echo>
    44         <echo>[SF-PREP]</echo>
   139         
   139         
   140         <if>
   140         <if>
   141             <istrue value="${sf.spec.sourcesync.enable}" />
   141             <istrue value="${sf.spec.sourcesync.enable}" />
   142             <then>
   142             <then>
   143                 <runtarget target="sf-get-source"/>
   143                 <runtarget target="sf-get-source"/>
   144 				
   144                 
   145 				<if><istrue value="${sf.spec.package.src.enable}"/>
   145                 <if><istrue value="${sf.spec.package.src.enable}"/>
   146 				<then>
   146                 <then>
   147 					<echo message="INFO Packaging Source"/>
   147                     <echo message="INFO Packaging Source"/>
   148 					<runtarget target="sf-package-source"/>
   148                     <runtarget target="sf-package-source"/>
   149 				</then>
   149                 </then>
   150 				</if>
   150                 </if>
   151 				
   151                 
   152 				<!-- merge RnD binaries into the epoc tree -->
   152                 <!-- merge RnD binaries into the epoc tree -->
   153 				<echo message="Merges RnD binaries into the Epoc tree"/>
   153                 <echo message="Merges RnD binaries into the Epoc tree"/>
   154 				<exec executable="perl" dir="${build.drive}/" failonerror="true" output="${build.log.dir}/mergeepoc32.log">
   154                 <exec executable="perl" dir="${build.drive}/" failonerror="true" output="${build.log.dir}/mergeepoc32.log">
   155 					<arg value="${sf.common.config.dir}/tools/mergeepoc32.pl"/>
   155                     <arg value="${sf.common.config.dir}/tools/mergeepoc32.pl"/>
   156 				</exec>
   156                 </exec>
   157             </then>
   157             </then>
   158         </if>        
   158         </if>        
   159       <if>
   159       <if>
   160         <istrue value="${sf.spec.publish.enable}"/>
   160         <istrue value="${sf.spec.publish.enable}"/>
   161         <then>
   161         <then>
   162           <runtarget target="sf-diamondize-bom"/>
   162           <runtarget target="sf-diamondize-bom"/>
   163         </then>
   163         </then>
   164       </if>
   164       </if>
   165     </target>
   165     </target>
   166     
   166     
   167   <target name="sf-postbuild" depends="sf-zip-logs">
   167     <target name="sf-postbuild" depends="sf-zip-logs">
   168     <echo>[SF-POSTBUILD]</echo>
   168         <echo>[SF-POSTBUILD]</echo>
   169     
   169         
   170     <!-- TAG SOURCE CODE -->
   170         <!-- TAG SOURCE CODE -->
   171     <if>
   171         <if>
   172       <istrue value="${sf.spec.tagafterbuild.enable}" />
   172             <istrue value="${sf.spec.tagafterbuild.enable}" />
   173       <then>
   173             <then>
   174         <echo message="Apply tag to the source code used in this build"/>
   174                 <echo message="Apply tag to the source code used in this build"/>
   175         <runtarget target="sf-tag-hg-code"/>
   175                 <runtarget target="sf-tag-hg-code"/>
   176       </then>
   176             </then>
   177     </if>
   177         </if>
   178 	
   178     
   179 	<if>
   179         <if>
   180 		<istrue value="${sf.spec.package.bin.enable}"/>
   180             <istrue value="${sf.spec.package.bin.enable}"/>
   181 		<then>
   181             <then>
   182 			<echo message="INFO Packaging Binaries"/>
   182                 <echo message="INFO Packaging Binaries"/>
   183 			<runtarget target="sf-package-binary"/>
   183                 <runtarget target="sf-package-binary"/>
   184 		</then>
   184             </then>
   185 	</if>
   185         </if>
   186 
   186 
   187     <!-- PUBLISH LOGS/REPORTS -->
   187         <!-- PUBLISH LOGS/REPORTS -->
   188     <if>
   188         <if>
   189       <istrue value="${sf.spec.publish.enable}" />
   189             <istrue value="${sf.spec.publish.enable}" />
   190       <then>
   190             <then>
   191         <echo message="Publish log files and reports to ${sf.spec.publish.rootdir}"/>
   191                 <echo message="Publish log files and reports to ${sf.spec.publish.rootdir}"/>
   192         <runtarget target="publish"/>
   192                 <runtarget target="publish"/>
   193       </then>
   193             </then>
   194     </if>
   194         </if>
   195     
   195     </target>
   196   </target>
   196 
   197 
   197     <!-- package all logs into zipfile before publish -->
   198   <!-- package all logs into zipfile before publish -->
   198     <target name="sf-zip-logs">
   199   <target name="sf-zip-logs">
   199         <if>
   200     <if>
   200             <istrue value="${sf.spec.logs.zip.enable}"/>
   201       <istrue value="${sf.spec.logs.zip.enable}"/>
   201             <then>
   202       <then>
   202                 <property name="temp.log.zip" value="${env.TEMP}/build_logs_${sf.spec.job.name}_${build.number}.zip"/>
   203         <property name="temp.log.zip" value="${env.TEMP}/build_logs_${sf.spec.job.name}_${build.number}.zip"/>
   203                 <echo message="Zip log requested, zipping logs..."/>
   204         <echo message="Zip log requested, zipping logs..."/>
   204                 <zip destfile="${temp.log.zip}" basedir="${build.log.dir}"/>
   205         <zip destfile="${temp.log.zip}" basedir="${build.log.dir}"/>
   205                 <move file="${temp.log.zip}" todir="${build.log.dir}" failonerror="false"/>
   206         <move file="${temp.log.zip}" todir="${build.log.dir}" failonerror="false"/>
   206             </then>
   207       </then>
   207         </if>
   208     </if>
   208     </target>
   209   </target>
   209     
   210 
   210     <!-- generate dir list using passed location and name 
   211   <!-- generate dir list using passed location and name 
   211     if a baseline list is available then generate deltas too -->
   212   if a baseline list is available then generate deltas too -->
   212 
   213 
   213     <target name="sf-list-dir">
   214   <target name="sf-list-dir">
   214         <property name="sf.currentlist.name"   value="${sf.list.name}"/> 
   215     <property name="sf.currentlist.name"   value="${sf.list.name}"/> 
   215         <property name="sf.dir.location" value="${build.drive}/epoc32"/> 
   216     <property name="sf.dir.location" value="${build.drive}/epoc32"/> 
   216     
   217 
   217         <if>
   218     <if>
   218             <istrue value="${sf.spec.dirlist.enable}"/>
   219       <istrue value="${sf.spec.dirlist.enable}"/>
   219             <then>
   220       <then>
   220                 <echo message="Dirlist name: ${sf.currentlist.name} requested for ${sf.dir.location}"/>
   221         <echo message="Dirlist name: ${sf.currentlist.name} requested for ${sf.dir.location}"/>
   221                 <exec executable="perl" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist.name}.log">
   222         <exec executable="perl" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist.name}.log">
   222                     <arg value="${sf.common.config.dir}/tools/listdir.pl"/>
   223           <arg value="${sf.common.config.dir}/tools/listdir.pl"/>
   223                     <arg value="${sf.dir.location}"/>
   224           <arg value="${sf.dir.location}"/>
   224                 </exec>
   225         </exec>
   225             </then>
   226       </then>
   226         </if>
   227     </if>
   227     </target>
   228   </target>
   228     
   229 	
   229     <target name="sf-delta-dir">
   230   <target name="sf-delta-dir">
   230         <property name="sf.currentlist_a.name"   value="${sf.list_a.name}"/> 
   231     <property name="sf.currentlist_a.name"   value="${sf.list_a.name}"/> 
   231         <property name="sf.currentlist_b.name"   value="${sf.list_b.name}"/>
   232     <property name="sf.currentlist_b.name"   value="${sf.list_b.name}"/>
   232         <property name="sf.dir.location" value="${build.drive}/epoc32"/> 
   233     <property name="sf.dir.location" value="${build.drive}/epoc32"/> 
   233         
   234     		
   234         <if>
   235     <if>
   235             <istrue value="${sf.spec.dirdelta.enable}"/>
   236       <istrue value="${sf.spec.dirdelta.enable}"/>
   236             <then>
   237       <then>
   237                 <echo message="Delta requested for ${sf.currentlist_a.name} vs ${sf.currentlist_b.name} "/>
   238         <echo message="Delta requested for ${sf.currentlist_a.name} vs ${sf.currentlist_b.name} "/>
   238                 <exec executable="perl" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist_b.name}_delta.log">
   239         <exec executable="perl" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist_b.name}_delta.log">
   239                     <arg value="${sf.common.config.dir}/tools/difflist.pl"/>
   240           <arg value="${sf.common.config.dir}/tools/difflist.pl"/>
   240                     <arg value="${build.log.dir}/listdir_${build.id}_${sf.currentlist_a.name}.log"/>
   241           <arg value="${build.log.dir}/listdir_${build.id}_${sf.currentlist_a.name}.log"/>
   241                     <arg value="${build.log.dir}/listdir_${build.id}_${sf.currentlist_b.name}.log"/>
   242           <arg value="${build.log.dir}/listdir_${build.id}_${sf.currentlist_b.name}.log"/>
   242                 </exec>
   243         </exec>
   243             </then>
   244       </then>
   244         </if>
   245     </if>
   245     </target>
   246   </target>
       
   247   
   246   
   248     <target name="sf-intersect-dir">
   247     <target name="sf-intersect-dir">
   249     <property name="sf.currentlist_a.name"   value="${sf.list_a.name}"/> 
   248         <property name="sf.currentlist_a.name"   value="${sf.list_a.name}"/> 
   250     <property name="sf.currentlist_b.name"   value="${sf.list_b.name}"/>
   249         <property name="sf.currentlist_b.name"   value="${sf.list_b.name}"/>
   251     <property name="sf.dir.location" value="${build.drive}/epoc32"/> 
   250         <property name="sf.dir.location" value="${build.drive}/epoc32"/> 
   252 	
   251     
   253     <if>
   252         <if>
   254       <istrue value="${sf.spec.dirdelta.enable}"/>
   253             <istrue value="${sf.spec.dirdelta.enable}"/>
   255       <then>
   254             <then>
   256         <echo message="Inersection requested for ${sf.currentlist_a.name} vs ${sf.currentlist_b.name} "/>
   255                 <echo message="Inersection requested for ${sf.currentlist_a.name} vs ${sf.currentlist_b.name} "/>
   257         <exec executable="perl" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist_b.name}_intersect.log">
   256                 <exec executable="perl" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist_b.name}_intersect.log">
   258           <arg value="${sf.common.config.dir}/tools/difflist.pl"/>
   257                     <arg value="${sf.common.config.dir}/tools/difflist.pl"/>
   259           <arg value="${build.log.dir}/listdir_${build.id}_${sf.currentlist_a.name}.log"/>
   258                     <arg value="${build.log.dir}/listdir_${build.id}_${sf.currentlist_a.name}.log"/>
   260           <arg value="${build.log.dir}/listdir_${build.id}_${sf.currentlist_b.name}.log"/>
   259                     <arg value="${build.log.dir}/listdir_${build.id}_${sf.currentlist_b.name}.log"/>
   261           <arg value="-I"/> <!-- run difflist in intersect mode -->
   260                     <arg value="-I"/> <!-- run difflist in intersect mode -->
   262         </exec>
   261                 </exec>
   263       </then>
   262             </then>
   264     </if>
   263         </if>
   265   </target>
   264     </target>
       
   265 
   266     <target name="sf-build-noprep" depends="sf-compile">
   266     <target name="sf-build-noprep" depends="sf-compile">
   267         <echo>[SF-BUILD-NOPREP]</echo>
   267         <echo>[SF-BUILD-NOPREP]</echo>
   268     </target>
   268     </target>
   269     
   269     
   270     <target name="create-canonical-sysdef-file">
   270     <target name="create-canonical-sysdef-file">
   271       <if>
   271         <if>
   272         <istrue value="${sf.spec.systemdefinition.assemble}"/>
   272             <istrue value="${sf.spec.systemdefinition.assemble}"/>
   273         <then>
   273             <then>
   274           <echo message="Calling Helium create-canonical-sysdef-file target to assemble sysdef fragments."/>
   274                 <echo message="Calling Helium create-canonical-sysdef-file target to assemble sysdef fragments."/>
   275           <runtarget target="compile.create-canonical-sysdef-file"/>
   275                 <runtarget target="compile.create-canonical-sysdef-file"/>
   276         </then>
   276             </then>
   277         <else>
   277             <else>
   278           <echo message="Will use ${build.drive}/${sf.spec.systemdefinition.location} as is as sysdef file"/>
   278                 <echo message="Will use ${build.drive}/${sf.spec.systemdefinition.location} as is as sysdef file"/>
   279           <copy file="${build.drive}/${sf.spec.systemdefinition.location}" tofile="${build.drive}/output/build/canonical_system_definition.xml" failonerror="true" verbose="true"/>
   279                 <copy file="${build.drive}/${sf.spec.systemdefinition.location}" tofile="${build.drive}/output/build/canonical_system_definition.xml" failonerror="true" verbose="true"/>
   280         </else>
   280             </else>
   281       </if>
   281         </if>
   282     </target>
   282     </target>
   283     
   283     
   284     <target name="sf-compile">    
   284     <target name="sf-compile">    
   285     
   285         <!-- TODO: add here assigments to raptor-related ant references -->
   286     	<!-- TODO: add here assigments to raptor-related ant references -->
   286     
   287  	
   287         <!-- hlm:argSet id="sbs.tools.var">
   288     	<!-- hlm:argSet id="sbs.tools.var">
   288             <hlm:arg name="config" value="${sf.spec.sbs.config}" />
   289 			<hlm:arg name="config" value="${sf.spec.sbs.config}" />
   289             <hlm:arg name="singlejob" value="..." />
   290 			<hlm:arg name="singlejob" value="..." />
   290             <hlm:arg name="enable-filter" value="..." />
   291 			<hlm:arg name="enable-filter" value="..." />
   291         </hlm:argSet -->
   292 		</hlm:argSet -->
   292         
   293     	
       
   294         <!-- target name="compile-main-prebuild" -->
   293         <!-- target name="compile-main-prebuild" -->
   295         <antcall target="compile-main" inheritAll="false">
   294         <antcall target="compile-main" inheritAll="false">
   296             <param name="build.system" value="${sf.spec.build.system}"/>
   295             <param name="build.system" value="${sf.spec.build.system}"/>
   297             <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
   296             <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
   298             <!--<reference refid="sf.system.definition.files" torefid="system.definition.files" />-->
   297             <!--<reference refid="sf.system.definition.files" torefid="system.definition.files" />-->
   302     <target name="sf-get-source" depends="sf-generate-source-spec">
   301     <target name="sf-get-source" depends="sf-generate-source-spec">
   303         <ant antfile="${sf.common.config.dir}/generated/source-spec.ant.xml" />
   302         <ant antfile="${sf.common.config.dir}/generated/source-spec.ant.xml" />
   304     </target>
   303     </target>
   305     
   304     
   306     <target name="sf-tag-hg-code">
   305     <target name="sf-tag-hg-code">
   307       <property name="sf.tagafterbuild.tag" value="${sf.spec.job.name}_${sf.spec.job.codeline}.${sf.spec.job.number}"/>
   306         <property name="sf.tagafterbuild.tag" value="${sf.spec.job.name}_${sf.spec.job.codeline}.${sf.spec.job.number}"/>
   308       <fmpp sourceFile="${sf.common.config.dir}/templates/tag-hg-code.ant.xml.ftl"
   307         <fmpp sourceFile="${sf.common.config.dir}/templates/tag-hg-code.ant.xml.ftl"
   309             outputFile="${sf.common.config.dir}/generated/tag-hg-code.ant.xml">
   308               outputFile="${sf.common.config.dir}/generated/tag-hg-code.ant.xml">
   310         <data expandProperties="yes">
   309             <data expandProperties="yes">
   311               ant: antProperties()
   310                 ant: antProperties()
   312               data: csv(${sf.project.location}/${sf.spec.sourcesync.sourcespecfile}, {separator:','})
   311                 data: csv(${sf.project.location}/${sf.spec.sourcesync.sourcespecfile}, {separator:','})
   313         </data>
   312             </data>
   314       </fmpp>
   313         </fmpp>
   315       <ant antfile="${sf.common.config.dir}/generated/tag-hg-code.ant.xml"/>
   314         <ant antfile="${sf.common.config.dir}/generated/tag-hg-code.ant.xml"/>
   316     </target>
   315     </target>
   317     
   316     
   318     <target name="sf-diamondize-bom">
   317     <target name="sf-diamondize-bom">
   319       <fmpp sourceFile="${sf.common.config.dir}/templates/build-info.xml.ftl"
   318         <fmpp sourceFile="${sf.common.config.dir}/templates/build-info.xml.ftl"
   320             outputFile="${build.drive}/output/logs/BOM/build-info.xml">
   319               outputFile="${build.drive}/output/logs/BOM/build-info.xml">
   321         <data expandProperties="yes">
   320             <data expandProperties="yes">
   322               ant: antProperties()
   321                 ant: antProperties()
   323               config: csv(${build.drive}/output/logs/BOM/config.csv,{separator:',',headers:[loc,dst,rev]})
   322                 config: csv(${build.drive}/output/logs/BOM/config.csv,{separator:',',headers:[loc,dst,rev]})
   324               project: csv(${build.drive}/output/logs/BOM/project.csv,{separator:',',headers:[loc,dst,rev]})
   323                 project: csv(${build.drive}/output/logs/BOM/project.csv,{separator:',',headers:[loc,dst,rev]})
   325               baseline: slicedText(${build.drive}/output/logs/BOM/baseline.txt,{trim})
   324                 baseline: slicedText(${build.drive}/output/logs/BOM/baseline.txt,{trim})
   326               sources: csv(${build.drive}/output/logs/BOM/sources.csv,{separator:',',headers:[loc,dst,rev]})              
   325                 sources: csv(${build.drive}/output/logs/BOM/sources.csv,{separator:',',headers:[loc,dst,rev]})              
   327         </data>
   326             </data>
   328       </fmpp>
   327         </fmpp>
   329     </target>
   328     </target>
   330 
   329 
   331 	<target name="sf-preprocess-package-config">
   330     <target name="sf-preprocess-package-config">
   332         <exec executable="perl" dir="${build.drive}/" failonerror="false" output="${build.log.dir}/zipconfig.log">
   331         <exec executable="perl" dir="${build.drive}/" failonerror="false" output="${build.log.dir}/zipconfig.log">
   333           <arg value="${sf.common.config.dir}/tools/populateziptemplate.pl"/>
   332             <arg value="${sf.common.config.dir}/tools/populateziptemplate.pl"/>
   334           <arg value="${sf.project.location}/${sf.spec.sourcesync.sourcespecfile}"/>
   333             <arg value="${sf.project.location}/${sf.spec.sourcesync.sourcespecfile}"/>
   335           <arg value="${sf.common.config.dir}/templates/zip.cfg.xml.ftl.template"/>
   334             <arg value="${sf.common.config.dir}/templates/zip.cfg.xml.ftl.template"/>
   336         </exec>
   335             <arg value="${sf.common.config.dir}/generated/zip.cfg.xml.ftl"/>
   337 	</target>
   336         </exec>
   338 	
   337     </target>
   339 	<target name="sf-zip-content" depends="preprocess-zip-config">
   338     
   340 		<property name="zip.${zip.target.name}.log.file" location="${build.log.dir}/${build.id}_${zip.target.name}_zip.log" />
   339     <target name="sf-zip-content" depends="preprocess-zip-config">
   341 		<property name="zips.${zip.target.name}.spec.name" value="${zip.target.name}" />
   340         <property name="zip.${zip.target.name}.log.file" location="${build.log.dir}/${build.id}_${zip.target.name}_zip.log" />
   342 		<hlm:zipContentMacro type="${zip.target.name}" file="${zip.config.file}" />
   341         <property name="zips.${zip.target.name}.spec.name" value="${zip.target.name}" />
   343 	</target>
   342         <hlm:zipContentMacro type="${zip.target.name}" file="${zip.config.file}" />
   344 	
   343     </target>
   345 	<target name="sf-package-source" depends="sf-preprocess-package-config">
   344     
   346 		<antcall target="sf-zip-content">
   345     <target name="sf-package-source" depends="sf-preprocess-package-config">
   347 			<param name="zip.config.file" value="${sf.common.config.dir}/templates/zip.cfg.xml.ftl"/>
   346         <antcall target="sf-zip-content">
   348 			<param name="zip.target.name" value="src" />
   347             <param name="zip.config.file" value="${sf.common.config.dir}/generated/zip.cfg.xml.ftl"/>
   349 		</antcall>	
   348             <param name="zip.target.name" value="src" />
   350 	</target>
   349         </antcall>
   351 	
   350     </target>
   352 	<target name="sf-package-binary" depends="sf-preprocess-package-config">
   351     
   353 		<antcall target="sf-zip-content">
   352     <target name="sf-package-binary" depends="sf-preprocess-package-config">
   354 		    <param name="zip.config.file" value="${sf.common.config.dir}/templates/zip.cfg.xml.ftl"/>
   353         <antcall target="sf-zip-content">
   355 			<param name="zip.target.name" value="bin" />
   354             <param name="zip.config.file" value="${sf.common.config.dir}/generated/zip.cfg.xml.ftl"/>
   356 		</antcall>	
   355             <param name="zip.target.name" value="bin" />
   357 	</target>
   356         </antcall>
   358 	
   357     </target>
       
   358 
   359 </project>
   359 </project>
   360 
   360 
   361