Question

Flex Builder allows additional compiler arguments to be set in the compiler options, under properties. It sets the argument;

-services ".../services-config.xml"

Is there a way to set the same argument when using the ant task mxmlc?

Cheers,

Mike

Was it helpful?

Solution

You should be able to set it as an attribute on the mxmlc task:

<mxmlc services="../services-config.xml"/>

OTHER TIPS

Not that I know of.

You could always use the task with subnodes if you still are unable to find it in the docs.

Example:

<exec executable="${mxmlc.exe}" dir="${basedir}">
    <arg line="-source-path '${flex2sdk.locale.dir}'" />
    <arg line="-locale en_US" />
</exec>

I was having the same issues with the services attribute not being available for use in the ant tasks so I added the option to fix the problem:

 <mxmlc file="path" output="path to output" >
       <compiler.services>${path-to-services}</compiler.services>
       <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
       <source-path path-element="${FLEX_HOME}/frameworks"/>
       <compiler.debug>false</compiler.debug>
       <compiler.context-root>/PATWeb</compiler.context-root>
 </mxmlc>

This is accomplished by the following:

<target name="compileApp">
<mxmlc file="src/app.mxml" 
...other options
services="[path to your services-config.xml]" 
context-root="[path to where your gateway file is]">
...
</target>

This is how we are currently building the mxml app... which means Christophe was correct.

Most of the compiler options are available as either attributes or tags for the mxmlc task, however some options are missing, or work in somewhat unexpected way. Worst thing is lack of proper documentation for the flex Ant tasks. Sometimes I find it easier to do this:

<mxmlc file="Main.as" output="bin/app.swf">
    <load-config filename="${FLEX_HOME}/flex-config.xml" />
    <load-config filename="build/config.xml" />
</mxmlc>

And then specify all the options I want in build/config.xml, at least the syntax is documented better, and you can always use flex-config.xml or air-config.xml from your SDK as a (well-commented) sample.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top