让 NAnt 检查 SVN 中的已更改文件
为了加快我的 NAnt/CruiseControl.Net/Ivy 持续构建过程,我希望让 NAnt 在执行基于 NAnt 的更新后检查我的本地 PC 上的代码库是否已更改,然后检查代码是否已更改已更改,然后启动重新构建该项目的过程,并可能提出一个标志来构建所有后续组件,无论其更改状态如何。
原因是,我的构建过程目前需要超过 12 分钟才能完成大量工作,我认为我可以通过不构建不会更改的代码来缩短时间,并让开发人员保持精力充沛在办公室也更快乐。
我们已经研究了从构建顺序中删除一些项目,但如果构建树顺序发生任何更改,则都需要它们。
In the interests of trying to speed up my NAnt/CruiseControl.Net/Ivy continuous build process, I was hoping to get NAnt to check if my codebase has changed on my local PC after performing a NAnt-based update, and then if the code has changed, then kick off the process to re-build that project and possibly raise a flag to build all subsequent components, irrespective of their change status.
Reason being, my build process is currently taking well over 12 minutes to complete a lot of work, and I'm thinking that I can get this time down by not building code that isn't going to change, as well as keep the devs in the office happier also.
We have investigated removing some of the projects from the build order, but they are all required in case of any change further up the build tree order.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以看到几个选项
1 - 在 svn up 之前发出 svn status --show-updates 并计算出是否有任何更改(应该像计算响应中的行一样简单 - 我认为最新的文件夹会仅生成 1 行)
2 - 从 svn-update 任务更改为 exec 任务,并将 svn 的输出重定向到测试文件,您可以在该文件中进行后期处理以确定是否进行了任何更新(类似于第一个选项)。
3 - 在 svn up 之后通过基于 http://jonathanmalek.com/wp 的任务获取 svn 日志/?p=244 然后处理 xml 以确定是否进行了任何更改。仅当您保证仅增加 1 修订版号时,此功能才有效,因为它仅获取上次修订版的日志信息。对此的变体是抓取 svn up 之前和之后的日志,然后比较它们。
就我个人而言,我会选择选项 2。在最新的工作目录上运行 svn up 会产生一行(在修订版中),因此从使用 svn update 任务更改为以下内容:
现在您可以使用 if="${source.change =='true'}" 和 except="${source.changed=='true'}" 来确定您应该何时执行构建和通知的其余部分
Couple of options I can see
1 - issue an svn status --show-updates before the svn up and work out if there are any changes ( should be as simple as counting the lines in the response - I think and up to date folder would generate only 1 line )
2 - change from svn-update task to exec task and redirect the output from svn up into a test file that you can post process to determine if any updates were made ( similar to first option ).
3 - Grab the svn log after the svn up with a task based on http://jonathanmalek.com/wp/?p=244 and then process the xml to determine if any changes were made. This would only work if you were guaranteed only 1 rev number increase as it only gets log info for last revision. Variation on this would be grab the log before the svn up and after and then compare them.
Personally I would go with option 2. Running svn up on an up to date working directory results in one line (At revision ) therefore change from using the svn update task to the following:
now you can use if="${source.change=='true'}" and unless="${source.changed=='true'}" to determine when you should and should execute the remainder of your build and notifications