将编译器常量与<compc> ant task </compc>一起使用

时间:2010-12-03 03:08:25

标签: flex ant mxmlc compc

我正在将现有的构建脚本从<mxmlc />转换为<compc />以生成swc。

但是,构建失败,给出错误:

[compc] C:\xxxx\LogViewer.mxml(32):  Error: Access of undefined property VERSION.
[compc]
[compc] private static const VERSION:String = CONFIG::VERSION;

在我的蚂蚁任务中,我有以下定义:

    <compc compiler.as3="true" output="${output.dir}/${swc.name}.swc" incremental="true" fork="true" maxmemory="512m" compiler.show-deprecation-warnings="false">
        <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
        <source-path path-element="${srcdir}" />
        <include-sources dir="${srcdir}" includes="*" />
        <external-library-path dir="${swc.libs.dir}" append="true">
            <include name="*.swc" />
        </external-library-path>
        <external-library-path dir="${output.common.swc.dir}" append="true">
            <include name="*.swc" />
        </external-library-path>
        <compiler.define name="CONFIG::VERSION" value="${build.version}" />
        <compiler.define name="CONFIG::RELEASE" value="${config.release}" />
        <compiler.define name="CONFIG::DEBUG" value="${config.debug}" />
        <compiler.define name="CONFIG::AUTOMATION" value="false" />
    </compc>

这种方法适用于任务,但现在失败了。

将编译器常量与compc一起使用的正确方法是什么?

2 个答案:

答案 0 :(得分:4)

字符串值需要放在单引号中。例如:

<compiler.define name="CONFIG::VERSION" value="'${build.version}'" />

Flex Ant任务确实非常令人沮丧,主要是由于缺乏文档。我挣扎了一段时间,直到我弄清楚了。

答案 1 :(得分:1)

我们在构建中做了类似的事情,唯一的区别是我们没有编译器位:

 <define name="CONFIG::build" value="5" />