本文介绍了使用ant mxmlc任务将runtime-library-path添加到Flex构建配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个flex项目,将其链接到一些RLS.在Flex Builder中设置项目时,相应的构建配置"(我是通过将-dump-config添加到编译器选项中获得的)生成(除其他事项外)这样的标记:

I'm trying to build a flex project, linking it to some RLSs. When setting up the project in Flex Builder, the corresponding "build configuration" (that I got by adding -dump-config to the compiler options) generates (among other things) a tag like this :

<runtime-shared-libraries>
  <url>some-lib.swf</url>
  <url>some-other-lib.swf</url>
</runtime-shared-libraries>

现在,我正在尝试使用mxmlc ant任务来构建项目,但似乎无法为共享库添加任何引用.我以为这样的事情会有帮助,但是没有帮助:

Now, I am trying to build the project using mxmlc ant task, but I can't seem to add any reference to a share-library. I thought something like this would have help, but it didin't:

<!-- Skipping attributes that I don't think are relevant ... -->
<mxmlc ....>
 ...
 <runtime-shared-library-path>
<url rsl-url="some-lib.swf"></url>
<url rsl-url="some-other-lib.swf"></url>
 </runtime-shared-library-path>
</mxmlc>

那么我在这里可能会想念什么?

So what could I be missing here ?

谢谢

推荐答案

您将需要通过"runtime-shared-library-path"上的"path-element"属性指定自定义库的SWC路径.元素,并在指向"SWF"的"url"元素中定义"rsl-url".请注意,这对于每个自定义RSL都是必需的.

You will need to specify the path to the SWC of your custom libraries via the "path-element" attribute on the "runtime-shared-library-path" element and define the "rsl-url" in the "url" element which points to the SWF. Note that this is needed for each custom RSL individually.

要实现此目的,您需要解压缩SWC并从其中解压缩SWF,以便编译器可以将其复制到输出文件夹中.

To achieve this you'll need to unpack the SWC and extract the SWF from it so that the compiler can copy it to the output folder.

此处的帖子中有一条评论,其中描述了如何将Mate框架作为RSL包括在内.我在下面添加了有趣的部分.

There is a comment on a post here that describes how to include the Mate framework as an RSL. I added the interesting part below.

<macrodef name="create-rsl">
  <attribute name="rsl-dir" />
  <attribute name="swc-dir" />
  <attribute name="swc-name" />
  <sequential>
    <unzip src="@{swc-dir}/@{swc-name}.swc" dest="@{rsl-dir}" >
      <patternset>
        <include name="library.swf" />
      </patternset>
    </unzip>
    <move file="@{rsl-dir}/library.swf" tofile="@{rsl-dir}/@{swc-name}.swf"/>
  </sequential>
</macrodef>

<target name="extract-rsls">
  <!-- Third parties RSLs -->
  <create-rsl rsl-dir="${build.rsls.dir}" swc-dir="${lib.dir}" swc-name="mate" />
</target>
<target name="compile">
  <mxmlc file="${src.dir}/MyApplication.mxml" output="${build.dir}/MyApplication.swf" locale="${locale}" debug="false">
    <!-- Flex default compile configuration -->
    <load-config filename="${flex.frameworks.dir}/flex-config.xml" />

    <!-- Main source path -->
    <source-path path-element="${src.dir}" />

    <runtime-shared-library-path path-element="${lib.dir}/mate.swc">
      <url rsl-url="rsls/mate.swf" />
    </runtime-shared-library-path>
  </mxmlc>
</target>

这篇关于使用ant mxmlc任务将runtime-library-path添加到Flex构建配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 04:26