<?xml version="1.0"?>
<!--
The contents of this file are subject to the terms of the Common Development
and Distribution License (the License). You may not use this file except in
compliance with the License.

You can obtain a copy of the License at http://www.netbeans.org/cddl.html
or http://www.netbeans.org/cddl.txt.

When distributing Covered Code, include this CDDL Header Notice in each file
and include the License file at http://www.netbeans.org/cddl.txt.
If applicable, add the following below the CDDL Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"

The Original Software is NetBeans. The Initial Developer of the Original
Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
Microsystems, Inc. All Rights Reserved.
-->

<project name="XTest driver" basedir="." default="pack-results">
    
    <property name="xtest.home" location="/hudson/workdir/jobs/testsHistory/xtest-distribution"/>
    <property name="driver.classpath" location="${xtest.home}/lib/xtest.jar"/>
    <property name="xtest.tested.project" value="NetBeans Validation"/>
    <property name="xtest.tested.project" value="netbeans"/>
    <property name="xtest.testing.group" value="Quality Engineering"/>
    <property name="xtest.tested.type" value="validation"/>
    <property name="xtest.machine" value="deadlock"/>
    <property name="xtest.ship.results.to" location="/hudson/workdir/jobs/testsHistory/xtest-pes/ship"/>
    <property name="netbeans.dest.dir" location="/hudson/workdir/jobs/testsHistory/workspace/nbbuild/netbeans"/>
    <property name="xtest.results" location="/hudson/workdir/jobs/testsHistory/workspace/xtest/instance/results"/>
    
    <target name="init">
        <taskdef name="nbtaskdef" classname="org.netbeans.xtest.NbMultiTaskDef" 
                 classpath="${driver.classpath}"/>
        <nbtaskdef classpath="${driver.classpath}">
            <taskdef name="reportinfo" classname="org.netbeans.xtest.pe.XTestResultsReportTask"/>
            <taskdef name="regenerateXML" classname="org.netbeans.xtest.pe.RegenerateXMLTask"/>
            <taskdef name="buildinfo" classname="org.netbeans.xtest.driver.ParseBuildInfo"/>
        </nbtaskdef>
    </target>
    
    <target name="pack-results" depends="init">
        <buildinfo idePlatformDir="${netbeans.dest.dir}/platform8" buildNumberProperty="xtest.ide.build.name"
                   buildProjectNameProperty="XXXxtest.tested.project" buildTimestampProperty="ide.timestamp"/>
        <tstamp>
            <format property="xtest.ide.build.name" pattern="yyyyMMdd-HHmm"/>
        </tstamp>

        <delete file="${xtest.results}/xmlresults/testreport.xml"/>
        <reportinfo outFile="${xtest.results}/xmlresults/testreport.xml"
                    project="${xtest.tested.project}" project_id="${xtest.tested.project_id}"
                    team="${xtest.testing.team}" build="${xtest.ide.build.name}"
                    testingGroup="${xtest.testing.group}" testedType="${xtest.tested.type}"
                    host="${xtest.machine}"/>
        <regenerateXML inputDir="${xtest.results}" serverUsage="${_xtest.server.usage}"/>
        
        <property name="archive.filename" value="xtr-${xtest.tested.project}-${xtest.ide.build.name}-${xtest.testing.group}-${xtest.tested.type}-${xtest.machine}.zip"/>
        <property name="archive.file" value="${xtest.results}/${archive.filename}"/>
        
        <echo>
            ##########################################
            xtest.machine=${xtest.machine}
            archive.file=${archive.file}
            xtest.ide.build.name=${xtest.ide.build.name}
            xtest.tested.project=${xtest.tested.project}
        </echo>
        
        <zip zipfile="${archive.file}">
            <fileset dir="${xtest.results}" excludes="xtr*.zip"/>                          
        </zip>
        <copy overwrite="yes" file="${archive.file}" todir="${xtest.ship.results.to}"/>
        <chmod perm="ugo+rw" file="${xtest.ship.results.to}/${archive.filename}"/>
        <delete file="${archive.file}"/>
    </target>
</project>
