什么是最好的斯卡拉构建系统? [英] What's the best Scala build system?

查看:173
本文介绍了什么是最好的斯卡拉构建系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里看到关于IDE的问题 - 是哪个斯卡拉开发的最佳IDE?什么斯卡拉工具的当前状态?,但我已经与IDE混合经验。现在,我使用的Eclipse IDE与自动刷新工作空间选项,KDE 4的凯特作为我的文本编辑器。这里有一些问题,我想解决:

I've seen questions about IDE's here -- Which is the best IDE for Scala development? and What is the current state of tooling for Scala?, but I've had mixed experiences with IDEs. Right now, I'm using the Eclipse IDE with the automatic workspace refresh option, and KDE 4's Kate as my text editor. Here are some of the problems I'd like to solve:


  1. 使用我自己的编辑器的IDE真的在使用它们的组件大家为目标。我很喜欢凯特更好,但刷新系统是非常烦人(它不使用inotify的,相反,也许是10秒轮询间隔)。我不使用内置的文本编辑器的原因是因为破碎的自动完成功能导致IDE挂起也许10秒。

  2. 重建只修改的文件 Eclipse构建系统坏了。它不知道什么时候才能重建类。我发现自己差不多的一半的时间去项目 - >干净。更糟的是,它似乎即使它已经完成后,建我的项目,几分钟后就会弹出一些奇怪的错误(修改的 - 这些错误似乎是事情是previously与解决项目>干净,但再回来了......)。最后,在设置preferences /继续推出,如果项目包含错误到提示似乎对Scala的项目没有影响(即它始终启动即使有错误)。

  3. 打造定制我可以使用夜间的发布,但我会想修改和使用自己的斯卡拉建立,而不是内置于IDE的插件的编译器。这也将是不错的传[例如] -Xprint:JVM 编译器(打印出降低code)

  4. 快速编译虽然Eclipse不总是正确的建立,它似乎瞬间 - 甚至比 FSC

  1. use my own editor IDEs are really geared at everyone using their components. I like Kate better, but the refresh system is very annoying (it doesn't use inotify, rather, maybe a 10s polling interval). The reason I don't use the built-in text editor is because broken auto-complete functionalities cause the IDE to hang for maybe 10s.
  2. rebuild only modified files The Eclipse build system is broken. It doesn't know when to rebuild classes. I find myself almost half of the time going to project->clean. Worse, it seems even after it has finished building my project, a few minutes later it will pop up with some bizarre error (edit - these errors appear to be things that were previously solved with a project > clean, but then come back up...). Finally, setting "Preferences / Continue launch if project contains errors" to "prompt" seems to have no effect for Scala projects (i.e. it always launches even if there are errors).
  3. build customization I can use the "nightly" release, but I'll want to modify and use my own Scala builds, not the compiler that's built into the IDE's plugin. It would also be nice to pass [e.g.] -Xprint:jvm to the compiler (to print out lowered code).
  4. fast compiling Though Eclipse doesn't always build right, it does seem snappy -- even more so than fsc.

我看着Ant和Maven,虽然没有采用任何尚未(我还需要花时间解决#3,#4)。我想看看是否有人有其他的建议,我花时间得到一个次优生成系统工作之前。在此先感谢!

I looked at Ant and Maven, though haven't employed either yet (I'll also need to spend time solving #3 and #4). I wanted to see if anyone has other suggestions before I spend time getting a suboptimal build system working. Thanks in advance!

更新 - 我现在使用Maven,路过一个项目作为一个编译器插件到它。这似乎不够快;我不知道做什么样的罐子缓存的Maven。斯卡拉2.8.0电流库可用[链接。该原型是非常酷,和跨平台的支持似乎很不错。然而,关于编译的问题,我不知道如果FSC实际上是固定的,还是我的项目是足够稳定(例如类名不改变) - 手动运行它不会打扰我一样多。如果你想看看一个例子,随意浏览我使用[ github上

UPDATE - I'm now using Maven, passing a project as a compiler plugin to it. It seems fast enough; I'm not sure what kind of jar caching Maven does. A current repository for Scala 2.8.0 is available [link]. The archetypes are very cool, and cross-platform support seems very good. However, about compile issues, I'm not sure if fsc is actually fixed, or my project is stable enough (e.g. class names aren't changing) -- running it manually doesn't bother me as much. If you'd like to see an example, feel free to browse the pom.xml files I'm using [github].

更新2 - 从我所看到的基准,丹尼尔Spiewak是正确的buildr比Maven的速度(和,如果是做增量变化时,Maven的10个第二等待很烦人的),所以如果一个可以制作一个兼容的构建文件,那么它可能是值得的......

UPDATE 2 - from benchmarks I've seen, Daniel Spiewak is right that buildr's faster than Maven (and, if one is doing incremental changes, Maven's 10 second latency gets annoying), so if one can craft a compatible build file, then it's probably worth it...

推荐答案

点2和4的非常的困难与当前scalac管理。问题在于,Scala的编译器是有点哑有关生成的文件。基本上,它会建立无论你喂它,而无论该文件是否真的需要建立。斯卡拉2.8.0将在这方面有一些巨大的提高,但在那之前...... Eclipse的特殊和差别待遇其实有一些非常复杂的(非常hackish的)code做变化检测和依赖跟踪。就整体而言,它做了体面的工作,但正如你所看到的,有皱纹。 Eclipse的特殊和差别待遇2.8.0将依靠上述改进scalac本身。

Points 2 and 4 are extremely difficult to manage with the current scalac. The problem is that Scala's compiler is a little dumb about building files. Basically, it will build whatever you feed it, regardless of whether or not that file really needs to be built. Scala 2.8.0 will have some tremendous improvements in this respect, but until then... Eclipse SDT actually has some very elaborate (and very hackish) code for doing change detection and dependency tracking. On the whole, it does a decent job, but as you have seen, there are wrinkles. Eclipse SDT 2.8.0 will rely on the aforementioned improvements to scalac itself.

所以,只有建设修改的文件是pretty多出了问题。除了SDT,我知道的唯一工具甚至试图这是SBT(简单生成工具)。它使用编译器插件,因为他们被编译为跟踪文件和查询编译器本身计算的依赖关系图。在实践中,这会产生大约在重新编译的环球办法提高了50%。再次,这是一个黑客绕过在$ P $不足对2.8.0 scalac。

So, building only modified files is pretty much out of the question. Aside from SDT, the only tool I know of which even tries this is SBT (Simple Build Tool). It uses a compiler plugin to track files as they are compiled and query the dependency graph computed by the compiler itself. In practice, this yields about a 50% improvement over the recompile-the-world approach. Once again, this is a hack to get around deficiencies in pre-2.8.0 scalac.

好消息是相当快的编译仍然是可以达到甚至无需担心变化检测。 FSC使用相同的技术(哦,这听起来那么查理·埃普斯荣誉)了Eclipse SDT用来实现快速增量编译。总之,这是pretty瞬间。

The good news is that reasonably fast compilation is still achievable even without worrying about change detection. FSC uses the same technology (ooh, that sounded so "Charlie Eppes") that Eclipse SDT uses to implement fast incremental compilation. In short, it's pretty snappy.

就个人而言,我使用的Apache Buildr 。它的配置比任何Maven的或SBT的显著更清洁,它的启动时间是数量级以下(MRI下运行时)的订单。它集成了FSC和尝试做自己的一些基本的变化检测(相当原始的)。它还具有重大斯卡拉测试框架(ScalaTest,ScalaCheck和规格)与Java源代码和IDE元生成的IntelliJ和Eclipse编译联合自动神奇支持以及支持。哦,它支持所有的Maven的功能(依赖解析等),然后一些。我甚至工作的一个扩展,它允许交互式shell支持与JavaRebel集成,支持多种外壳供应商(斯卡拉,JIRB,Clojure的REPL,等)。这不是准备好SVN没有,但一旦它已经准备好,我会犯(有可能及时为1.3.5)。

Personally, I use Apache Buildr. Its configuration is significantly cleaner than either Maven's or SBT's and its startup time is orders of magnitude less (when running under MRI). It integrates with FSC and attempts to do some basic change detection on its own (fairly primitive). It also has auto-magical support for the major Scala test frameworks (ScalaTest, ScalaCheck and Specs) as well as support for joint compilation with Java sources and IDE meta generation for IntelliJ and Eclipse. Oh, and it supports all of Maven's features (dependency resolution, etc) and then some. I'm even working on an extension which would allow interactive shell support integrated with JavaRebel and supporting several shell providers (Scala, JIRB, Clojure REPL, etc). It's not ready for the SVN yet, but I'll commit once it's ready (possibly in time for 1.3.5).

正如你所看到的,我非常坚定地认为,Buildr是最佳斯卡拉构建工具在那里。它的文档是有点参差不齐,其中斯卡拉而言,但那是因为一切都那么简单,它很难不感到冗长的文件。您可以随时查看我的GitHub库中的例子。祝你好运!

As you can see, I'm very firmly of the opinion that Buildr is the best Scala build tool out there. Its documentation is a little spotty where Scala is concerned, but that's because everything is so straightforward that it's hard to document without feeling verbose. You can always check out one of my GitHub repositories for examples. Good luck!

这篇关于什么是最好的斯卡拉构建系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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