2

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)

2xMax
  • 1,639
  • 6
  • 21
  • 41

1 Answers1

2

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
  • 1,956
  • 4
  • 28
  • 43
  • is there the way to extract ant build task and true build.xml that uses flash builder to compile current project? – 2xMax Aug 18 '10 at 13:13
  • i tried to write and the compilere returned error aboud unexist classes. Next i added (in build.xml) libraries wrapped in tag. It compiles successfully, but in browser it doesn't work – 2xMax Aug 18 '10 at 13:16
  • 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 Aug 18 '10 at 13:59
  • 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 Aug 18 '10 at 14:51
  • 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 Aug 18 '10 at 17:48
  • I' ve updated my answer with new possible solutions. (code as comment wasn't really readable :() – hering Aug 19 '10 at 08:01