0

How can I concat files with Ant if source files is changed?

I create such code but it is very complex to do such simple thing - want to do in more simple way - can I do it?

<target name="check.src/web_site/seo/frontend/base/crud/yaml/keyword/list/static/list.js">
    <uptodate property="dirty.src/web_site/seo/frontend/base/crud/yaml/keyword/list/static/list.js"
        targetfile="src/web_site/seo/frontend/base/crud/yaml/keyword/list/static/list.js">
        <srcfiles file="src/web_site/seo/frontend/base/crud/yaml/base/list/static/list.js"></srcfiles>
        <srcfiles file="src/web_site/seo/frontend/base/crud/yaml/keyword/list/js/list.js"></srcfiles>
    </uptodate>
    <echo message="result: ${dirty.src/web_site/seo/frontend/base/crud/yaml/keyword/list/static/list.js}"/>
</target>

<target name="src/web_site/seo/frontend/base/crud/yaml/keyword/list/static/list.js"
    depends="check.src/web_site/seo/frontend/base/crud/yaml/keyword/list/static/list.js"
    unless="dirty.src/web_site/seo/frontend/base/crud/yaml/keyword/list/static/list.js">
    <echo message="concat"></echo>
    <concat destfile="src/web_site/seo/frontend/base/crud/yaml/keyword/list/static/list.js"
        fixlastline="true" >
        <fileset file="src/web_site/seo/frontend/base/crud/yaml/base/list/static/list.js"></fileset>
        <fileset file="src/web_site/seo/frontend/base/crud/yaml/keyword/list/js/list.js"></fileset>
    </concat>
</target>
Chameleon
  • 9,722
  • 16
  • 65
  • 127
  • Are you ok to run os commands to combine files as mentioned [here](http://stackoverflow.com/questions/2477271/concatenate-text-files-with-windows-command-line-dropping-leading-lines)? – Rao Feb 11 '16 at 01:36

1 Answers1

0

Since ant 1.8.2, you can use overwrite property of the concat task for that purpose.

Before version 1.8.2, you may use the force property instead.

P.A. Cros
  • 501
  • 3
  • 6