Skip to content

Commit a5de947

Browse files
committed
Use snapshotScalaBinaryVersion when building against -SNAPSHOT
1 parent 9ef175b commit a5de947

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

build.sbt

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
import VersionKeys.{snapshotScalaBinaryVersion,deriveBinaryVersion}
2+
13
organization := "org.scala-lang.modules"
24

35
name := "scala-xml"
46

57
version := "1.0.0-SNAPSHOT"
68

7-
// standard stuff follows:
89
scalaVersion := "2.11.0-M7"
910

11+
snapshotScalaBinaryVersion := "2.11.0-M7"
12+
13+
// DOUBLETHINK YOUR WAY OUT OF EDITING BELOW (THERE IS NO BELOW)
14+
15+
scalaBinaryVersion := deriveBinaryVersion(scalaVersion.value, snapshotScalaBinaryVersion.value)
16+
1017
// to allow compiling against snapshot versions of Scala
1118
resolvers += Resolver.sonatypeRepo("snapshots")
1219

20+
1321
libraryDependencies ++= Seq(
1422
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "test", // used in CompilerErrors test
1523
"junit" % "junit" % "4.11" % "test",

project/keys.scala

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
object TestKeys {
1+
object VersionKeys {
22
import sbt.settingKey
33

4-
// for testing with partest
5-
val includeTestDependencies = settingKey[Boolean]("Doesn't declare test dependencies.")
4+
val snapshotScalaBinaryVersion = settingKey[String]("The Scala binary version to use when building against Scala SNAPSHOT.")
65

7-
val partestVersion = settingKey[String]("Partest version.")
8-
}
6+
def deriveBinaryVersion(sv: String, snapshotScalaBinaryVersion: String) = sv match {
7+
case snap_211 if snap_211.startsWith("2.11") &&
8+
snap_211.contains("-SNAPSHOT") => snapshotScalaBinaryVersion
9+
case sv => sbt.CrossVersion.binaryScalaVersion(sv)
10+
}
11+
}

0 commit comments

Comments
 (0)