我想從哈德森傳遞到一個Flex應用程序的內部版本號。定義在行動腳本
我發現Adobe的文檔(http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html)在條件編譯看起來應該可以解決它,但我必須錯過一些東西。
所以在我的Ant構建文件,我有: -
<mxmlc
file="${app.dir}/${application.name}.mxml"
output="${dist.dir}/${application.name}.swf"
context-root="${application.name}"
debug="true"
locale="${locales}"
allow-source-path-overlap="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<compiler.library-path dir="${lib.dir}" append="true">
<include name="*.swc" />
</compiler.library-path>
<define name="BUILD::BuildNumber" value="'20100707.800'"/>
<source-path path-element="${src.dir}"/>
<source-path path-element="${cfg.dir}"/>
<source-path path-element="${locale.dir}" />
</mxmlc>
然後我試圖檢索與
public static const buildNumber:String = BUILD::BuildNumber;
但是編譯器與拒絕:
SomeModel.as(31): col: 47 Error: Access of undefined property BUILD.
[mxmlc] private static const _buildNumber:String = BUILD::BuildNumber;
有什麼建議麼?
根據有關條件編譯的文檔;看起來你正在做的事情是完全正確的。我有點不知所措。 http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html。 Flex編譯器是否將您的公共靜態常量轉換爲帶有私有變量的getter/setter方法?這種轉換可能會導致這個問題? – JeffryHouser 2010-07-07 14:12:28
可能。現在看來是直的。我可以在Flash Builder中使用它,在附加命令部分中使用 -define + = BUILD :: BuildNumber,'00000000.000' 。它只是不會從ant mxmlc構建中傳遞。 – Decado 2010-07-08 08:16:15