Alexander Gladysh
Alexander Gladysh

Reputation: 41393

Custom Flex Ant build task

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?

Upvotes: 0

Views: 1099

Answers (3)

Adam Peck
Adam Peck

Reputation: 7045

To run that command in Ant use the exec task.

<exec executable="tool.sh" dir="toolshdir" output="target.as">
    <arg value="source.txt" />
</exec>

Upvotes: 2

Simon Lehmann
Simon Lehmann

Reputation: 10967

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>

Upvotes: 4

cliff.meyers
cliff.meyers

Reputation: 17734

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.

Upvotes: 1

Related Questions