1
- import Dependencies ._
2
-
3
1
name := " query-monad-code"
4
2
5
3
version := " 1.0-SNAPSHOT"
6
4
7
- scalaVersion in ThisBuild := " 2.12.6"
5
+ ThisBuild / scalaVersion := " 2.12.7"
6
+ ThisBuild / crossScalaVersions := Seq (" 2.11.12" , " 2.12.7" )
8
7
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 (
14
10
" -deprecation" , // Emit warning and location for usages of deprecated APIs.
15
11
" -encoding" ,
16
12
" utf-8" , // Specify character encoding used by source files.
@@ -23,15 +19,32 @@ val commonSettings = Seq(
23
19
" -Yno-adapted-args" , // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
24
20
" -Ypartial-unification" , // Enable partial unification in type constructor inference
25
21
" -Ywarn-dead-code" , // Warn when dead code is identified.
26
- " -Ywarn-extra-implicit" , // Warn when more than one implicit parameter section is defined.
27
22
" -Ywarn-inaccessible" , // Warn about inaccessible types in method signatures.
28
23
" -Ywarn-infer-any" , // Warn when a type argument is inferred to be `Any`.
29
24
" -Ywarn-nullary-override" , // Warn when non-nullary `def f()' overrides nullary `def f'.
30
25
" -Ywarn-nullary-unit" , // Warn when nullary methods return Unit.
31
26
" -Ywarn-numeric-widen" , // Warn when numerics are widened.
32
27
" -Ywarn-unused" , // Warn if unused.
33
28
" -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),
35
48
scalacOptions in (Compile , console) ~= (_.filterNot(
36
49
Set (
37
50
" -Ywarn-unused:imports" ,
@@ -51,12 +64,9 @@ val commonSettings = Seq(
51
64
)
52
65
53
66
// 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
59
68
69
+ // Wartremover
60
70
wartremoverErrors ++= Warts .unsafe
61
71
62
72
//
0 commit comments