buildframework/helium/tools/compile/cmaker.ant.xml
author andy simpson <andrews@symbian.org>
Fri, 30 Jul 2010 15:14:33 +0100
changeset 622 c26070468a42
parent 588 c7c26511138f
child 628 7c4a911dc066
permissions -rw-r--r--
Add export for s60ibymacros.pm (re-applies missing part of fix for Bug 2901

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : cmaker.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.cmaker" xmlns:hlm="http://www.nokia.com/helium">
    <description>
        cMaker support.
    </description>
    
    <!-- Location of the cmaker component to install it.
    @type string
    @scope private
    -->
    <property name="cmaker.component.dir" location="${build.drive}/tools/cmaker"/>
    <!-- Directory where to execute cMaker.
    @type string
    @scope private
    -->
    <property name="cmaker.config.dir" location="${build.drive}/config"/>
    <!-- Version of PP(NCP) configuration to be exported
    @type string
    -->
    <property name="cmaker.pp.version" value=""/>
    <!-- Version of S60(require cmaker.pp.version to be set) configuration to be exported
    @type string
    -->
    <property name="cmaker.s60.version" value=""/>
    <!-- Custom label added to the cmaker logs.
    @type string
    -->
    <property name="cmaker.log.label" value=""/>

    <!--
        The cmakerMacro enables the user to run cmaker commands directly from Ant.
        To configure it just provide NCP and S60 version and the action you want to run.
        Default action is WHAT.
        
        e.g
        <pre>
            <hlm:cmakerMacro ncp="53" s60="32" action="export"/>
        </pre>
    -->
    <macrodef name="cmakerMacro" uri="http://www.nokia.com/helium">
        <attribute name="ncp" default=""/>
        <attribute name="s60" default=""/>
        <attribute name="action" default="what"/>
        <sequential>
            <var name="temp.cmaker.arg1" value="NCP="/>
            <var name="temp.cmaker.arg2" value="S60="/>
            <if>
                <not>
                    <equals arg1="@{ncp}" arg2="" />
                </not>
                <then>
                    <var name="temp.cmaker.arg1" value="NCP=@{ncp}"/>
                </then>
            </if>
            <if>
                <not>
                    <equals arg1="@{s60}" arg2="" />
                </not>
                <then>
                    <var name="temp.cmaker.arg2" value="S60=@{s60}"/>
                </then>
            </if>
            <hlm:symbianLogHeaderMacro command="cmaker ${temp.cmaker.arg1} ${temp.cmaker.arg2} ACTION=@{action}"
                    config="CMAKER_@{action}" dir="${cmaker.config.dir}"/>
            <exec executable="${build.drive}/epoc32/tools/cmaker.cmd" osfamily="windows" dir="${cmaker.config.dir}">
                <arg line="${temp.cmaker.arg1}" />
                <arg line="${temp.cmaker.arg2}" />
                <arg value="ACTION=@{action}" />
            </exec>
            <exec executable="${build.drive}/epoc32/tools/cmaker.sh" osfamily="unix" dir="${cmaker.config.dir}">
                <arg line="${temp.cmaker.arg1}" />
                <arg line="${temp.cmaker.arg2}" />
                <arg value="ACTION=@{action}" />
            </exec>
            <hlm:symbianLogFooterMacro/>
        </sequential>
    </macrodef>
    
    <!--  Installing CMaker. -->    
    <target name="cmaker-install">
        <mkdir dir="${compile.log.dir}" />
        <record name="${compile.log.dir}/${build.id}_install.cmaker.log" emacsmode="true" action="start" />
        <exec executable="${cmaker.component.dir}/bin/mingw_make.exe" osfamily="windows" dir="${cmaker.component.dir}" failonerror="true">
            <arg line="install"/>
        </exec>
        <exec executable="make" osfamily="unix" dir="${cmaker.component.dir}" failonerror="true">
            <arg line="install"/>
        </exec>
        <record name="${compile.log.dir}/${build.id}_install.cmaker.log" action="stop" />
        <!-- 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=cmaker" />
                    <arg value="-Dwhatlog=${compile.log.dir}/${build.id}_install.cmaker.log" />
                    <arg value="-Dconfigdir=${cmaker.component.dir}" />
                    <arg value="--updateData" />
                </exec>
            </then>
        </if>
    </target>
    
    <!-- CMaker export configuration. -->    
    <target name="cmaker-export" depends="cmaker-install" if="enable.cmaker">
        <mkdir dir="${compile.log.dir}" />
        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.export.cmaker.log" emacsmode="true" action="start" />
        <hlm:cmakerMacro ncp="${cmaker.pp.version}"
                      s60="${cmaker.s60.version}"
                      action="export"/>
        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.export.cmaker.log" action="stop" />
        <hlm:metadatarecord database="${metadata.dbfile}">
            <hlm:abldmetadatainput>
                <fileset casesensitive="false" file="${compile.log.dir}/${build.id}${cmaker.log.label}.export.cmaker.log" />
                <metadatafilterset refid="filterset.compile" />
            </hlm:abldmetadatainput>
        </hlm:metadatarecord>
    </target>

    <!-- CMaker cleanup exported configuration. -->
    <target name="cmaker-clean" depends="cmaker-install" if="enable.cmaker">
        <mkdir dir="${compile.log.dir}" />
        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.clean.cmaker.log" emacsmode="true" action="start" />
        <hlm:cmakerMacro ncp="${cmaker.pp.version}"
                      s60="${cmaker.s60.version}"
                      action="clean"/>
        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.clean.cmaker.log" action="stop" />
        <hlm:metadatarecord database="${metadata.dbfile}">
            <hlm:abldmetadatainput>
                <fileset casesensitive="false" file="${compile.log.dir}/${build.id}${cmaker.log.label}.clean.cmaker.log" />
                <metadatafilterset refid="filterset.compile" />
            </hlm:abldmetadatainput>
        </hlm:metadatarecord>
    </target>
    
    <!-- CMaker list the final destination of what will be exported. -->
    <target name="cmaker-what" depends="cmaker-install" if="enable.cmaker">
        <mkdir dir="${compile.log.dir}" />
        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" emacsmode="true" action="start" />
        <hlm:cmakerMacro ncp="${cmaker.pp.version}"
                      s60="${cmaker.s60.version}"
                      action="what"/>
        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" action="stop" />
        <hlm:metadatarecord database="${metadata.dbfile}">
            <hlm:abldmetadatainput>
                <fileset casesensitive="false" file="${compile.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" />
                <metadatafilterset refid="filterset.compile" />
            </hlm:abldmetadatainput>
        </hlm:metadatarecord>

        <!-- 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=cmaker" />
                    <arg value="-Dwhatlog=${compile.log.dir}/${build.id}${cmaker.log.label}.what.cmaker.log" />
                    <arg value="-Dconfigdir=${cmaker.config.dir}" />
                    <!--arg value="-Dname=${cmaker.log.label}"-->
                    <arg value="--updateData" />
                </exec>
            </then>
        </if>
    </target>

    <!-- CMaker list the source files what will be exported. -->
    <target name="cmaker-whatdeps" depends="cmaker-install" if="enable.cmaker">
        <mkdir dir="${compile.log.dir}" />
        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.whatdeps.cmaker.log" emacsmode="true" action="start" />
        <hlm:cmakerMacro ncp="${cmaker.pp.version}"
                      s60="${cmaker.s60.version}"
                      action="what_deps"/>
        <record name="${compile.log.dir}/${build.id}${cmaker.log.label}.whatdeps.cmaker.log" action="stop" />
        <hlm:metadatarecord database="${metadata.dbfile}">
            <hlm:abldmetadatainput>
                <fileset casesensitive="false" file="${compile.log.dir}/${build.id}${cmaker.log.label}.whatdeps.cmaker.log" />
                <metadatafilterset refid="filterset.compile" />
            </hlm:abldmetadatainput>
        </hlm:metadatarecord>
    </target>
</project>