Last active
December 12, 2015 07:18
-
-
Save ymasory/4735020 to your computer and use it in GitHub Desktop.
Dealing with SIP-18 (language imports) in the presence of cross-compilation in build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalaVersion := "2.10.0" | |
// Let's support all "modern" Scala versions. | |
crossScalaVersions := Seq( | |
"2.9.3-RC1", | |
"2.9.2", | |
"2.9.1", "2.9.1-1", | |
"2.9.0", "2.9.0-1", | |
"2.8.0", "2.8.1", "2.8.2" | |
) | |
// These options will be used for *all* versions. | |
scalacOptions ++= Seq( | |
"-deprecation", | |
"-unchecked" | |
) | |
// These language flags will be used only for 2.10.x. | |
// Uncomment those you need, or if you hate SIP-18, all of them. | |
// Do you know a more future-proof way to compare Scala version strings? | |
// Please let me know! | |
// Suggestion from Mike Pilquist: https://github.com/cjmx/cjmx/blob/master/build.sbt#L24 | |
scalacOptions <++= scalaVersion map { sv => | |
if (sv startsWith "2.10") List( | |
"-feature" | |
// "-language:postfixOps", | |
// "-language:reflectiveCalls", | |
// "-language:implicitConversions" | |
// "-language:higherKinds", | |
// "-language:existentials", | |
// "-language:experimental.macros", | |
// "-language:experimental.dynamics" | |
) | |
else Nil | |
} |
Good point @aloiscochard, thanks. This gist will only work in cases that you're not using 2.10 features and are merely trying to support 2.10.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For macros or other new features this will obviously don't do the trick, I use multiple sources folder (scala/scala-2.9/scala-2.10) in this case:
https://github.com/aloiscochard/sindi/blob/master/project/Build.scala#L50-L54