@@ -2,13 +2,11 @@ name := "query-monad-code"
22
33version := " 1.0-SNAPSHOT"
44
5- scalaVersion in ThisBuild := " 2.12.7"
5+ ThisBuild / scalaVersion := " 2.12.7"
6+ ThisBuild / crossScalaVersions := Seq (" 2.11.12" , " 2.12.7" )
67
7- // Common values
8- val commonSettings = Seq (
9- organization := " com.zengularity" ,
10- crossPaths := false ,
11- scalacOptions ++= Seq (
8+ def scalacOptionsVersion (scalaVersion : String ) = {
9+ val defaultOptions = Seq (
1210 " -deprecation" , // Emit warning and location for usages of deprecated APIs.
1311 " -encoding" ,
1412 " utf-8" , // Specify character encoding used by source files.
@@ -21,15 +19,32 @@ val commonSettings = Seq(
2119 " -Yno-adapted-args" , // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
2220 " -Ypartial-unification" , // Enable partial unification in type constructor inference
2321 " -Ywarn-dead-code" , // Warn when dead code is identified.
24- " -Ywarn-extra-implicit" , // Warn when more than one implicit parameter section is defined.
2522 " -Ywarn-inaccessible" , // Warn about inaccessible types in method signatures.
2623 " -Ywarn-infer-any" , // Warn when a type argument is inferred to be `Any`.
2724 " -Ywarn-nullary-override" , // Warn when non-nullary `def f()' overrides nullary `def f'.
2825 " -Ywarn-nullary-unit" , // Warn when nullary methods return Unit.
2926 " -Ywarn-numeric-widen" , // Warn when numerics are widened.
3027 " -Ywarn-unused" , // Warn if unused.
3128 " -Ywarn-value-discard" // Warn when non-Unit expression results are unused.
32- ),
29+ )
30+ val v211Options = Seq (
31+ " -Xsource:2.12" // See https://github.com/scala/scala/releases/tag/v2.11.11
32+ )
33+ val v212Options = Seq (
34+ " -Ywarn-extra-implicit" , // Warn when more than one implicit parameter section is defined.
35+ )
36+
37+ CrossVersion .partialVersion(scalaVersion) match {
38+ case Some ((2L , 11L )) => defaultOptions ++ v211Options
39+ case _ => defaultOptions ++ v212Options
40+ }
41+ }
42+
43+ // Common values
44+ def commonSettings = Seq (
45+ organization := " com.zengularity" ,
46+ crossPaths := false ,
47+ scalacOptions ++= scalacOptionsVersion(scalaVersion.value),
3348 scalacOptions in (Compile , console) ~= (_.filterNot(
3449 Set (
3550 " -Ywarn-unused:imports" ,
0 commit comments