3

我正在尝试编写一个 ant 构建脚本来构建我小组的 flex 应用程序,但我遇到了一些障碍,我希望 SO 上的某个人以前见过这些障碍。

我们有两个项目构建到 SWC 中,这些组件包含资源包。一个 SWC 需要另一个 SWC。我们有一个项目构建到我们的应用程序(SWF)中,它使用了两个 SWC。

当我构建 SWC 时,我没有收到关于找不到资源包的投诉,当我在 winzip 中打开 SWC 时,我可以看到这些包(例如,在 /locale/EN_US 中)

然而,当我构建 SWF 时,我收到关于无法在两个 swc 中找到资源包的抱怨,但没有关于无法找到任何其他资源包(如 flex 框架的资源包)的抱怨。这是我从 ant 那里得到的信息:

[mxmlc] Error: Unable to resolve resource bundle "whatever" for locale "en_US".
[mxmlc]

当然,我不是第一个遇到这个问题的人,所以有人知道这里有什么问题吗?我是在构建错误的 SWC 还是 SWF?

作为参考,这是我使用 compc 的构建任务之一(由于某种原因,我无法显示开始目标标记)

    <path id="facet.sourcePath">
        <pathelement location="${flex.facet.src}"/>
    </path>
    <property name="facet.sourcePath" refid="facet.sourcePath"/>
    <echo message="sourcePath is ${facet.sourcePath}"/>
    <fileset dir="${facet.sourcePath}" id="facet.sources">
        <include name="**/*.as"/>
    </fileset>
    <pathconvert property="facet.classes" pathsep=" " refid="facet.sources">
        <compositemapper>
            <chainedmapper>
                <globmapper from="*.as" to="*"/>
                <globmapper from="${facet.sourcePath}\*" to="*" handledirsep="true" />
            </chainedmapper>
            <chainedmapper>
                <globmapper from="*.mxml" to="*"/>      
                <globmapper from="${facet.sourcePath}\*" to="*" handledirsep="true" />
            </chainedmapper>
        </compositemapper>                     
    </pathconvert>           
    <echo message="classes: ${facet.classes}"/>
    <compc output="${flex.lib.output}/${facet.swc.name}" locale="EN_US" 
                include-classes="${facet.classes}" directory="false"
                target-player="10.0.0" 
                >
        <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
        <include-resource-bundles bundle="foo"/>
        <include-resource-bundles bundle="bar"/>
        <include-resource-bundles bundle="whatever"/>
        <sp path-element="${flex.facet.dir}/locale/{locale}"/>
        <keep-as3-metadata name="Bindable"/>
        <keep-as3-metadata name="Remotable"/>
        <keep-as3-metadata name="Embed"/>
        <keep-as3-metadata name="Event"/>
        <keep-as3-metadata name="ResourceBundle"/>
        <source-path path-element="${flex.facet.src}"/>
    <compiler.library-path append="true" dir="${flex.framework.lib}">
      <include name="*.swc"/>
      <include name="../locale/${locale}"/>
    </compiler.library-path>
    <compiler.library-path append="true" dir="${flex.rsm.lib}">
      <include name="*.swc"/>
    </compiler.library-path>
  </compc>
</target>

这是我的 mxmlc 任务:

<target name="flex.webapp.compile" description="compiles your flex app">
      <mxmlc file="${flex.webapp.src}\RSM.mxml"
           output="${flex.webapp.deploy}\ant_test\RSM.swf"
           use-network="true" 
           keep-generated-actionscript="true" 
           debug="true" 
           locale="en_US"
           incremental="true"
           actionscript-file-encoding="utf-8" 
           target-player="10.0.0" 
        >
        <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
        <include-resource-bundles bundle="RSM"/>
        <source-path path-element="${FLEX_HOME}/frameworks"/>   
        <source-path path-element="${flex.webapp.src}" />         
        <source-path path-element="${flex.webapp.dir}/locale/en_US" />
        <source-path path-element="${flex.rsm.lib}" />
        <sp path-element="${flex.core.dir}/locale/{locale}"/>
        <sp path-element="${flex.facet.dir}/locale/{locale}" /> 
        <compiler.library-path append="true" dir="${flex.framework.lib}">
            <include name="*.swc"/>
            <!--include name="../locale/${locale}"/-->
        </compiler.library-path>
        <compiler.library-path append="true" dir="${flex.rsm.lib}">
            <include name="*.swc"/>
            <include name="../locale/${locale}" />          
            <!--include name="rsm_rb.swc" /-->
        </compiler.library-path>
    </mxmlc>
</target>
4

2 回答 2

5

啊!

在盯着这个问题看了好几个小时后,我意识到这个问题一直在盯着我看。
compc 任务使用'locale="EN_US"',mxmlc 任务使用'locale="en_US"'。
如果有人发布“你遇到过的最愚蠢的工作问题是什么?”,这就是我的答案。

于 2009-02-17T17:32:10.643 回答
0

顺便说一句,它不必那么复杂(即使在 linux 控制台中!),您所需要的只是包含库......

daemonna@NES-KOS-29:~/Desktop/FlexUnit4Turnkey_4.0_sdk_4.0.fxp_FILES/src$ mxmlc -library-path=../libs -locale=en_US App.mxml 
Loading configuration file /home/daemonna/Frameworks/flex_sdk_4.1.0.16076/frameworks/flex-config.xml
Error: Unable to resolve resource bundle "components" for locale "en_US".
....bla bla bla...
Error: Unable to resolve resource bundle "controls" for locale "en_US".

daemonna@NES-KOS-29:~/Desktop/FlexUnit4Turnkey_4.0_sdk_4.0.fxp_FILES/src$ mxmlc -library-path=../libs -library-**path=/home/daemonna/Frameworks/flex_sdk_4.1.0.16076/frameworks/locale/en_US/** -locale=en_US App.mxml 
Loading configuration file /home/daemonna/Frameworks/flex_sdk_4.1.0.16076/frameworks/flex-config.xml
/home/daemonna/Desktop/FlexUnit4Turnkey_4.0_sdk_4.0.fxp_FILES/src/App.swf (37964 bytes)
于 2011-02-25T12:33:59.717 回答