首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将编译器常量与<compc /> ant任务一起使用

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

Stack Overflow用户
提问于 2010-12-03 11:08:25
回答 2查看 4.6K关注 0票数 4

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

然而,构建失败了,并给出了错误:

代码语言:javascript
复制
[compc] C:\xxxx\LogViewer.mxml(32):  Error: Access of undefined property VERSION.
[compc]
[compc] private static const VERSION:String = CONFIG::VERSION;

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

代码语言:javascript
复制
    <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中使用编译器常量的正确方法是什么?

EN

回答 2

Stack Overflow用户

发布于 2011-04-19 09:38:17

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

代码语言:javascript
复制
<compiler.define name="CONFIG::VERSION" value="'${build.version}'" />

Flex Ant任务真的非常令人沮丧,这主要是因为缺乏文档。我为此挣扎了一段时间,直到我弄明白。

票数 5
EN

Stack Overflow用户

发布于 2011-01-11 15:05:13

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

代码语言:javascript
复制
 <define name="CONFIG::build" value="5" />
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4342109

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档