如何编译具有多个命名空间的 SWC 文件

发布于 2024-08-06 11:36:45 字数 1203 浏览 4 评论 0原文

我正在尝试从给定的 ActionScript 类列表编译 SWC 文件。我正在使用 compc 编译器。问题是,有太多的类被分组到多个命名空间中,我发现指定要包含在 SWC 中的每个单独的类非常繁琐。有没有更简单的方法可以做到这一点,例如简单地指定这些类的根目录?

目前我有这样的东西:

<?xml version="1.0"?>
<flex-config xmlns="http://www.adobe.com/2006/flex-config">
  <output>C:\SomeFolder\testSWC.swc</output>
  <compiler>
    <source-path>.</source-path>
  </compiler>
  <include-classes>
    <class>SomeNamespaceOne.One</class>
    <class>SomeNamespaceOne.Two</class>
    <class>SomeNamespaceOne.Three</class>
    <class>SomeNamespaceOne.Four</class>
    ...
    <class>SomeNamespaceFifty.One</class>
  </include-classes>
</flex-config> 

但我想要这样的东西:

<?xml version="1.0"?>
<flex-config xmlns="http://www.adobe.com/2006/flex-config">
  <output>C:\SomeFolder\testSWC.swc</output>
  <compiler>
    <source-path>. </source-path>
  </compiler>
  <include-classes>
    <class>SomeRootDirectoryOfClassesToCompile</class>
  </include-classes>
</flex-config>

这可能吗?

I'm trying to compile an SWC file from a list of given ActionScript classes. I'm using the compc compiler. The problem is that there are so many classes grouped into multiple namespaces that I am finding it very tedious to specify each individual class to be included in the SWC. Is there any easier way of doing this like just simply specifying a root directory of these classes?

At the moment I have something like this:

<?xml version="1.0"?>
<flex-config xmlns="http://www.adobe.com/2006/flex-config">
  <output>C:\SomeFolder\testSWC.swc</output>
  <compiler>
    <source-path>.</source-path>
  </compiler>
  <include-classes>
    <class>SomeNamespaceOne.One</class>
    <class>SomeNamespaceOne.Two</class>
    <class>SomeNamespaceOne.Three</class>
    <class>SomeNamespaceOne.Four</class>
    ...
    <class>SomeNamespaceFifty.One</class>
  </include-classes>
</flex-config> 

But I want something like this:

<?xml version="1.0"?>
<flex-config xmlns="http://www.adobe.com/2006/flex-config">
  <output>C:\SomeFolder\testSWC.swc</output>
  <compiler>
    <source-path>. </source-path>
  </compiler>
  <include-classes>
    <class>SomeRootDirectoryOfClassesToCompile</class>
  </include-classes>
</flex-config>

Is this possible?

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

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

发布评论

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

评论(2

反目相谮 2024-08-13 11:36:45

我们想要在《蚂蚁》中看到类似的东西。

我假设您没有使用 Flex Builder。在这种情况下,我绝对会推荐使用 Adob​​e 提供的 Ant 和 Flex Ant 任务。即使您使用 Ant,做您想做的事情也不容易,所以我在下面包含了我们的代码。

以下是我们的代码。我不记得我从哪里得到这个想法,所以无法感谢它的来源:)

        <pathconvert property="XXX.classes" pathsep=" ">

        <fileset dir="${basedir}/XXX/src">
            <include name="**/*.as"/>
            <include name="**/*.mxml"/>
        </fileset>

        <compositemapper>
            <packagemapper from="${basedir}\XXX\src\*.as" to="*"/>
            <packagemapper from="${basedir}/XXX/src/*.as" to="*"/>
            <packagemapper from="${basedir}\XXX\src\*.mxml" to="*"/>
            <packagemapper from="${basedir}/XXX/src/*.mxml" to="*"/>
        </compositemapper>

    </pathconvert>

    <compc optimize="true" debug="false"
    include-classes="${XXX.classes}" output="${BUILD_FOLDER}/XXX.swc">
            </compc>

We wanted something similar, in "Ant".

I am assuming you are not using Flex Builder. In that case, I will definitely recommend using Ant and Flex Ant tasks available from Adobe. Even when you use Ant, its not easy doing what you want to do, so I am including our code below.

Following is our code. I don't remember where I got the idea from, so cannot thank the source for it :)

        <pathconvert property="XXX.classes" pathsep=" ">

        <fileset dir="${basedir}/XXX/src">
            <include name="**/*.as"/>
            <include name="**/*.mxml"/>
        </fileset>

        <compositemapper>
            <packagemapper from="${basedir}\XXX\src\*.as" to="*"/>
            <packagemapper from="${basedir}/XXX/src/*.as" to="*"/>
            <packagemapper from="${basedir}\XXX\src\*.mxml" to="*"/>
            <packagemapper from="${basedir}/XXX/src/*.mxml" to="*"/>
        </compositemapper>

    </pathconvert>

    <compc optimize="true" debug="false"
    include-classes="${XXX.classes}" output="${BUILD_FOLDER}/XXX.swc">
            </compc>
故笙诉离歌 2024-08-13 11:36:45

就像 Tanmay 所说,您应该使用 ANT 任务来让生活变得更轻松,但还有一个更简单的方法,在 compc ant 任务中包含整个目录。如果您只需要包含 src.dir 中的所有内容,您可以这样做:

<compc output="${target.dir}/foo.swc">
     <source-path path-element="${src.dir}"/>
     <include-sources dir="${src.dir}">
          <include name="**/*" />
     </include-sources>
</compc>

Like Tanmay said, you should use the ANT tasks to make life easier, but there's an even simpler wach include an entire directory in the compc ant task. If you just need to include everything in src.dir you can do it like this:

<compc output="${target.dir}/foo.swc">
     <source-path path-element="${src.dir}"/>
     <include-sources dir="${src.dir}">
          <include name="**/*" />
     </include-sources>
</compc>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文