我如何告诉sbt使用Scala 2.12或2.13的夜间版本? [英] How do I tell sbt to use a nightly build of Scala 2.12 or 2.13?
问题描述
我想针对最新的Scala夜间恶意软件测试我的代码.
I want to test my code against the latest bleeding edge Scala nightlies.
Scala 2.10的答案不再起作用.
The answer for Scala 2.10 doesn't work anymore.
我该怎么办?
推荐答案
Scala 2.12或2.13
快速版本
resolvers in Global += "scala-integration" at
"https://scala-ci.typesafe.com/artifactory/scala-integration/"
scalaVersion := "2.13.1-bin-abcd123"
对于每晚2.12,请替换为2.12.9
表示2.13.1
;无论哪种情况,它都是该分支上的 next 版本的版本号
for a 2.12 nightly, substitute e.g. 2.12.9
for 2.13.1
; in either case, it's the version number of the next release on that branch
对于abcd123
,手动替换最新绿色版本的SHA的前7个字符在Travis-CI的2.13.x或2.12.x分支上.
for abcd123
, manually substitute the first 7 characters of the SHA of the latest green build on the 2.13.x or 2.12.x branch on Travis-CI.
Scala团队不再发布-SNAPSHOT
版本的Scala. (从头开始可能是社区的贡献;请参阅此票证. )
The Scala team no longer publishes -SNAPSHOT
versions of Scala. (Starting that again could be a community contribution; see this ticket.)
但是该团队确实会发布每晚的版本,每个版本都有其自己的固定版本号.每晚的版本号看起来像2.13.1-bin-abcd123
. (-bin-
表示与sbt具有二进制兼容性;从2.13.0开始的所有2.13.x版本都具有二进制兼容性.)
But the team does publish nightly builds, each with its own fixed version number. The version number of a nightly looks like e.g. 2.13.1-bin-abcd123
. (-bin-
signals binary compatibility to sbt; all 2.13.x releases since 2.13.0 are binary compatible with each other.)
过去基于Jenkins的旧答案不再起作用,因为我们(在2018年)将每夜的出版物从Jenkins转移到Travis-CI.
The old Jenkins-based answer that used to be here no longer works, since we (in 2018) moved publishing of nightlies off Jenkins and onto Travis-CI.
要告诉sbt使用这些夜间活动之一,您需要做三件事.
To tell sbt to use one of these nightlies, you need to do three things.
首先,将解析器添加到每夜保持的位置:
First, add the resolver where the nightlies are kept:
resolvers in Global += "scala-integration" at
"https://scala-ci.typesafe.com/artifactory/scala-integration/"
第二,指定Scala版本:
Second, specify the Scala version:
scalaVersion := "2.13.1-bin-abcd123"
但这不是真实的版本号.在 scala/scala存储库中手动替换包含最后一次提交的7个字符SHA的版本号每晚发布的版本.查看 https://travis-ci.org/scala/scala/branches 和您会在2.13.x(或2.12.x)部分的右上角看到SHA.例如:
But that isn't a real version number. Manually substitute a version number containing the 7-character SHA of the last commit in the scala/scala repository for which a nightly build was published. Look at https://travis-ci.org/scala/scala/branches and you'll see the SHA in the upper right corner of the 2.13.x (or 2.12.x) section. For example:
2.13.1发布后,每晚的版本号将升至2.13.2,依此类推.
As soon as 2.13.1 is released, the version number in the nightly will bump to 2.13.2, and so on.
如果您具有多项目构建,则在修改构建定义时,请确保在所有项目中都设置了这些设置.或者,您可以使用++2.13.1-bin-abcd123
(sbt 0.13.x)或++2.13.1-bin-abcd123!
(sbt 1.x)在sbt外壳中临时设置它们;添加的感叹号对于强制使用crossScalaVersions
中未包含的版本是必需的).
If you have a multiproject build, be sure you set these settings across all projects when you modify your build definition. Or, you may set them temporarily in the sbt shell with ++2.13.1-bin-abcd123
(sbt 0.13.x) or ++2.13.1-bin-abcd123!
(sbt 1.x; the added exclamation point is necessary to force a version not included in crossScalaVersions
to be used).
理想情况下,我们建议采用自动方式向Travis-CI请求正确的SHA.据推测这可以通过Travis-CI的API实现,但据我所知,还没有人研究过. (有志愿者吗?)
Ideally, we would suggest an automated way to ask Travis-CI for the right SHA. This is presumably possible via Travis-CI's API, but (to my knowledge) nobody has looked into it yet. (Is there a volunteer?)
请注意,我们将其非正式地称为每晚"构建,但从技术上讲,这是一个错误的用词.每个合并的PR都会建立一个所谓的每晚".
Note that we call these "nightly" builds informally, but technically it's a misnomer. A so-called "nightly" is built for every merged PR.
Scala存储库中可能永远不会存在2.14.x分支,但是如果存在,将遵循以下说明:
There may never be a 2.14.x branch in the Scala repo, but if there is, the following instructions will apply:
如上所述,但请查看 2.14.x分支
SHA,版本号以2.14.0-pre-
开头(请注意,-pre-
而不是-bin-
,
因为二进制兼容性尚未针对2.14冻结).
As above, but look on the 2.14.x branch
for the SHA, and the version number begins with 2.14.0-pre-
(note -pre-
not -bin-
,
since binary compatibility isn't frozen yet for 2.14).
例如2.14.0-pre-abcd123
.
尽管仍有可能发布2.11.x版本,但尚无计划发布,因此我们(Lightbend的Scala团队)不再发布2.11夜间版本.
Though further 2.11.x releases remain possible, none are planned, so we (the Scala team at Lightbend) aren't publishing 2.11 nightlies anymore.
这篇关于我如何告诉sbt使用Scala 2.12或2.13的夜间版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!