buildframework/helium/tools/startup/bootstrap/bootstrap.ant.xml
author lorewang
Wed, 01 Dec 2010 16:05:36 +0800
changeset 715 e0739b8406dd
parent 588 c7c26511138f
permissions -rw-r--r--
Specify extenal tool with path

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : bootstrap.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 framework -->
<project name="startup.bootstrap" default="install-dependencies" xmlns:ivy="antlib:org.apache.ivy.ant">
    <description>
    Download libraries to bootstrap helium
    </description>

    <!-- The general type of the build. This is used for checking the tools environment. Potential values include core, ido, product.
    @type string
    -->
    <property name="build.type" value="subcon" />
    <!-- The tools dependencies Ivy settings configuration file.
    @type string
    -->
    <property name="tools.ivy.config.file" location="${helium.dir}/config/ivy/tools_ivy_settings.xml" />

    <!-- Set proxy using Nokia settings by default -->
    <target name="proxy" unless="proxy.disabled">
        <property name="proxy.host" value="172.16.42.137" />
        <property name="proxy.port" value="8080" />
        <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" />
    </target>

    <!-- Name of ivy jar.
    @type string
    @scope private
    -->
    <property name="ivy.filename" value="ivy-2.0.0-beta2.jar" />
    <!-- Location of ivy jar.
    @type string
    @scope private
    -->
    <property name="ivy.file" value="${helium.dir}/external/antlibs2/${ivy.filename}" />
    <available file="${ivy.file}" property="ivy.file.present" />

    <!-- Download ivy jar -->
    <target name="get-ivy" unless="ivy.file.present" depends="proxy">
        <mkdir dir="${helium.dir}/external/antlibs2" />
        <get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/ivy/ivy/2.0.0-beta2/${ivy.filename}" dest="${ivy.file}" />
    </target>

    <!-- Install CruiseControl if not already installed -->
    <target name="install-cruisecontrol" unless="env.HLM_SUBCON">
        <if>
            <not>
                <available file="${helium.dir}/external/CruiseControl/real_cruisecontrol.bat" />
            </not>
            <then>
                <antcall target="install-dependencies">
                    <param name="build.type" value="ido_install" />
                </antcall>
            </then>
        </if>
    </target>

    <!-- Clean CruiseControl installation -->
    <target name="clean-cruisecontrol">
        <delete includeemptydirs="true">
            <fileset dir="${helium.dir}/external/CruiseControl">
                <exclude name="cruisecontrol.bat" />
                <exclude name="distribution.policy.S60" />
            </fileset>
        </delete>
    </target>


    <!-- Set libs for bootstrap -->
    <target name="set-libs">
        <path id="lib.path">
            <fileset dir="${helium.dir}/external/antlibs2" includes="**/*.jar" />
        </path>

        <!-- External tasks. -->
        <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="lib.path" />
    </target>

    <!-- Clean the Ivy cache. This is important if Ivy file content is changed. -->
    <target name="clean-ivy-cache" depends="set-libs">
        <ivy:configure file="${tools.ivy.config.file}" />
        <ivy:cleancache />
    </target>

    <!-- unzip jars. @scope private-->
    <target name="unzip-jar">
        <unzip src="${artifact.file}" dest="${helium.dir}/external/antlibs2" />
    </target>
    <!-- unzip eggs. @scope private -->
    <target name="unzip-egg">
        <unzip src="${artifact.file}" dest="${helium.dir}/external/python/lib/2.5" />
    </target>
    <!-- ungzip eggs. @scope private -->
    <target name="gunzip-egg">
        <gunzip src="${artifact.file}" dest="${artifact.file}.tar" />
        <untar src="${artifact.file}.tar" dest="${helium.dir}/external/python/lib/2.5" />
    </target>
    <!-- unbzip egg. @scope private -->
    <target name="bunzip-egg">
        <bunzip2 src="${artifact.file}" dest="${artifact.file}.tar" />
        <untar src="${artifact.file}.tar" dest="${helium.dir}/external/python/lib/2.5" />
    </target>

    <!-- Install libraries main target -->
    <target name="install-dependencies" depends="proxy,set-libs">
        <ivy:configure file="${tools.ivy.config.file}" />
        <ivy:resolve file="${helium.dir}/config/ivy/ivy.xml" conf="${build.type}" haltonfailure="false" />

        <ivy:retrieve pattern="${helium.dir}/external/antlibs2/[artifact]-[revision].[ext]" type="jar" />
        <ivy:retrieve pattern="${helium.dir}/external/python/lib/2.5/[artifact]-[revision].[ext]" type="egg" />
        <ivy:retrieve pattern="${helium.dir}/external/sources/[artifact]-[revision].[ext]" type="zip" />

        <delete>
            <fileset dir="${helium.dir}/external/antlibs2" includes="ant-optional*.jar" />
            <fileset dir="${helium.dir}/external/antlibs2" includes="ant-1.5.jar" />
        </delete>

        <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="lib.path" />

        <if>
            <not>
                <available file="${helium.dir}/external/python/lib/2.5/easy-install.pth" />
            </not>
            <then>
                <copy file="${helium.dir}/tools/startup/bootstrap/easy-install.pth" todir="${helium.dir}/external/python/lib/2.5" />
                <copy file="${helium.dir}/tools/startup/bootstrap/site.py" todir="${helium.dir}/external/python/lib/2.5" />
            </then>
        </if>
    </target>

</project>