如何自动构建Flex组件库?

我想自动构建一个flex库项目而不是当前进程,这涉及我们的一个开发人员在他的机器上编译它然后我们检查生成的.swc文件.这很糟糕.

我是从Java开发人员的角度来看这个,所以我很难掌握Flex Builder 3应用程序中提供的编译工具,但这就是我已经拥有的:

>我创建了一个正确加载ant任务库的ant文件,因此可以执行< mxmlc />和< compc />任务.
>我找到了我需要构建的源代码,并且知道我想要最终使用什么类型的.swc.

我想要的是一个ant脚本,它将完成以下步骤:

>我们将项目中的所有源(actionscript和MXML)和资产构建到swc文件中.
>提取并优化library.swf文件

到目前为止我有这个:

<target name="compile-component" depends="init">
  <compc output="${DEPLOY_DIR}/${SWC_NAME}.swc">
    <source-path path-element="${FLEX_HOME}/frameworks"/>
    <source-path path-element="${SRC_DIR}"/>
  </compc>
</target>

但是,它不包括任何内容

[compc] Loading configuration file /Applications/Adobe Flex Builder 3/sdks/3.2.0/frameworks/flex-config.xml
[compc] Adobe Compc (Flex Component Compiler)
[compc] Version 3.2.0 build 3958
[compc] copyright (c) 2004-2007 Adobe Systems,Inc. All rights reserved.
[compc] 
[compc] Error: nothing was specified to be included in the library
[compc] 
[compc] Use 'compc -help' for information about using the command line.

看起来我需要枚举我想要包含在库中的每个类,这是……荒谬的.一定会有更好的办法.我该怎么做呢?

解决方法

您可以执行以下操作…它将从源路径中获取所有文件并将其转换为compc任务随后可以使用的格式.
<fileset id="project.test.dir.fileset" dir="${project.test.dir}">
    <include name="**/*.as" />
    <include name="**/*.mxml" />
</fileset>
<property name="project.test.dir.fileset" refid="project.test.dir.fileset" />

<!-- Convert the test files into a compiler friendly format. -->
<pathconvert property="project.test.dir.path" pathsep=" " refid="project.test.dir.fileset">
    <compositemapper>
        <chainedmapper>
            <globmapper from="${project.test.dir}/*" to="*" handledirsep="true" />
            <mapper type="package" from="*.as" to="*" />
        </chainedmapper>
        <chainedmapper>
            <globmapper from="${project.test.dir}/*" to="*" handledirsep="true" />
            <mapper type="package" from="*.mxml" to="*" />
        </chainedmapper>
    </compositemapper>
</pathconvert>

<compc headless-server="true" default-frame-rate="${flex.default-frame-rate}" debug="${flex.compiler.debug.mode}" output="${build.swc.dir}/${test.component.name}.swc" include-classes="${project.test.dir.path}" directory="false">
    <source-path path-element="${project.test.dir}" />
    &dependencies;
</compc>

我们用它来生产swcs用于测试目的.

相关文章

一:display:flex布局display:flex是一种布局方式。它即可以...
1. flex设置元素垂直居中对齐在之前的一篇文章中记载过如何...
移动端开发知识点pc端软件和移动端apppc端软件是什么,有哪些...
最近挺忙的,准备考试,还有其他的事,没时间研究东西,快周...
display:flex;把容器设置为弹性盒模型(设置为弹性盒模型之后...
我在网页上运行了一个Flex应用程序,我想使用Command←组合键...