4

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

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

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

在我的 ant 任务中,我定义了以下内容:

    <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 一起使用的正确方法是什么?

4

2 回答 2

5

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

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

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

于 2011-04-19T01:38:17.367 回答
1

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

 <define name="CONFIG::build" value="5" />
于 2011-01-11T07:05:12.720 回答