使用 Rake 而不是 NAnt 或 MSBuild 的原因
我见过几个.NET 项目(例如FluentNHibernate)使用Ruby 的rake 来运行其构建,而不是使用.Net 工具,例如NAnt 或MSBuild。这样做有什么好处呢?我们正在启动一个新项目,并试图弄清楚是坚持现有的 NAnt 构建还是迁移到其他项目。任何建议将不胜感激。
如果 .Net 3.5 有影响的话,我们会使用它。
I've seen several .NET projects (e.g. FluentNHibernate) use Ruby's rake to run their build, rather than using .Net tools, such as NAnt or MSBuild. What is the advantage to doing this? We're in the process of starting a new project and are trying to figure out whether to stick with our existing NAnt build or to migrate to something else. Any advice would be appreciated.
We're using .Net 3.5 if it makes a difference.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法与 Rake 交谈,因为我从未使用过它,但我使用过 SCons,我认为这是同一回事与 Rake 类似,但使用 Python。
基于脚本的 make 工具的主要优点是构建文件实际上是可执行脚本。换句话说,在 Rake 中,构建文件是 Ruby 脚本,而在 SCons 中,它是 Python 脚本。如果您可以使用构建系统支持的语言编写某些内容,则可以在构建时完成。因此,那里的灵活性基本上是无限的。与 NAnt 相比,NAnt 的构建文件是一系列 XML 格式的指令和声明。当然,您可以在 NAnt 构建文件中嵌入脚本等内容,但您仍然受制于用于表达任务的语言的流程、过程和语法。
然后还有学习曲线。 NAnt 相对简单,但如果您是从未见过构建文件的 C# 开发人员,一开始可能会有点不知所措。如果您一开始就是一名 Ruby 开发人员并且选择了 Rake,那么学习曲线就不会那么陡峭。
我从来没有遇到过 NAnt 无法处理的事情,尽管我承认一些边缘的事情往往很困难。如果我使用 SCons,如果我可以选择编写一个 Python 脚本(可以访问优秀的 Python 标准库),那么它们会容易得多。
I can't speak to Rake as I've never used it, but I've used SCons, which I assume is the same thing as Rake but in Python.
The main advantage of script-based make tools is that the build file(s) are in fact executable scripts. In other words, in Rake a build file is a Ruby script, and in SCons it's a Python script. If you can code something in the language the build system supports, you can do it at build time. So the flexibility there is essentially unlimited. Compare that to NAnt, where the build file is a series of instructions and declarations in XML. Sure, you can embed scripts and whatnot inside a NAnt build file, but you're still stuck with the flow, procedure and syntax of the language used to express the tasks.
Then there's also the learning curve. NAnt is relatively simple, but if you're a C# developer who's never seen a build file, it can be a bit overwhelming at first. If you're a Ruby developer to begin with and you pick Rake, the learning curve is far less steep.
I've never run into something NAnt couldn't handle, although I will admit some edge things tend to be difficult. If I used SCons they would have been far easier if I had the option of writing a Python script (with access to the excellent Python standard lib) to begin with.