1- import Dependencies ._
2-
31name := " query-monad-code"
42
53version := " 1.0-SNAPSHOT"
64
7- scalaVersion in ThisBuild := " 2.12.6"
5+ ThisBuild / scalaVersion := " 2.12.7"
6+ ThisBuild / crossScalaVersions := Seq (" 2.11.12" , " 2.12.7" )
87
9- // Common values
10- val commonSettings = Seq (
11- organization := " com.zengularity" ,
12- crossPaths := false ,
13- scalacOptions ++= Seq (
8+ def scalacOptionsVersion (scalaVersion : String ) = {
9+ val defaultOptions = Seq (
1410 " -deprecation" , // Emit warning and location for usages of deprecated APIs.
1511 " -encoding" ,
1612 " utf-8" , // Specify character encoding used by source files.
@@ -23,15 +19,32 @@ val commonSettings = Seq(
2319 " -Yno-adapted-args" , // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
2420 " -Ypartial-unification" , // Enable partial unification in type constructor inference
2521 " -Ywarn-dead-code" , // Warn when dead code is identified.
26- " -Ywarn-extra-implicit" , // Warn when more than one implicit parameter section is defined.
2722 " -Ywarn-inaccessible" , // Warn about inaccessible types in method signatures.
2823 " -Ywarn-infer-any" , // Warn when a type argument is inferred to be `Any`.
2924 " -Ywarn-nullary-override" , // Warn when non-nullary `def f()' overrides nullary `def f'.
3025 " -Ywarn-nullary-unit" , // Warn when nullary methods return Unit.
3126 " -Ywarn-numeric-widen" , // Warn when numerics are widened.
3227 " -Ywarn-unused" , // Warn if unused.
3328 " -Ywarn-value-discard" // Warn when non-Unit expression results are unused.
34- ),
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),
3548 scalacOptions in (Compile , console) ~= (_.filterNot(
3649 Set (
3750 " -Ywarn-unused:imports" ,
@@ -51,12 +64,9 @@ val commonSettings = Seq(
5164)
5265
5366// Scalafmt
54- scalafmtOnCompile in ThisBuild := true
55- scalafmtOnCompile := true
56- scalafmtTestOnCompile in ThisBuild := true
57- scalafmtTestOnCompile := true
58- scalafmtConfig in ThisBuild := file(" project/scalafmt.conf" )
67+ ThisBuild / scalafmtOnCompile := true
5968
69+ // Wartremover
6070wartremoverErrors ++= Warts .unsafe
6171
6272//
0 commit comments