在 ant/nant 中构建 Flex 项目 [英] Building Flex projects in ant/nant

查看:21
本文介绍了在 ant/nant 中构建 Flex 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的公司经常遇到 Flex 项目中的构建中断问题.出现此问题的主要原因是开发人员在其本地机器上进行的构建与在构建机器上进行的构建有着根本的不同.开发人员使用 FlexBuilder/eclipse 构建项目,构建机器使用命令行编译器.不可避免地,运行构建的 {projectname}-config.xml 和/或批处理文件与 eclipse 使用的项目文件不同步,因此构建在开发者的机器上成功,但是在构建机器上失败.

我们开始编写实用程序来将 FlexBuilder 的项目文件转换为 {projectname}-config.xml 文件,但它是 a) 未记录和 b) 一个可怕的黑客.

我查看了 -dump-config 开关以获取配置文件,但这有几个问题:1) 生成的配置文件具有在我们的环境中不起作用的绝对路径(一些开发人员使用 macs,某些 Windows 机器),以及 2) 仅在从 IDE 运行时才能正常工作,因此无法构建到构建过程中.

明天,我们将讨论几个选项,我都不太喜欢:

a) 向 Subversion 添加签入后事件以删除这些绝对引用,或
b) 添加一个删除绝对引用的预构建过程.

我不敢相信我们是第一批遇到此问题的开发人员,但我在 Google 上找不到任何好的解决方案.其他小组是如何处理这个问题的?

解决方案

我发现将 ant 与 Flexbuilder 一起使用的未记录要求之一是在您的 ant 脚本中设置变量 FLEX_HOME.通常在 build.xml 中有以下内容:

<属性环境="env"/><属性名称="build.dir"值="build"/><属性名称="swf.name"值="MyProjectSwf"/><属性名称="root.mxml"值="Main.mxml"/><属性名称="locale"值="en_US"/><属性名称="FLEX_HOME"值="${env.FLEX_HOME}"/>

这可能看起来很麻烦,但如果您为开发人员使用多个平台,这是一种更合理的方法来获得跨平台和环境的一致性.

HTH

We have a recurring problem at my company with build breaks in our Flex projects. The problem primarily occurs because the build that the developers do on their local machines is fundamentally different from the build that occurs on the build machine. The devs are building the projects using FlexBuilder/eclipse and the build machine is using the command line compilers. Inevitably, the {projectname}-config.xml and/or the batch file that runs the build get out of sync with the project files used by eclipse, so the the build succeeds on the dev's machine, but fails on the build machine.

We started down the path of writing a utility program to convert FlexBuilder's project files into a {projectname}-config.xml file, but it's a) undocumented and b) a horrible hack.

I've looked into the -dump-config switch to get the config files, but this has a couple of problems: 1) The generated config file has absolute paths which doesn't work in our environment (some developers use macs, some windows machines), and 2) only works right when run from the IDE, so can't be build into the build process.

Tomorrow, we are going to discuss a couple of options, neither of which I'm terribly fond of:

a) Add a post check-in event to Subversion to remove these absolute references, or
b) add a pre-build process that removes the absolute reference.

I can't believe that we are the first group of developers to run across this issue, but I can't find any good solutions on Google. How have other groups dealt with this problem?

解决方案

I found that one of the undocumented requirements for using ant with Flexbuilder was to have the variable FLEX_HOME set within your ant script. Typically within build.xml have the following:

<!– Module properties –>
<property environment="env"/>
<property name="build.dir" value="build"/>
<property name="swf.name" value="MyProjectSwf"/>
<property name="root.mxml" value="Main.mxml"/>
<property name="locale" value="en_US"/>
<property name="FLEX_HOME" value="${env.FLEX_HOME}"/>

This may seem like a hassle but it is a far more reasonable approach to obtaining consistency across platforms and environments if you are using multiple platforms for your developers.

HTH

这篇关于在 ant/nant 中构建 Flex 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆