From 4cd7395fd8597932af054bb4101f655075c605fc Mon Sep 17 00:00:00 2001 From: Christopher Coco Date: Tue, 7 Jun 2016 23:49:15 +0000 Subject: [PATCH] util: Update to cross-compile for scala 2.12 Problem We want to be able to cross-compile for scala 2.12 but scoverage isn't ready yet. Based on this: https://github.com/twitter/util/commit/efcc8a3d9933886b271e37a59adc19d37722de83 Which was reverted here: https://github.com/twitter/util/commit/8e7e04d70a0b55f06e0177294ba33bd0d5502b29 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 --- project/Build.scala | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/project/Build.scala b/project/Build.scala index 998904b480..209242ecac 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -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( @@ -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"),