views:

202

answers:

1

I'm building a flex .swc library using Ant, and many of the assets that are supposed to be in the file are not being copied, instead creating 0-byte entries in the .swc.

Here is the ant compc target that is doing the creation. I've tried both compiler.include-libraries and compiler.library-path here, which is why the latter is still present and commented out. Neither worked.

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

The output of this is a .swc file like this:

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

However, the Flex Builder output is this:

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

In your ant script, include a source path element that references the root location where the images can be found as follows:

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

You should be able to find a particular image from that root location. For example, the result of the following:

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

should include the 0-byte the images referenced in your swc.

Peter Z