mxmlc 和框架链接 - 如何将链接指定为 rsl

发布于 2024-09-30 02:49:22 字数 1993 浏览 3 评论 0原文

我正在尝试使用 ant 构建我的 flex 4 项目。在 Flash Builder 4 中,在项目属性中,可以将“框架链接”设置为“合并到代码”、“运行时共享库​​ (RSL)”或“使用 SDK 默认值(运行时共享库​​)”之一。如何在 build.xml 中设置与 mxmlc 选项等效的选项?

我当前的 build.xml 如下所示:

<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>

我假设设置 runtime-shared-library-path 指令并将框架 swf、swz 文件复制到我的目标文件夹中将使事情正常工作,但情况似乎并非如此。

我评估其是否有效的方法如下:我使用自定义预加载器,为了使其工作,我需要将框架链接为 RSL。通过“合并到代码中”,我的预加载器卡在某个点并且无法进展到我的应用程序 swf。这与我使用上面的 build.xml 时看到的行为相同,这让我认为 SWF 是通过合并到代码中的框架链接(而不是 RSL 链接)构建的。

与此相关的一个问题是如何确定我的 swf 是否正在使用 RSL。我想我可以看看编译输出的大小。但似乎应该有一种方法可以在我不知情的情况下判断我是否正在使用外部框架文件,或者它是否以某种方式捆绑到 SWF 中。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

聚集的泪 2024-10-07 02:49:23

这有点棘手,因为这方面的文档有点稀缺。您可能需要在命令行或配置文件中设置以下选项。

static-link-runtime-shared-libraries=false

Adob​​e 的文档对该选项的作用提供了以下稍微含糊的描述。

确定是静态编译库还是使用 RSL。将此选项设置为 true 可忽略由 runtime-shared-library-path 选项指定的 RSL。将此选项设置为 false 以使用 RSL。默认值为 true。

此选项非常有用,因此您可以在静态和动态链接的应用程序之间快速切换,而无需更改运行时共享库​​路径选项(该选项可能很冗长)或编辑配置文件。

这是文档的链接。
“关于应用程序编译器选项”

请注意,文档中默认值为 true。但是,如果您正在加载 flex-config.xml 文件(默认或自定义),您还应该检查该文件中是否存在此设置以及它是什么。根据我的经验,frameworks/flex-config.xml 的默认值实际上是 false。然而,在上面的示例中,这似乎可以以其他方式设置。


(我们使用与 ANT 不同的构建系统,所以我不太熟悉您需要的 build.xml 语法。)

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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文