简体   繁体   English

如何使用多个名称空间编译SWC文件

[英]How to compile a SWC file with mulitple namespaces

I'm trying to compile an SWC file from a list of given ActionScript classes. 我正在尝试从给定ActionScript类的列表中编译SWC文件。 I'm using the compc compiler. 我正在使用compc编译器。 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. 问题在于,有这么多的类分组为多个命名空间,我发现指定要包含在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? 这可能吗?

We wanted something similar, in "Ant". 我们想要“蚂蚁”中类似的内容。

I am assuming you are not using Flex Builder. 我假设您没有使用Flex Builder。 In that case, I will definitely recommend using Ant and Flex Ant tasks available from Adobe. 在那种情况下,我绝对会建议使用Adobe提供的Ant和Flex Ant任务。 Even when you use Ant, its not easy doing what you want to do, so I am including our code below. 即使您使用Ant,也不容易完成您想做的事情,因此,我将下面的代码包括在内。

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>

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. 就像Tanmay所说的那样,您应该使用ANT任务使生活更轻松,但是在compc ant任务中甚至包括一个整个目录,甚至更简单。 If you just need to include everything in src.dir you can do it like this: 如果只需要在src.dir中包含所有内容,则可以这样操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM