1

我正在使用 Ant 构建一个 flex .swc 库,并且许多应该在文件中的资产没有被复制,而是在 .swc 中创建 0 字节条目。

这是进行创建的 ant compc 目标。我在这里尝试了 compiler.include-libraries 和 compiler.library-path ,这就是为什么后者仍然存在并被注释掉的原因。都没有奏效。

<compc headless-server="true"
       default-frame-rate="${flex.default-frame-rate}"
       debug="${flex.compiler.debug.mode}"
       directory="false"
       output="${project.swc.dir}/${project.swc.name}.swc">
  <source-path path-element="${project.src.dir}"/>
  <source-path path-element="${FLEX_HOME}/frameworks"/>
  <compiler.include-libraries dir="${FLEX_HOME}" append="true">
    <include name="*.swc"/>
    <include name="bundles/{locale}/*.swc"/>
    <include name="libs/*"/>
  </compiler.include-libraries>
  <!-- List of SWC files or directories that contain SWC files. 
  <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
    <include name="libs" />
    <include name="../bundles/{locale}" />
  </compiler.library-path>-->

  <include-sources dir="${project.src.dir}">
    <include name="**/*.as" />
    <include name="**/*.mxml" />
  </include-sources>
  <include-file name="package/assets/error.png" path="${project.src.dir}/package/assets/error.png" />
  <include-file name="package/assets/folder.png" path="${project.src.dir}/package/assets/folder.png" />
  <include-file name="package/assets/success.png" path="${project.src.dir}/package/assets/success.png" />
</compc>

其输出是一个 .swc 文件,如下所示:

Archive:  flex/package/bin/package.swc
  Length     Date   Time    Name
 --------    ----   ----    ----
        0  10-16-08 12:59   mx/controls/NumericStepper.png
     4741  10-16-08 12:59   locale/en_US/rpc.properties
     1222  10-30-08 22:27   locale/en_US/core.properties
     1130  10-30-08 22:27   locale/en_US/formatters.properties
        0  10-16-08 12:59   mx/containers/ControlBar.png
     6460  10-16-08 12:59   locale/en_US/messaging.properties
        0  10-16-08 12:59   mx/controls/Spacer.png
     3170  10-30-08 22:27   locale/en_US/controls.properties
      641  10-30-08 22:27   locale/en_US/effects.properties
      962  10-16-08 13:00   locale/en_US/logging.properties
        0  10-16-08 12:59   mx/controls/List.png
        0  10-16-08 12:59   mx/controls/Tree.png
        0  10-16-08 12:59   mx/containers/HBox.png
        0  10-16-08 12:59   mx/controls/Button.png
   334062  09-09-09 09:34   catalog.xml
        0  10-16-08 12:59   mx/controls/VScrollBar.png
        0  10-16-08 12:59   mx/containers/Box.png
      638  10-30-08 22:27   locale/en_US/containers.properties
     1091  10-30-08 22:27   locale/en_US/SharedResources.properties
        0  10-16-08 12:59   mx/controls/HScrollBar.png
        0  10-16-08 12:59   mx/controls/TextArea.png
      518  10-30-08 22:27   locale/en_US/skins.properties
        0  10-16-08 12:59   mx/controls/ProgressBar.png
     5251  09-08-09 12:44   package/assets/success.png
   847017  09-09-09 09:34   library.swf
     1572  10-30-08 22:27   locale/en_US/collections.properties
        0  10-16-08 12:59   mx/controls/Label.png
      315  09-08-09 12:44   package/assets/folder.png
        0  10-16-08 12:59   mx/controls/TextInput.png
      504  10-30-08 22:27   locale/en_US/styles.properties
        0  10-16-08 12:59   mx/containers/TitleWindow.png
     5316  09-08-09 12:44   package/assets/error.png
        0  10-16-08 12:59   mx/controls/DataGrid.png
        0  10-16-08 12:59   mx/controls/CheckBox.png
        0  10-16-08 12:59   mx/containers/Panel.png
 --------                   -------
  1214610                   35 files

然而,Flex Builder 的输出是这样的:

Archive:  ./bin/package-flex_base.swc
  Length     Date   Time    Name
 --------    ----   ----    ----
      463  03-04-09 12:58   mx/controls/NumericStepper.png
     4741  03-04-09 12:57   locale/en_US/rpc.properties
     1222  03-19-09 02:43   locale/en_US/core.properties
     1130  03-19-09 02:43   locale/en_US/formatters.properties
      510  03-04-09 12:58   mx/containers/ControlBar.png
     6460  03-04-09 12:57   locale/en_US/messaging.properties
      405  03-04-09 12:58   mx/controls/Spacer.png
     3170  03-19-09 02:43   locale/en_US/controls.properties
      641  03-19-09 02:43   locale/en_US/effects.properties
      962  03-04-09 12:58   locale/en_US/logging.properties
      382  03-04-09 12:58   mx/controls/List.png
      373  03-04-09 12:58   mx/controls/Tree.png
      555  03-04-09 12:58   mx/containers/HBox.png
      483  03-04-09 12:58   mx/controls/Button.png
   337860  09-09-09 09:22   catalog.xml
      425  03-04-09 12:58   mx/controls/VScrollBar.png
      649  03-04-09 12:58   mx/containers/Box.png
      638  03-19-09 02:43   locale/en_US/containers.properties
     1091  03-19-09 02:43   locale/en_US/SharedResources.properties
      372  03-04-09 12:58   mx/controls/HScrollBar.png
      409  03-04-09 12:58   mx/controls/TextArea.png
      518  03-19-09 02:43   locale/en_US/skins.properties
      313  03-04-09 12:58   mx/controls/ProgressBar.png
     5251  09-08-09 12:44   package/assets/success.png
   868260  09-09-09 09:22   library.swf
     1572  03-19-09 02:43   locale/en_US/collections.properties
      401  03-04-09 12:58   mx/controls/Label.png
      315  09-08-09 12:44   package/assets/folder.png
      374  03-04-09 12:58   mx/controls/TextInput.png
      504  03-19-09 02:43   locale/en_US/styles.properties
      542  03-04-09 12:58   mx/containers/TitleWindow.png
     5316  09-08-09 12:44   package/assets/error.png
      397  03-04-09 12:58   mx/controls/DataGrid.png
      670  03-04-09 12:58   mx/controls/CheckBox.png
      537  03-04-09 12:58   mx/containers/Panel.png
 --------                   -------
  1247911                   35 files
4

1 回答 1

1

在您的 ant 脚本中,包括一个源路径元素,该元素引用可以找到图像的根位置,如下所示:

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

您应该能够从该根位置找到特定图像。例如,以下结果:

find $FLEX_HOME/frameworks/projects/framework/src -name '*.png'

应包括 0 字节图像在您的 swc 中引用。

于 2009-11-19T16:56:23.870 回答