common/build.xml
author DarioS@UK-DarioS.symbian.int
Wed, 08 Apr 2009 11:59:04 +0100
changeset 47 d835e951a925
parent 41 f137ddbb714d
child 56 68c06bb4fbe2
permissions -rw-r--r--
New implementation of generation of BOM sources.csv

<?xml version="1.0" encoding="UTF-8"?>
<project name="SF-COMMON-CONFIG">

    <property environment="env"/> <!-- make environment variables available via env -->
    
    <dirname property="sf.common.config.dir" file="${ant.file.SF-COMMON-CONFIG}"/>
    
    <!-- import common properties -->
    <import file="${sf.common.config.dir}/common_props.ant.xml" />
    
    <!-- setup Helium internal properties from their equivalent in the project spec -->
    <property name="build.name" value="${sf.spec.job.name}"/>
    <property name="core.build.version" value="${sf.spec.job.codeline}"/>
    <property name="build.number" value="${sf.spec.job.number}"/>
    <property name="build.drive" value="${sf.spec.job.drive}"/>
    <property name="build.family" value="${sf.project.type}"/>
    <property name="email.from" value="${sf.spec.email.from}"/>
    <property name="local.free.space" value="${sf.spec.job.freespace}"/>
    <property name="network.free.space" value="${sf.spec.publish.network.freespace}"/>
    <property name="network.drive" value="${sf.spec.publish.networkdrive}"/>
    <property name="prep.root.dir" value="${sf.spec.job.rootdir}"/>
    <property name="publish" value="${sf.spec.publish.enable}"/>
    <property name="publish.root.dir" value="${sf.spec.publish.rootdir}"/>
    <property name="build.system" value="${sf.spec.build.system}"/>
    <property name="base_release.path" value="${sf.spec.baseline.location}"/>
    <property name="base_release.getenv_options" value="${sf.spec.baseline.getenv_options}"/>
    
    <!-- import all core HELIUM targets -->
    <import file="${helium.dir}/helium.ant.xml" />
    
    <!-- import common references -->
    <import file="${sf.common.config.dir}/common_refs.ant.xml" />
             
    <!-- conditional import of generated source spec if available -->
    <if><available  file="${sf.common.config.dir}/generated/source-spec.ant.xml" />
        <then>		    		
            <echo message="Generated source spec found, importing..." />
    				<import file="${sf.common.config.dir}/generated/source-spec.ant.xml"/>
    		</then>
    </if>
    
    <!--
    ** TARGET DEFINITIONS
    -->   
    
    <target name="sf-prep" depends="sf-generate-source-spec,prep-drive,init-build-area,check-tool-dependencies,create-bom,log-build-env">
        <echo>[SF-PREP]</echo>
        <tempfile property="prep.dynamic.config" suffix="ant.xml" destdir="${temp.build.dir}"/>
    </target>
        
    <target name="sf-build-all" depends="sf-prebuild,sf-build-noprep,sf-postbuild">
        <echo>[SF-BUILD-ALL]</echo>
    </target>
    
    <target name="sf-build" depends="sf-prep,sf-prebuild,sf-build-noprep,sf-postbuild">
        <echo>[SF-BUILD]</echo>
    </target>
    
    <target name="sf-parse-project-config">
    <!-- TODO: Parse the project config and generate properties and csv file to be
    used by the builds. -->
        <echo message="Parse the project configuration" />
    </target>
    
    <target name="sf-generate-source-spec" depends="sf-parse-project-config">
        <!-- TODO: 1. Same file name souce-spec.ant.xml is used for all packages
        for multiple package builds, this needs to be linked with package name. -->
        <!-- TODO: 2. Change fmpp data to be a full property rather than relative path -->
        
        <fmpp sourceFile="${sf.common.config.dir}/templates/source-spec.ant.xml.ftl"
              outputFile="${sf.common.config.dir}/generated/source-spec.ant.xml">
              <data expandProperties="yes">
                    ant: antProperties()
                    data: csv(${sf.project.location}/${sf.spec.sourcesync.sourcespecfile}, {separator:','})
              </data>
        </fmpp>
    </target>
    
    <target name="sf-prebuild">
        <echo>[SF-PREBUILD]</echo>
        
        <!-- create BOM dir -->
        <mkdir dir="${build.drive}/output/BOM"/>
        
        <if>
            <istrue value="${sf.spec.baseline.enable}" />
            <then>
                <runtarget target="preparation-getenv"/>
            </then>
        </if>
        
        <if>
            <istrue value="${sf.spec.sourcesync.enable}" />
            <then>
                <runtarget target="sf-get-source"/>
            </then>
        </if>     
    </target>
    
  <target name="sf-postbuild">
    <echo>[SF-POSTBUILD]</echo>
    
    <!-- TAG SOURCE CODE -->
    <if>
      <istrue value="${sf.spec.tagafterbuild.enable}" />
      <then>
        <echo message="Apply tag to the source code used in this build"/>
        <runtarget target="sf-tag-hg-code"/>
      </then>
    </if>

    <!-- PUBLISH LOGS/REPORTS -->
    <if>
      <istrue value="${sf.spec.publish.enable}" />
      <then>
        <echo message="Publish log files and reports to ${sf.spec.publish.rootdir}"/>
        <runtarget target="publish"/>
      </then>
    </if>
    
  </target>
    
    <target name="sf-build-noprep" depends="sf-compile">
        <echo>[SF-BUILD-NOPREP]</echo>
    </target>
    
    <target name="create-canonical-sysdef-file">
      <if>
        <istrue value="${sf.spec.systemdefinition.assemble}"/>
        <then>
          <echo message="Calling Helium create-canonical-sysdef-file target to assemble sysdef fragments."/>
          <runtarget target="compile.create-canonical-sysdef-file"/>
        </then>
        <else>
          <echo message="Will use ${build.drive}/${sf.spec.systemdefinition.location} as is as sysdef file"/>
          <copy file="${build.drive}/${sf.spec.systemdefinition.location}" tofile="${build.drive}/output/build/canonical_system_definition.xml" failonerror="true" verbose="true"/>
        </else>
      </if>
    </target>
    
    <target name="sf-compile">    
    
    	<!-- TODO: add here assigments to raptor-related ant references -->
 	
    	<!-- hlm:argSet id="sbs.tools.var">
			<hlm:arg name="config" value="${sf.spec.sbs.config}" />
			<hlm:arg name="singlejob" value="..." />
			<hlm:arg name="enable-filter" value="..." />
		</hlm:argSet -->
    	
        <!-- target name="compile-main-prebuild" -->
        <antcall target="compile-main" inheritAll="false">
            <param name="build.system" value="${sf.spec.build.system}"/>
            <param name="sysdef.configurations.list" value="${sf.spec.sysdef.configurations.list}" />
            <!--<reference refid="sf.system.definition.files" torefid="system.definition.files" />-->
        </antcall>    
    </target>
    
    <target name="sf-get-source" depends="sf-generate-source-spec">
        <ant antfile="${sf.common.config.dir}/generated/source-spec.ant.xml" />
    </target>
    
    <target name="sf-tag-hg-code">
      <property name="sf.tagafterbuild.tag" value="${sf.spec.job.name}_${sf.spec.job.codeline}.${sf.spec.job.number}"/>
      <fmpp sourceFile="${sf.common.config.dir}/templates/tag-hg-code.ant.xml.ftl"
            outputFile="${sf.common.config.dir}/generated/tag-hg-code.ant.xml">
        <data expandProperties="yes">
              ant: antProperties()
              data: csv(${sf.project.location}/${sf.spec.sourcesync.sourcespecfile}, {separator:','})
        </data>
      </fmpp>
      <ant antfile="${sf.common.config.dir}/generated/tag-hg-code.ant.xml"/>
    </target>

</project>