Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mxmlc and framework linkage - how to specify linkage as rsl

I'm trying to build my flex 4 project using ant. In Flash Builder 4, in project properties it's possible to set the "Framework linkage" to one of "Merged into code", "Runtime Shared Library (RSL)" or "Use SDK Default (Runtime Shared library)". How can I set the equivalent as mxmlc options in build.xml?

My current build.xml looks like this:

<target name="myapp">
    <mxmlc 
        file="${PROJECT_ROOT}/myapp.mxml" 
        output="${DEPLOY_DIR}/myapp.swf"
        actionscript-file-encoding="UTF-8"
        keep-generated-actionscript="false"
        warnings="false" optimize="true" incremental="false" >

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

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

        <compiler.debug>true</compiler.debug>

        <runtime-shared-library-path path-element="${FLEX_FRAMEWORKS}/libs/framework.swc">
            <url rsl-url="framework_4.0.0.14159.swz"/>
            <url rsl-url="framework_4.0.0.14159.swf"/>
        </runtime-shared-library-path>                       

        <compiler.source-path path-element="src"/>

        <!-- List of external libraries -->
        <compiler.source-path path-element="${MY_LIB}/src" />

        <!-- List of SWC files or directories that contain SWC files. -->
        <compiler.library-path dir="libs" append="true">
            <include name="*.swc" />
        </compiler.library-path>

        <copy todir="${DEPLOY_DIR}" file="${FLEX_FRAMEWORKS}/rsls/framework_4.0.0.14159.swz"/>
        <copy todir="${DEPLOY_DIR}" file="${FLEX_FRAMEWORKS}/rsls/framework_4.0.0.14159.swf"/>

    </mxmlc>
</target>

I assumed that setting the runtime-shared-library-path directive and copying the framework swf, swz files into my target folder would make things work, but this does not seem to be the case.

The way I'm assessing whether this works is as follows: I use a custom preloader, and for it to work I need to have framework linkage as RSL. With "merged into code", my preloader gets stuck at a certain point and does not progress to my application swf. This is the same behavior i see when i use the above build.xml, which makes me think that the SWF is being built with framework linkage merged into code (rather than RSL linked).

A related question to this is how to determine if my swf is using RSL or not. I guess I could look at the size of the compiled output. But it seems there should be a way to tell if I'm using the external framework file or it's being bundled into the SWF somehow, without my knowledge.

like image 319
cybertoast Avatar asked Nov 01 '10 14:11

cybertoast


1 Answers

This is a little tricky because the documentation is a little scarce on this. You probably need to set the following option either on the command line or a config file.

static-link-runtime-shared-libraries=false

The documentation from Adobe gives the following slightly cryptic description of what this option does.

Determines whether to compile against libraries statically or use RSLs. Set this option to true to ignore the RSLs specified by the runtime-shared-library-path option. Set this option to false to use the RSLs. The default value is true.

This option is useful so that you can quickly switch between a statically and dynamically linked application without having to change the runtime-shared-library-path option, which can be verbose, or edit the configuration files.

Here is a link to the documentation. "About the application compiler options"

Note that from the documentation the default value is true. HOWEVER if you are loading a flex-config.xml file (default or custom) you should also check if this setting is present in that file and what it is. In my experience the default value for the frameworks/flex-config.xml is actually false. It appears however that in the example above that this may be set the other way.


(We use a different build system than ANT so I am not that familiar with the build.xml syntax you would need.)

like image 101
Justin Ohms Avatar answered Oct 02 '22 02:10

Justin Ohms