views:

746

answers:

3

A beginner's question.

I'm building a .swf with Flex Ant.

To my .swf I link a file, target.as, which I generate from file source.txt with command

./tool.sh source.txt > target.as

How can I add what is described in the above sentence to my ant build process?

+2  A: 

To run that command in ant use the exec task.

<exec executable="tool.sh" dir="toolshdir" output="target.as">
    <arg value="source.txt" />
</exec>
Adam Peck
+2  A: 

The exec task executes any external program:

<exec executable="${basedir}/tool.sh" dir="${basedir}" output="target.as">
    <arg path="source.txt"/>
</exec>

So if you use the mxmlc ant task to compile your swf, you can define your build task like this:

<target name="build">
     <exec executable="${basedir}/tool.sh" dir="${basedir}" output="target.as">
          <arg path="source.txt"/>
     </exec>

     <mxmlc ....>
         ...
     </mxmlc>
</target>
Simon Lehmann
+1  A: 

http://livedocs.adobe.com/flex/3/html/anttasks_1.html

You may also want to use the Flex "mxmlc" task instead of calling it with exec. You can do a lot of configuration right within the XML if you'd prefer not to have to maintain the shell script.

cliff.meyers