Concat2

Description

Concatenates a file, or a series of files, to a single file or the console. The destination file will be created if it does not exist.

Input files are specified using an embedded path element and may be filtered using

Parameters

Attribute

Description

Required

destfile

The destination file for the concatenated stream. If not specified the console will be used instead.

No

overwrite

Overwrite destination file even if is newer than the source files.

No, defaults to "false"

encoding

Specifies the encoding for the input files. Please see http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html for a list of possible values. Defaults to the platform's default character encoding.

No

Attributes specified as nested elements

sourcefiles

The list of files which are source files. This element is required. This is a Path elements which are are used to select sets or lists of files or directories

filterchain

The Copy task supports nested FilterChains.

mapper – This is used to map source files to target files.

There may be a number of mapper nested elements.

Examples

The following example creates the file ${jrun.file} if is older that build.xml, or any file in ${lib.dir}.

        <outofdate>
          <sourcefiles>
            <pathelement path="build.xml"/>
            <fileset dir=”${lib.dir}”/>
          </sourcefiles>
          <targetfiles>
            <pathelement path="${jrun.file}"/>
          </targetfiles>
          <sequential>
            <mkdir dir="${build.bin.dir}"/>
            <echo file="${jrun.file}" message="java -cp ${jrun.path} $*"/>
            <chmod file="${jrun.file}" perm="ugo+rx"/>
          </sequential>
        </outofdate> 

The following example check the generated files, MODULE.IDS, acme_agent_mib.h, acme_agent_mib.cpp are older that miblist.txt, or any file in ${mib.src}, and if so an embedded shellScript is invoked to update the files.

        <outofdate>
          <sourcefiles>
            <pathelement path="${agent.src}/miblist.txt"/>
            <fileset dir="${mib.src}"/>
          </sourcefiles>
          <targetfiles>
            <pathelement path="${rep}/MODULE.IDS"/>
            <pathelement path="${gen-agent}/acme_agent_mib.h"/>
            <pathelement path="${gen-agent}/acme_agent_mib.cpp"/>
          </targetfiles>
          <sequential>
            <shellscript shell="bash" dir="${agent.src}">
                    classname=com.agentpp.agentgen.AgentGenConsole
                    h1=${gen-agent}/acme_agent_mib.x
                    ag() {
                        java -cp ${lib.dir}/agentgen.jar $classname ${rep} $@
                    }
                    ag initialize
                    ag load miblist.txt
                    ag generate ACME-AGENT-MIB h > $h1
                    (head -16 $h1; echo "using namespace Agentpp;";
                    tail +16 $h1) > ${gen-agent}/acme_agent_mib.h
                    ag generate ACME-AGENT-MIB c >\
                        ${gen-agent}/acme_agent_mib.cpp
            </shellscript>
          </sequential>
        </outofdate>

The following example sets the project manual.outofdate if any of the xml files are newer than index.html, or if any of the xml files are newer than their corresponding .html file. A path identified by sources.path, is created which contains the sources that fullfilled these conditions.

        <outofdate property="manual.outofdate" outputsourcespath=”sources.path”>
            <sourcefiles>
                <fileset dir="${src.manual}" includes="**/*.xml"/>
            </sourcefiles>
            <targetfiles>
                <pathelement path="${doc.manual}/index.html"/>
            </targetfiles>
            <mapper type=”glob” from="${src.manual}/*.xml" to="${doc.manual}/*.html"/>
         </outofdate>

The following assumes that there is a program called gengrammer that takes a grammer file as an input and generates a .h and a .c file in the current directory.

         <outofdate property="manual.outofdate"
                    outputsources=”grammer.sources”>
            <sourcefiles>
                <fileset dir="${src.grammer}" includes="**/*.y"/>
            </sourcefiles>
            <mapper type=”glob” from=”${src.grammer}” to=”${gen.grammer}/*.c”/>
            <mapper type=”glob” from=”${src.grammer}” to=”${gen.grammer}/*.h”/>
            <sequential>
                <shellscript shell="bash">
                    cd ${gen.grammer}
                    for g in ${grammer.sources}
                    do
                       gengrammer $g
                    done
                </shellscript>
            </sequential>
         </outofdate>
    

Copyright © 2003 Ant-Contrib Project. All rights Reserved.