buildframework/helium/builder/python/macros.ant.xml
author jascui
Wed, 17 Nov 2010 13:39:15 +0800
changeset 687 da9e6195bd8d
parent 628 7c4a911dc066
permissions -rw-r--r--
Updating release text and product version

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : build.xml 
Part of     : Helium AntLib

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:

============================================================================
-->
<project name="helium-python-builder" xmlns:ivy="antlib:org.apache.ivy.ant"
  xmlns:contrib="antlib:net.sf.antcontrib">
  
    <property name="bin.dir" location="${builder.dir}/../build/${ant.project.name}" />
    <import file="../java/common.ant.xml" />
    <dirname property="python.builder.dir" file="${ant.file.helium-python-builder}" />
    <property name="nose.result.dir" location="${module.temp.dir}/xunit/nose" />

    <target name="resolve">
        <mkdir dir="${lib.dir}" />
        <mkdir dir="${lib.dir}/zipsafe" />
        <mkdir dir="${lib.dir}/zipnotsafe" />
        <delete dir="${lib.dir}/zipnotsafe" includes="**/*" />
        
        <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
        
        <!-- the call to resolve is not mandatory, retrieve makes an implicit call if we don't -->
        <ivy:resolve file="${ivy.file}" log="download-only"/>
        <ivy:retrieve pattern="${lib.dir}/zipsafe/[artifact].[ext]" type="egg" log="download-only"/>
        <ivy:retrieve pattern="${lib.dir}/zipsafe/[artifact].[ext]" type="py" log="download-only"/>
        <ivy:retrieve pattern="${lib.dir}/[artifact].[ext]" type="jar" log="download-only"/>
    </target>

    <target name="checkstyle"/>
    <target name="junit"/>
    <target name="quality"/>

    <target name="package" depends="clean,resolve">
        <mkdir dir="${module.bin.dir}" />
        <exec executable="python" failonerror="true" dir="${basedir}">
            <env key="PYTHONPATH" path="${python.builder.dir}/lib/setuptools-0.6c11-py2.5.egg" />
            <arg line="setup.py -q bdist_egg -d ${module.bin.dir}" />
        </exec>
        <delete dir="${basedir}/build"/>
        <delete includeemptydirs="true">
            <fileset dir="${basedir}/lib" includes="*.egg-info/"/>
        </delete>
        <move file="${module.bin.dir}/${ant.project.name}-0.1-py2.6.egg" tofile="${module.bin.dir}/${ant.project.name}.egg" />
        
        <ivy:publish artifactspattern="${module.bin.dir}/[artifact].[ext]" 
                        resolver="local"
                        status="integration"
                        forcedeliver="true"
                        pubrevision="1.0"
                        overwrite="true"
        />
    </target>
    
    <target name="test">
        <condition property="target" value="pt" else="unittest">
            <isset property="nose.args"/>
        </condition>
        <mkdir dir="${nose.result.dir}" />
        <property name="nose.args" value="${basedir}/lib/${ant.project.name}tests ${basedir}/lib/${ant.project.name}cpythontests"/>
        <exec osfamily="windows" executable="cmd" dir="${basedir}" failonerror="true">
            <env key="ANT_ARGS" value="-lib ${lib.dir} -lib ${builder.dir}\antlibs" />
            <env key="JYTHONPATH" value="${builder.dir}\python\lib\jython-2.5-py2.5.egg" />
            <env key="TEST_DATA" path="${basedir}/tests" />
            <arg value="/C" />
            <arg value="${ant.home}\bin\ant.bat -f tests.ant.xml ${target} &quot;-Dbuilder.dir=${builder.dir}&quot; &quot;-Dnose.args=${nose.args}&quot; &amp;&amp; exit /b %%ERRORLEVEL%%" />
        </exec>
        <exec osfamily="unix" executable="${ant.home}/bin/ant" dir="${basedir}" failonerror="true">
            <env key="ANT_ARGS" value="-lib ${lib.dir} -lib ${builder.dir}/antlibs" />
            <env key="JYTHONPATH" value="${builder.dir}/python/lib/jython-2.5-py2.5.egg" />
            <env key="TEST_DATA" path="${basedir}/tests" />
            <arg line="-f tests.ant.xml ${target} -Dbuilder.dir=${builder.dir}" />
            <arg value="-Dnose.args=${nose.args}" />
        </exec>
    </target>  

    <target name="clean">
    </target>
    
</project>