Skip to content

Commit

Permalink
util: Update to cross-compile for scala 2.12
Browse files Browse the repository at this point in the history
Problem

We want to be able to cross-compile for scala 2.12 but scoverage
isn't ready yet.

Based on this:
efcc8a3

Which was reverted here:
8e7e04d

Solution

Make scoverage resolve 2.11 artifacts when building for scala
2.12 until 2.12 versions are available.

Result

We should be able to cross-build and this change doesn't appear
to break any downstream projects.

RB_ID=840265
  • Loading branch information
cacoco authored and jenkins committed Jun 8, 2016
1 parent 53de173 commit 4cd7395
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions project/Build.scala
Expand Up @@ -27,6 +27,7 @@ object Util extends Build {
version := libVersion,
organization := "com.twitter",
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.11.8", "2.12.0-M4"),
// Workaround for a scaladoc bug which causes it to choke on empty classpaths.
unmanagedClasspath in Compile += Attributed.blank(new java.io.File("doesnotexist")),
libraryDependencies ++= Seq(
Expand All @@ -49,6 +50,22 @@ object Util extends Build {
"-Xlint:-missing-interpolator"
),

// scoverage automatically brings in libraries on our behalf, but it hasn't
// been updated for 2.12 yet[0]. for now, we need to rely on the 2.11 ones
// (which seem to work OK)
//
// [0]: https://github.com/scoverage/sbt-scoverage/issues/126
libraryDependencies := {
libraryDependencies.value.map {
case moduleId: ModuleID
if moduleId.organization == "org.scoverage"
&& scalaVersion.value.startsWith("2.12") =>
moduleId.copy(name = moduleId.name.replace(scalaVersion.value, "2.11"))
case moduleId =>
moduleId
}
},

// Note: Use -Xlint rather than -Xlint:unchecked when TestThriftStructure
// warnings are resolved
javacOptions ++= Seq("-Xlint:unchecked", "-source", "1.8", "-target", "1.8"),
Expand Down

0 comments on commit 4cd7395

Please sign in to comment.