使用 COMPC 编译 SWC,不包括第 3 方库

发布于 2024-07-27 17:46:18 字数 221 浏览 5 评论 0原文

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

这显然意味着任何使用我的库的人都需要这两个库,但我更喜欢这种方式。 我没有使用 Flex/Flashbuilder,我知道它允许您选择要包含在 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.

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.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒浓于脸红 2024-08-03 17:46:18

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

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

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

<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 放在单独的文件夹中,或者直接针对您的 SWC,如上面的示例所示

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

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.

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>

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

怪我闹别瞎闹 2024-08-03 17:46:18

我不认为你可以只要求其他人具有依赖关系。 它可以使用第三方库作为运行时共享库​​,您需要 url 上提供的第三方库,并在编译时使用以下内容 -runtime-shared-libraries=http://www.yourhost.com/my .swf-外部库路径+=my.swc
请参阅 Adobe 文档,了解有关 RSL 的完整详细信息< /a>

I don't think you can just require that someone else has the dependencies. It could use the third party libraries as Runtime Shared Libraries, you will need the third party libs available on the url and use the following when compiling -runtime-shared-libraries=http://www.yourhost.com/my.swf -external-library-path+=my.swc.
See the Adobe docs for full details about RSLs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文