开发者

Using compiler constants with <compc /> ant task

开发者 https://www.devze.com 2023-01-28 07:50 出处:网络
I\'m converting an existing build script from <mxmlc /> to <compc /> to generate a swc. However, the build is failing, giving the error:

I'm converting an existing build script from <mxmlc /> to <compc /> to generate a swc.

However, the build is failing, giving the error:

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

In my ant task, I have the following defined:

    <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>

This approa开发者_开发百科ch worked fine with the task, but is now failing.

What's the correct way to use compiler constants with compc?


String values need to be put in single quotes. For instance:

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

The Flex Ant tasks really are incredibly frustrating, mainly due to the lack of documentation. I struggled with this for a while until I figured it out.


We do something similar in our build, and the only difference I can see is that we don't have the compiler bit:

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

精彩评论

暂无评论...
验证码 换一张
取 消