views:

37

answers:

1

hello,

i want to use Ant task to compile flex project(with many libraries, modules)

i use -dump-config build.xml compiler option in flash builder to extract build config

after i create this Ant task(for start, i try to compile only one mxml-module) :

<project name="My App Builderrrr" basedir="." default="main">

<property name="QA_PM_DEST" value="[my project dir]\src"/>
<property name="BIN_DEBUG" value="[my project dir]\bin-debug"/>
<property name="FLEX_HOME" value="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.0.0"/>
<property name="APP_ROOT" value="src"/>
<property name="DEPLOY_DIR" value="c:\output"/>


<taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasks.jar"/>

<target name="main">

     <mxmlc  file="${QA_PM_DEST}/***.mxml"
        output="${DEPLOY_DIR}/***.swf">
         <load-config filename="***\build.xml"/>

     </mxmlc>


</target>

and after

ant -buldfile mybuildfile.xml

but it generates very small swf file that runs with errors(67kb insted of 300kb in release build and 800kb in debug)

+1  A: 

I think you need to load the following config, too:

<property name="flex.config" value="${FLEX_HOME}/frameworks/flex-config.xml"/>
<load-config filename="${flex.config}" />

(UPDATE 2010-08-19)

I also add incremental="false" to my mxmlc call and the libraries this way:

<library-path dir="${lib.dir}" append="true">
    <include name="**.swc" />
</library-path> 

An the following is also missing in your file:

<source-path path-element="${src.dir}"/>
hering
is there the way to extract ant build task and true build.xml that uses flash builder to compile current project?
2xMax
i tried to write <mxmlc><load-config filename="***\build.xml" /><load-config filename="${flex.config}" /> and the compilere returned error aboud unexist classes. Next i added (in build.xml) libraries wrapped in <include-library> tag. It compiles successfully, but in browser it doesn't work
2xMax
What do you mean with "extract ant build task and true build.xml"? You write the build.xml yourself. If you want to get the configurations with FlashBuilder compiles your project: IMHO this isn't possible. FlashBuilder actually don't compile with ant (unless you say FlashBuilder to do so).Have you specified the `${flex.config}` well? It has to be something like: `C:/Program Files/Adobe/Adobe Flash Builder/sdks/4.0.0/frameworks/flex-config.xml`
hering
Unfortunately you can't generate a build.xml file from flex builder 3 (don't know about flash builder). Also, you have to note that flex builder doesn't use mxmlc when compiling projects.
bug-a-lot
Thanks for the answers! 2hering: yes, i specified correctly flex-config and it loads. 2bug-a-lot: it's interisting for me hear whence you have learnt about it
2xMax
I' ve updated my answer with new possible solutions. (code as comment wasn't really readable :()
hering