buildframework/helium/tools/quality/file-comparison/file-comparison.ant.xml
author Richard Taylor <richard.i.taylor@nokia.com>
Tue, 06 Apr 2010 10:03:18 +0100
branchwip
changeset 454 9de4f2d59255
parent 217 0f5e3a7fb6af
permissions -rw-r--r--
catch up

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : file-comparison.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 quality -->
<project name="quality.file-comparison" xmlns:hlm="http://www.nokia.com/helium">
    <description>
    File comparison integration using Beyond Compare.
    </description>

    <!-- Defines the location of BComp.exe.
    @type string
    -->
    <property name="file-comparison.bcomp_path" location="C:\APPS\bc\BComp.exe" />
    <!-- Defines the location of Beyond Compare configuration file.
    @type string
    -->
    <property name="file-comparison.bcomp_conf" location="${helium.dir}/tools/quality/file-comparison/BCompare-config.txt" />
    <!-- Defines the location where comparison output should be put.
    @type string
    -->
    <property name="file-comparison.output" location="${build.output.dir}/file_comparison" />
    <!-- Defines the name of the folder for the left side of comparison.
    @type string
    -->
    <property name="file-comparison.left_name" value="left" />
    <!-- Defines the name of the folder for the right side of comparison.
    @type string
    -->
    <property name="file-comparison.right_name" value="right" />
    <!-- Defines the regexp pattern (in ANT-pattern style) which to mach from given filesets.
    @type string
    -->
    <property name="file-comparison.regexp.from" value="(.*)" />
    <!-- Defines the regexp pattern (in ANT-pattern style) what to use in (possible) replacement.
    @type string
    -->
    <property name="file-comparison.regexp.to" value="\1" />

    <!--
        Target to run the file-comparison with Beyond Compare.
        Compares two filesets: file-comparison.left_side and file-comparison.right_side.
        It is also possible to use regexps to replace text in file names.
    -->
    <target name="file-comparison">
        <trycatch property="file-comparison.exception">
            <try>
                <copy todir="${file-comparison.output}/${file-comparison.left_name}">
                    <fileset refid="file-comparison.left_side" />
                    <regexpmapper from="${file-comparison.regexp.from}" to="${file-comparison.regexp.to}" />
                </copy>
                <copy todir="${file-comparison.output}/${file-comparison.right_name}">
                    <fileset refid="file-comparison.right_side" />
                    <regexpmapper from="${file-comparison.regexp.from}" to="${file-comparison.regexp.to}" />
                </copy>
                <exec executable="${file-comparison.bcomp_path}">
                    <arg value="@${file-comparison.bcomp_conf}" />
                    <arg value="/closescript"/>
                    <arg value="${file-comparison.output}/${file-comparison.left_name}" />
                    <arg value="${file-comparison.output}/${file-comparison.right_name}" />
                    <arg value="${file-comparison.output}/file_comparison_report" />
                </exec>
                <delete dir="${file-comparison.output}/${file-comparison.left_name}" />
                <delete dir="${file-comparison.output}/${file-comparison.right_name}" />
            </try>
            <catch>
                <echo>WARNING: Caught exception in file-comparison target: ${file-comparison.exception}</echo>
            </catch>
        </trycatch>
    </target>

</project>