2 Replies Latest reply on Nov 2, 2009 8:47 AM by poloop

    MXMLC compilation with ant Problem

    poloop

      Hy,

       

      For my project I'd like build some Air Module using the mxmlc command by an Ant Script :

       

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <project name="MazarineModuleFactory" basedir=".">
           
          <property name="sdk_dir"     location="C:\tools\flex_sdk_4.0.0.10988" />
          
          <property name="FLEX_HOME"     value="${sdk_dir}" />
          <property name="AIR_HOME"     value="${sdk_dir}\frameworks\libs\air" />
          
          <property name="WORKSPACE"    location="C:\Documents and Settings\p.long\Bureau\MHIP PROTO" />
          <property name="MAIN"        location="${WORKSPACE}\MazarineModuleFactory" />
          <property name="MODULES"        location="${MAIN}\src\com\rezoloco\modules" />
           
           <property name="MAIN_APP_MXML"     value="${MAIN}\src\MazarineModuleFactory.mxml"/>
          <property name="DEPLOY"         value="${MAIN}\deploy"/>
           <property name="LIST_MODULES"    value="ModuleSlideManager,ModuleSlideManagerSpark,ModuleSlidePlayer" />
           
          <taskdef resource="flexTasks.tasks" classpath="${MAIN}\libs\flexTasks.jar"/>
          <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${MAIN}\libs\ant-contrib-1.0b3.jar"/>
           
           <!-- ================================= 
                    target: clean              
          ================================== -->    
           
          <target name="clean" description="clean the project">
              <delete dir="${MAIN}/deploy"/>
              <mkdir dir="${MAIN}/deploy"/>
          </target>
           
           <!-- ================================= 
                    target: compile              
          ================================== -->
          <target name="compileHere" depends="clean" description="compile a mxml file into a swf file">
              <foreach target="compileOneModule" list="${LIST_MODULES}" delimiter="," param="file" />
          </target>
           
           <target name="compileOneModule">
               <echo message="${MAIN}\src\${file}.mxml -> ${DEPLOY}\${file}.swf" />
               <mxmlc     file="${MAIN}\src\${file}.mxml"
                      output="${DEPLOY}\${file}.swf"
                      actionscript-file-encoding="UTF-8"
                      keep-generated-actionscript="true"
                        debug="false" optimize="true">
                  <default-frame-rate>30</default-frame-rate>
                  <default-size width="500" height="600" />
                   <load-config filename="${FLEX_HOME}/frameworks/air-config.xml" />
                  <source-path path-element="${FLEX_HOME}/frameworks" />
                   <compiler.source-path path-element="${MAIN}/src" />
                  <compiler.library-path dir="${WORKSPACE}/ComponentLib/bin" append="true">
                      <include name="*.swc"/>
                  </compiler.library-path>
                  <compiler.library-path dir="${MAIN}/libs" append="true">
                      <include name="*.swc"/>
                  </compiler.library-path>
               </mxmlc>
               <echo message="--------" />
           </target>
           <!-- ================================= 
                    target: compile              
           ================================= -->
          <target name="compileMain" depends="clean" description="compile a mxml file into a swf file">
              <echo message="${MAIN_APP_MXML} -> ${DEPLOY}\MazarineModuleFactory.swf" />
              <mxmlc file="${MAIN_APP_MXML}" output="${DEPLOY}\MazarineModuleFactory.swf" debug="false" optimize="true">
                  <load-config filename="${FLEX_HOME}/frameworks/air-config.xml" />
                  <source-path path-element="${FLEX_HOME}/frameworks" />
                  <compiler.library-path dir="${WORKSPACE}/ComponentLib/bin" append="true">
                      <include name="*.swc"/>
                  </compiler.library-path>
                  <compiler.library-path dir="${MAIN}/libs/" append="true">
                      <include name="*.swc"/>
                  </compiler.library-path>
              </mxmlc>
          </target>
      </project>

       

      But, when I execute the script "CompileHere", it generates an error :

      Buildfile: C:\Documents and Settings\p.long\Bureau\MHIP PROTO\MazarineModuleFactory\build-files\build.xml
      clean:
         [delete] Deleting directory C:\Documents and Settings\p.long\Bureau\MHIP PROTO\MazarineModuleFactory\deploy
          [mkdir] Created dir: C:\Documents and Settings\p.long\Bureau\MHIP PROTO\MazarineModuleFactory\deploy
      compileHere:
      compileOneModule:
           [echo] C:\Documents and Settings\p.long\Bureau\MHIP PROTO\MazarineModuleFactory\src\ModuleSlideManager.mxml -> C:\Documents and Settings\p.long\Bureau\MHIP PROTO\MazarineModuleFactory\deploy\ModuleSlideManager.swf
          [mxmlc] Chargement du fichier de configuration C:\tools\flex_sdk_4.0.0.10988\frameworks\air-config.xml
          [mxmlc] Erreur: Java heap space
          [mxmlc] java.lang.OutOfMemoryError: Java heap space
          [mxmlc]     at java.util.Arrays.copyOf(Unknown Source)
          [mxmlc]     at java.io.ByteArrayOutputStream.write(Unknown Source)
          [mxmlc]     at flash.swf.RandomAccessBuffer.write(RandomAccessBuffer.java:67)
          [mxmlc]     at flash.swf.RandomAccessBuffer.write(RandomAccessBuffer.java:48)
          [mxmlc]     at flash.swf.TagEncoder.doABC(TagEncoder.java:2222)
          [mxmlc]     at flash.swf.tags.DoABC.visit(DoABC.java:39)
          [mxmlc]     at flash.swf.MovieEncoder.export(MovieEncoder.java:154)
          [mxmlc]     at flex2.compiler.CompilerAPI.encode(CompilerAPI.java:4656)
          [mxmlc]     at flex2.tools.Mxmlc.mxmlc(Mxmlc.java:320)
          [mxmlc]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          [mxmlc]     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          [mxmlc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          [mxmlc]     at java.lang.reflect.Method.invoke(Unknown Source)
          [mxmlc]     at flex.ant.FlexTask.executeInProcess(FlexTask.java:280)
          [mxmlc]     at flex.ant.FlexTask.execute(FlexTask.java:225)
          [mxmlc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
          [mxmlc]     at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
          [mxmlc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          [mxmlc]     at java.lang.reflect.Method.invoke(Unknown Source)
          [mxmlc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
          [mxmlc]     at org.apache.tools.ant.Task.perform(Task.java:348)
          [mxmlc]     at org.apache.tools.ant.Target.execute(Target.java:357)
          [mxmlc]     at org.apache.tools.ant.Target.performTasks(Target.java:385)
          [mxmlc]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
          [mxmlc]     at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
          [mxmlc]     at org.eclipse.ant.internal.ui.antsupport.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:30)
          [mxmlc]     at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
          [mxmlc]     at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
          [mxmlc]     at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
          [mxmlc]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          [mxmlc]     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          [mxmlc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      
      BUILD FAILED
      C:\Documents and Settings\p.long\Bureau\MHIP PROTO\MazarineModuleFactory\build-files\build.xml:33: The following error occurred while executing this line:
      C:\Documents and Settings\p.long\Bureau\MHIP PROTO\MazarineModuleFactory\build-files\build.xml:42: mxmlc task failed
      
      Total time: 13 seconds
      

       

      I don't understand this one, I' try to change ANT_OPTS and increase memory, but I always the same build crash....

       

      If someone could help, this will be great !!

       

      Thanks a lot....