使用 COMPC 编译 SWC,不包括 3rd 方库 [英] Compile a SWC using COMPC, excluding 3rd party libs

查看:30
本文介绍了使用 COMPC 编译 SWC,不包括 3rd 方库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自己构建的代码库.它依赖于 2 个其他(第三方)库.目前,当我将库编译为 swc 时,两个第三方库都包含在内.我正在寻找一种方法来针对第三方库编译我的代码库,但不将它们包含在已编译的 swc 中.

I have a code library that I have built. It relies on 2 other (third party) libraries. At the moment, when I compile the library into a swc, both third party libraries are included. I am looking for a way to compile my code library against the third party libraries, but without including them in the compiled swc.

这显然意味着使用我的库的任何人也需要这两个库,但我更喜欢这种方式.我没有使用 Flex/Flashbuilder,我知道它允许您选择要包含在 swc 中的类.

This would obviously mean that anyone using my library would need both libraries as well, but I would prefer it this way. I am not using Flex/Flashbuilder which I know allows you to choose the classes to include in a swc.

谢谢

推荐答案

-external-library-path+=my.swc 是答案,尽管不需要使用 -runtime-shared-libraries.使用此参数允许您指定将在编译中使用但不会放入 swc 的代码.显然,当使用 swc 时,仍然需要这个排除的 clode.

-external-library-path+=my.swc is the answer, though there is no need for using -runtime-shared-libraries. Using this argument allows you to specify code which will be used in compilation but not placed into the swc. Obviously this excluded clode will still be needed when the swc is used.

特别值得注意的是,与其他参数不同,-external-library-path 使用 += 而不是 =.使用 just = 您将打破对玩家低级类和添加的任何其他外部库的引用.

Of particular note is that unlike other arguments, -external-library-path uses += not =. By using just = you will break the refernce to the players low level classes and any other external libraries added.

如果您使用带有 Ant 的 FlexTasks,您的目标可能如下所示:

If you are using FlexTasks w/ Ant, your target might look like this:

<target name="compileToSWC">
    <compc 
        output="${bin}/${SWCName}">
            <source-path path-element="${src}"/>
            <!-- Source to include in SWC -->
            <include-sources dir="${src}" includes="*"/>
            <!-- Libs to exclude from the swc - Note append="true" which is equivillant to using +=-->
            <external-library-path file="${thirdparty.libs}/SomeLib.swc" append="true"/>
            <external-library-path file="${thirdparty.libs}/SomeOtherLib.swc" append="true"/>
    </compc>
</target>

您还可以将 external-library-path 指向一个文件夹,在这种情况下,它将包含其中的所有 swc.请注意,如果您遵循 Adob​​e 的 FlexTasks 指南并将 flexTasks.jar 文件放入 libs 文件夹并使用 external-library-path 将其作为文件夹定位,则 flexTasks.jar 本身将被排除,导致构建失败.要解决此问题,请将 flexTasks.jar 放在单独的文件夹中,或者像上面的示例一样直接定位您的 swcs

You can also point external-library-path to a folder in which case it will include all swcs inside. Note that if you follow Adobe's FlexTasks guidelines and place the flexTasks.jar file into your libs folder and target it as a folder using external-library-path, the flexTasks.jar is itself excluded, causing the build to fail. To solve this, either place the flexTasks.jar in a separate folder or target your swcs directly as in the above example

这篇关于使用 COMPC 编译 SWC,不包括 3rd 方库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆