1 Reply Latest reply on Nov 23, 2013 8:15 PM by david_kenneth_coleman

    Ant fails to compile modules which use interfaces

    david_kenneth_coleman Level 1

      Hi, I am having a major problem compiling flex modules with ANT.

       

      I will try to give ALL necessary information so we can avoid days of useless novice questions.

       

      I have an application that uses many modules.  They DO compile perfectly in flash builder.

       

      First question.  How can I get flashbuilder 4.7 to show me the command line which it uses for mxmlc?  If I could see this, I could do everything myself.

       

      Second question:  What is wrong with my work below?

       

      I have a module which looks like this:

      <?xml version="1.0" encoding="utf-8"?>

      <s:Module xmlns:fx="http://ns.adobe.com/mxml/2009"

      xmlns:s="library://ns.adobe.com/flex/spark"

      xmlns:mx="library://ns.adobe.com/flex/mx"

      implements="com.hof.lobby.modules.IVolatileAssets"

      width="400" height="300"

      creationComplete="onDummy(event)"

      >

       

      I have inside this module various other properties which are themselves instances typed as various other interfaces.

       

      when I build the main applicaiton, everything is fine.

       

      I created a macrodef in ANT to build all my modules efficiently.

       

          <macrodef name="buildModule">

              <attribute name="module-name" default="none" />

              <attribute name="module-package" default="none" />

                    <attribute name="out-path" default="." />

              <sequential>

                        <echo message="building @{module-name} to @{out-path}/@{module-name}.swf" />

                        <mxmlc file="${APP_ROOT}/src/@{module-package}/@{module-name}.mxml"

                                     output="${DEPLOY_DIR}/@{out-path}/@{module-name}.swf"

                                     keep-generated-actionscript="false"

                                     incremental="false"

                                     debug="true"

                                     fork="true"

                                     load-externs="${ANT_ROOT}/link-report.xml"

                                     optimize="false"

                                     >

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

                      <source-path path-element="${FLEX_HOME}/frameworks"/>

                                  <compiler.library-path dir="${HOF_COMMON_ROOT}" append="true">

                                            <include name="bin"/>

                                  </compiler.library-path>

                                  <compiler.library-path dir="${APP_ROOT}" append="true">

                                            <include name="libs"/>

                                  </compiler.library-path>

                      <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">

                          <include name="libs" />

                          <include name="../bundles/{locale}" />

                      </compiler.library-path>

                                  <source-path path-element="${APP_ROOT}/src/locale/{locale}"/>

                  </mxmlc>

              </sequential>

          </macrodef>

       

          <target name="modulesDebug" depends="lobbyDependencies" description="Build the lobby modules for debug">

                    <!--<buildModule module-name="InboxDlg" module-package="com/hof/lobby/modules/dlgs" out-path="modules3/dlgs"/>-->

                    <buildModule module-name="VolatileAssets" module-package="com/hof/lobby/modules" out-path="modules3"/>

                </target>

       

      So then when i run this target, i get the following output:

      modulesDebug:

           [echo] building VolatileAssets to modules3/VolatileAssets.swf

          [mxmlc] Loading configuration file F:\var\sdk\flex_sdk_4.5.1.21328A\frameworks\flex-config.xml

          [mxmlc] F:\var\projects\hof\svn2.-----.com\lobby\branches\3.1.39.0\src\com\hof\lobby\modules\Vola tileAssets.mxml(-1):  Error: Interface IVolatileAssets was not found.

          [mxmlc] <?xml version="1.0" encoding="utf-8"?>

       

       

      BUILD FAILED

      F:\var\projects\hof\svn2.-----.com\lobby\branches\3.1.39.0\build.xml:98: The following error occurred while executing this line:

      F:\var\projects\hof\svn2.-----.com\lobby\branches\3.1.39.0\build.xml:51: mxmlc task failed.

       

       

      Total time: 7 seconds

       

      If i remove the implements attribute in the module component definition then i get a cascading failure for EVERY SINGLE interface in the module.

       

      Basically something is causing ANT to fail to load the class def for ANY interface in the module.

       

      What on earth am I doing wrong?

       

      Please help.

       

      Thank you.

        • 1. Re: Ant fails to compile modules which use interfaces
          david_kenneth_coleman Level 1

          I am replying to my own thread because I absolutely HATE IT when i see a post with the exact problem that I have and no answer.

           

          here is the answer to the problem:

           

          I had to create an external config file and load it with

           

          <load-config filename="${basedir}/config/ModuleConfig.xml"/>

           

          the contents of ModuleConfig.xml re-define nearly every framework configuration.  none of them seem non standard to me...

           

          Basically I just defined everything to be what it SHOULD be and loaded this config file after I apply the default flex-config.xml from the sdk.

           

          do what I posted below and it will work.

           

          so now, my macrodef is:

              <macrodef name="buildModule">

                  <attribute name="module-name" default="none" />

                  <attribute name="module-package" default="none" />

                        <attribute name="out-path" default="." />

                        <attribute name="debug" default="true" />

                  <sequential>

                            <echo message="building @{module-name} to @{out-path}/@{module-name}.swf" />

                            <mxmlc file="${APP_ROOT}/src/@{module-package}/@{module-name}.mxml"

                                         output="${DEPLOY_DIR}/@{out-path}/@{module-name}.swf"

                                         keep-generated-actionscript="false"

                                         incremental="true"

                                         debug="@{debug}"

                                         fork="true"

                                         optimize="false"

                                         size-report="${basedir}/reports/@{module-name}-size_report.xml"

                                         >

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

                                      <load-config filename="${basedir}/config/ModuleConfig.xml"/>

                      </mxmlc>

                  </sequential>

              </macrodef>

           

          and my ModuleConfig file is:

          <flex-config xmlns="http://www.adobe.com/2006/flex-config">

            <compiler>

              <warn-no-constructor>false</warn-no-constructor>

              <accessible>true</accessible>

              <fonts>

                <managers>

                  <manager-class>flash.fonts.JREFontManager</manager-class>

                  <manager-class>flash.fonts.BatikFontManager</manager-class>

                  <manager-class>flash.fonts.AFEFontManager</manager-class>

                  <manager-class>flash.fonts.CFFFontManager</manager-class>

                </managers>

              </fonts>

              <source-path>

                <path-element>${basedir}/src/locale/{locale}</path-element>

                <path-element>${basedir}/src</path-element>

              </source-path>

              <debug>true</debug>

              <theme>

                <filename>${FLEX_HOME}frameworks/themes/Spark/spark.css</filename>

              </theme>

              <namespaces>

                <namespace>

                  <uri>http://ns.adobe.com/mxml/2009</uri>

                  <manifest>${FLEX_HOME}frameworks/mxml-2009-manifest.xml</manifest>

                </namespace>

                <namespace>

                  <uri>library://ns.adobe.com/flex/spark</uri>

                  <manifest>${FLEX_HOME}frameworks/spark-manifest.xml</manifest>

                </namespace>

                <namespace>

                  <uri>library://ns.adobe.com/flex/mx</uri>

                  <manifest>${FLEX_HOME}frameworks/mx-manifest.xml</manifest>

                </namespace>

                <namespace>

                  <uri>http://www.adobe.com/2006/mxml</uri>

                  <manifest>${FLEX_HOME}frameworks/mxml-manifest.xml</manifest>

                </namespace>

              </namespaces>

              <library-path>

                <path-element>${FLEX_HOME}frameworks/locale/{locale}</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/rpc.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/osmf.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/spark.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/charts.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/framework.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/spark_dmv.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/sparkskins.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/textLayout.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/advancedgrids.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/authoringsupport.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/flash-integration.swc</path-element>

                <path-element>${FLEX_HOME}frameworks/libs/mx/mx.swc</path-element>

                <path-element>  ---- proprietary libs - redacted ----  </path-element>

              </library-path>

              <external-library-path>

                <path-element>${FLEX_HOME}frameworks/libs/player/10.2/playerglobal.swc</path-element>

              </external-library-path>

              <locale>

                <locale-element>en_US</locale-element>

                <locale-element>es_ES</locale-element>

                <locale-element>fr_FR</locale-element>

                <locale-element>it_IT</locale-element>

              </locale>

            </compiler>

            <target-player>10.2</target-player>

            <swf-version>11</swf-version>

            <static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/framework.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.5.1.21328/framework_4.5.1.21489.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>framework_4.5.1.21489.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/textLayout.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>textLayout_2.0.0.232.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/osmf.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.5.1.21328/osmf_1.0.0.16316.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>osmf_1.0.0.16316.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/spark.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.5.1.21328/spark_4.5.1.21489.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>spark_4.5.1.21489.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/sparkskins.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.5.1.21328/sparkskins_4.5.1.21328.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>sparkskins_4.5.1.21328.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/rpc.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.5.1.21328/rpc_4.5.1.21328.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>rpc_4.5.1.21328.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/charts.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.5.1.21328/charts_4.5.1.21328.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>charts_4.5.1.21328.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/spark_dmv.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.5.1.21328/spark_dmv_4.5.1.21328.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>spark_dmv_4.5.1.21328.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/mx/mx.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.5.1.21328/mx_4.5.1.21489.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>mx_4.5.1.21489.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <runtime-shared-library-path>

              <path-element>${FLEX_HOME}frameworks/libs/advancedgrids.swc</path-element>

              <rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.5.1.21328/advancedgrids_4.5.1.21328.swz</rsl-url>

              <policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>

              <rsl-url>advancedgrids_4.5.1.21328.swz</rsl-url>

              <policy-file-url />

            </runtime-shared-library-path>

            <file-specs>

              <path-element>${APP_ROOT}/src/@{module-package}/@{module-name}.mxml</path-element>

            </file-specs>

            <output>${DEPLOY_DIR}/@{out-path}/@{module-name}.swf</output>

          </flex-config>