2

首先,这是我想做的:

* Compile my library code into a SWC
* Do not staticly link the Flex framework

起初,我尝试设置一个 Flex 模块,单击“库”和“将框架用作 RSL”按钮。然而,这并没有将我的任何代码编译到 SWC 中,它基本上只是编译了整个 Flex 框架的新 SWC,包括所有资源和类。

然后,我设法使用自定义编译器配置将我的类放入构建中,但它仍然包含我在库代码中引用的少数 Flex 类。

最后,我想我可以使用自定义 flex-config.xml 文件,使用<library-path append="false"></library-path>然后使用自定义命令行参数(以及来自 ant)删除对库的父引用,添加-compiler.external-library-path对 SDK 和 PlayerGlobal.swc 的引用。这应该可行,但是当我使用自定义配置文件时,Idea 不会让我设置命令行参数:'(

任何建议都非常感谢!

4

1 回答 1

2

好的,通过 Idea 论坛上的帮助、大量谷歌搜索和随机实验,这就是有效的方法。请注意,有些参数被指定为“{name}”,有些是“${name}”。不,我不知道为什么:-/

<!-- Specifies the minimum player version that will run the compiled SWF. -->
<!-- 9.0.124 is the April 2008 security release -->
<target-player>9.0.124</target-player>

<compiler>

    <source-path>
        <path-element>src</path-element>
    </source-path>

    <incremental>true</incremental>

    <keep-as3-metadata append="true">
        <name>Inject</name>
        <name>InjectInto</name>
        <name>InjectIntoContents</name>
        <name>Singleton</name>
        <name>PostConstruct</name>
    </keep-as3-metadata>

    <!-- Remove the "include" library path. -->
    <library-path append="false"></library-path>

    <!-- Set up an "external library" path that is compiled against but not linked. -->
    <!-- SWCs not used for SP are left in but commented out to make it easier to copy this script -->
    <external-library-path>
        <path-element>${flexlib}/libs/player/{targetPlayerMajorVersion}/playerglobal.swc</path-element>
        <path-element>${flexlib}/libs/framework.swc</path-element>
        <!--<path-element>${flexlib}/libs/flex.swc</path-element>-->
        <!--<path-element>${flexlib}/libs/rpc.swc</path-element>-->
        <!--<path-element>${flexlib}/libs/utilities.swc</path-element>-->
        <!--<path-element>${flexlib}/libs/datavisualization.swc</path-element>-->
    </external-library-path>

</compiler>

<static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>

<include-classes>
    <class>net.expantra.smartypants.impl.InjectorImpl</class>
</include-classes>

<output>./build/SmartyPants-IOC.swc</output>

于 2010-01-19T00:06:52.267 回答