Merge : re-applies missing part of fix for Bug 2901,Add export for s60ibymacros.pm
<?xml version="1.0" encoding="UTF-8"?>
<!--
============================================================================
Name : sbs.ant.xml
Part of : Helium
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
This component and the accompanying materials are made available
under the terms of the License "Eclipse Public License v1.0"
which accompanies this distribution, and is available
at the URL "http://www.eclipse.org/legal/epl-v10.html".
Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
Description:
============================================================================
-->
<!--* @package compile -->
<project name="compile.sbs" xmlns:hlm="http://www.nokia.com/helium">
<description>
Executes compilation of a System Model of System Definition file using Symbian SBS (Raptor) tools.
</description>
<!--
Executes compilation of a System Model of System Definition file using Symbian SBS (Raptor) tools.
Should not be called directly but through compile-main by setting ${build.system.sbs} property.
-->
<!--* @property sbs.build.ctc
This property enables Raptor compilation using ctc.
@type boolean
@scope public
-->
<!--* @property schema.new
This property enables sbs compilation based on system definition schema 3.0.0.
@type boolean
@scope public
-->
<!-- This property enables sbs layer filtering of the canonical system definition file
for system definition schema 1.4.0 using ${sysdef.configuration}.
@type boolean
-->
<property name="sbs.layer.generation.enabled" value="true" />
<!-- Default CTC command line option, override it to customize it. -->
<hlm:argSet id="ctc.build.options" />
<!-- This property define what instrumentation CTC should create.
@type string
-->
<property name="ctc.instrument.type" value="m" />
<!-- This target filters the canonical system definition file compare to the "raptor_${sysdef.configuration}" filter. -->
<macrodef name="generate-layers" uri="http://www.nokia.com/helium">
<sequential>
<echo message="canno-file:${canonical.sysdef.file}" />
<echo message="raptor-filters:raptor_${sysdef.configuration}" />
<if>
<isfalse value="${sbs.layer.generation.enabled}" />
<then>
<if>
<isreference refid="sysdef.layers.${sysdef.configuration}" />
<then>
<property name="sbs.patternset" value="sysdef.filters.${sysdef.configuration}" />
<echo message="sbs.patternset: ${sbs.patternset}" />
</then>
<else>
<echo message="The sysdef.layers.${sysdef.configuration} pattern set is not defined." />
</else>
</if>
<copy file="${canonical.sysdef.file}" tofile="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}_temp.xml"/>
</then>
<else>
<hlm:compileGenxmlFilterMacro input="${canonical.sysdef.file}" filter="raptor_${sysdef.configuration}"
output="${build.output.dir}/build/canonical_system_definition_${sysdef.configuration}_temp.xml"/>
</else>
</if>
<copy file="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}_temp.xml"
tofile="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}.xml">
<filterchain>
<linecontainsregexp negate="true">
<regexp pattern="^\s*$"/>
</linecontainsregexp>
</filterchain>
</copy>
<delete file="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}_temp.xml"/>
</sequential>
</macrodef>
<!-- SBS build with gmake as engine type. Default is using sbs macro, to use old implementation to
use using exec task, then sbs.using.exec needs to be set. -->
<target name="compile-sbs" description="This is the main build that gets built for ARMV5 and WINSCW platforms">
<!-- only temporary once config file option starts to work, then no
need to copy the plugin file -->
<if>
<or>
<equals arg1="${build.system}" arg2="sbs" />
<equals arg1="${build.system}" arg2="sbs-ec" />
</or>
<then>
<echo message="Copying helium filter plugin to sbs home" />
<copy file="${helium.dir}/tools/common/python/scripts/filter_metadatalog.py" todir="${env.SBS_HOME}/python/plugins/" failonerror="true" />
<copy file="${helium.dir}/tools/common/python/scripts/sbsscanlogmetadata.py" todir="${env.SBS_HOME}/python/plugins/" failonerror="true" />
<var name="sbs.internal.inputs.list" value="" unset="true"/>
<if>
<istrue value="${schema.new}" />
<then>
<hlm:downgradeSysdef epocroot="${build.drive}/" srcfile="${canonical.sysdef.file}"
destfile="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}.xml"/>
<var name="sbs.patternset" unset="true"/>
<if>
<isreference refid="sysdef.filters.${sysdef.configuration}" />
<then>
<property name="sbs.patternset" value="sysdef.filters.${sysdef.configuration}" />
<echo message="sbs.patternset: ${sbs.patternset}" />
</then>
<else>
<echo message="The sysdef.filters.${sysdef.configuration} patternset is not defined." />
</else>
</if>
</then>
<else>
<var name="sbs.patternset" unset="true"/>
<if>
<isreference refid="sysdef.layers.${sysdef.configuration}" />
<then>
<property name="sbs.patternset" value="sysdef.filters.${sysdef.configuration}" />
<echo message="sbs.patternset: ${sbs.patternset}" />
<copy file="${canonical.sysdef.file}" tofile="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}.xml" />
</then>
<else>
<echo message="The sysdef.layers.${sysdef.configuration} patternset is not defined." />
<hlm:generate-layers />
</else>
</if>
</else>
</if>
<hlm:getsbsinputs config="sbs.${sysdef.configuration}" outputProperty="sbs.internal.inputs.list"/>
<for list="${sbs.internal.inputs.list}" delimiter="," param="sbs.input">
<sequential>
<echo message="building raptor input: @{sbs.input}" />
<var name="sbs.log.file" unset="true" />
<property name="sbs.log.file" location="${compile.log.dir}/${build.id}_${sysdef.configuration}_@{sbs.input}_compile.log" />
<!-- run arm license checking / setting arm version only for arm config -->
<hlm:getVariableValue name="-c" property="compilevalue.var" failOnerror="false">
<hlm:sbsinput refid="@{sbs.input}" />
</hlm:getVariableValue>
<echo message="config parameter -c : ${compilevalue.var}" />
<if>
<and>
<isset property="compilevalue.var"/>
<matches string="${compilevalue.var}" pattern="arm.*"/>
</and>
<then>
<runtarget target="set-arm-version"/>
</then>
</if>
<!-- Generate the filtered layers -->
<if>
<isset property="run.coverity"/>
<then>
<hlm:coveritybuild sbsinput="@{sbs.input}"
sysdeffile="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}.xml"
layerpatternsetref="${sbs.patternset}"
workingdir="${build.drive}/"
execute="true"
failonerror="false"
outputlog="${sbs.log.file}"
erroroutput="${sbs.log.file}.sbs_error.log">
<hlm:coverityoptions refid="coverity.build.options"/>
</hlm:coveritybuild>
</then>
<elseif>
<istrue value="${sbs.build.ctc}"/>
<then>
<hlm:ctctask sbsinput="@{sbs.input}"
sysdefFile="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}.xml"
layerPatternSetRef="${sbs.patternset}"
errorOutput="${sbs.log.file}.sbs_error.log"
workingDir="${build.drive}/"
failOnError="false"
outputLog="${sbs.log.file}"
instrumentType="${ctc.instrument.type}">
<hlm:CTCOptions refid="ctc.build.options" />
</hlm:ctctask>
</then>
</elseif>
<else>
<hlm:sbstask sbsinput="@{sbs.input}"
sysdefFile="${build.drive}/output/build/canonical_system_definition_${sysdef.configuration}.xml"
layerPatternSetRef="${sbs.patternset}"
errorOutput="${sbs.log.file}.sbs_error.log"
workingDir="${build.drive}/"
failOnError="false"
outputLog="${sbs.log.file}" />
</else>
</if>
<hlm:assertFileExists file="${sbs.log.file}"/>
<hlm:assertFileExists file="${sbs.log.file}.sbs_error.log"/>
<!-- run arm license checking / setting arm version only for arm config -->
<echo message="sbs.log.file: ${sbs.log.file}" />
<hlm:sbsProcessOutputMacro sbs.log.file="${sbs.log.file}"
sbs.ant.output.file="${sbs.log.file}" sbs.error.output.file="${sbs.log.file}.sbs_error.log"/>
</sequential>
</for>
</then>
</if>
</target>
<macrodef name="sbsProcessOutputMacro" uri="http://www.nokia.com/helium">
<attribute name="sbs.log.file" />
<attribute name="sbs.error.output.file" />
<attribute name="sbs.ant.output.file" />
<sequential>
<var name="sbs.scan2.template" value="scan2_orm.html.ftl" />
<var name="base.sbs.log" value="" unset="true"/>
<basename property="base.sbs.log" file="@{sbs.log.file}" />
<echo message="base.sbs.log: ${base.sbs.log}" />
<hlm:metadatarecord database="${metadata.dbfile}">
<hlm:textmetadatainput>
<fileset casesensitive="false" file="@{sbs.error.output.file}"/>
<metadatafilterset refid="filterset.sbs.cli" />
</hlm:textmetadatainput>
</hlm:metadatarecord>
<basename property="base.sbs.ant.output.log" file="@{sbs.ant.output.file}" />
<hlm:signalMacro logfile="@{sbs.error.output.file}"
signal.input="raptorErrorSignalInput" phase="compile"/>
<!-- update the resultes to database -->
<echo message="Metadata enabled, storing build status in database" />
<echo message="sbs log file :@{sbs.log.file}" />
<trycatch property="hlm-sbs.parser.thrown">
<try>
<hlm:metadatarecord database="${metadata.dbfile}">
<hlm:sbsmetadatainput>
<fileset casesensitive="false" file="@{sbs.log.file}"/>
<metadatafilterset refid="filterset.sbs" />
</hlm:sbsmetadatainput>
</hlm:metadatarecord>
</try>
<catch>
<if>
<istrue value="${skip.sbs.parser.exception}" />
<then>
<var name="sbs.scan2.template" value="scan2_text_orm.html.ftl" />
<hlm:metadatadelete database="${metadata.dbfile}">
<fileset casesensitive="false" file="@{sbs.log.file}"/>
</hlm:metadatadelete>
<hlm:metadatarecord database="${metadata.dbfile}" >
<hlm:textmetadatainput>
<fileset casesensitive="false" file="@{sbs.log.file}"/>
<metadatafilterset refid="filterset.sbs" />
</hlm:textmetadatainput>
</hlm:metadatarecord>
</then>
<else>
<loadfile property="sbs.error.output" srcfile="@{sbs.error.output.file}" failonerror="false"/>
<fail message="failed during raptor log parsing: might be due to invalid xml output from raptor ${hlm-sbs.parser.thrown}. ${sbs.error.output}" />
</else>
</if>
</catch>
</trycatch>
<fmpp sourceFile="${helium.dir}/tools/common/templates/log/${sbs.scan2.template}"
outputfile="${build.log.dir}/${base.sbs.log}.scan2.html">
<freemarkerLinks expandProperties="yes">
macro: ${helium.dir}/tools/common/templates/macro
</freemarkerLinks>
<data expandProperties="yes">
dbPath: ${metadata.dbfile}
logfilename: @{sbs.log.file}
ant: antProperties()
</data>
</fmpp>
<echo message="generating signal" />
<hlm:assertFileExists file="${build.log.dir}/${base.sbs.log}.scan2.html"/>
<hlm:compileLogSignalMacro compile.summary.file="@{sbs.log.file}"
error.limit="${build.errors.limit}" phase="compile"/>
<!-- Blocks packaging configuration generation. -->
<if>
<istrue value="${blocks.enabled}" />
<then>
<mkdir dir="${blocks.config.dir}" />
<exec executable="python">
<arg value="-m"/>
<arg value="packager.cli"/>
<arg value="--epocroot=${build.drive}/" />
<arg value="--config=${blocks.config.dir}" />
<arg value="--datasource=sbs" />
<arg value="-Dsbslog=${sbs.log.file}" />
<arg value="-Dsysdef=${canonical.sysdef.file}" />
<arg value="-Dthreads=20" />
<arg value="--updateData" />
</exec>
</then>
</if>
</sequential>
</macrodef>
<scriptdef language="jython" name="getSbsHome" uri="http://www.nokia.com/helium">
<attribute name="property" />
if attributes.get("property") is None:
raise Exception("property attribute has not been set.")
if project.getProperty(attributes.get("property")) is None:
import symbian.raptor
sbs_home = symbian.raptor.getSBSHome()
if sbs_home is not None:
#self.log("Found SBS_HOME as " + sbs_home)
project.setNewProperty(attributes.get("property"), sbs_home)
</scriptdef>
</project>