@@ -10,10 +10,26 @@ startYear := Some(2023)
1010
1111crossScalaVersions := Seq (" 2.13.16" , " 3.3.6" )
1212scalaVersion := crossScalaVersions.value.head
13- scalacOptions := Seq (
14- " -release:17" ,
15- " -Xsource:3" ,
16- " -deprecation" ,
13+ scalacOptions := crossSettings(
14+ scalaVersion = scalaVersion.value,
15+ if2 = Seq (
16+ " -Xsource:3" ,
17+ ),
18+ // Good compiler options for Scala 2.13 are coming from com.evolution:sbt-scalac-opts-plugin:0.0.9,
19+ // but its support for Scala 3 is limited, especially what concerns linting options.
20+ //
21+ // If Scala 3 is made the primary target, good linting scalac options for it should be added first.
22+ if3 = Seq (
23+ " -Ykind-projector:underscores" ,
24+
25+ // disable new brace-less syntax:
26+ // https://alexn.org/blog/2022/10/24/scala-3-optional-braces/
27+ " -no-indent" ,
28+
29+ // improve error messages:
30+ " -explain" ,
31+ " -explain-types" ,
32+ ),
1733)
1834autoAPIMappings := true
1935versionScheme := Some (" early-semver" )
@@ -27,6 +43,13 @@ libraryDependencies ++= Seq(
2743
2844licenses := Seq ((" MIT" , url(" https://opensource.org/licenses/MIT" )))
2945
46+ def crossSettings [T ](scalaVersion : String , if3 : T , if2 : T ): T = {
47+ scalaVersion match {
48+ case version if version.startsWith(" 3" ) => if3
49+ case _ => if2
50+ }
51+ }
52+
3053addCommandAlias(" fmt" , " all scalafmtAll scalafmtSbt" )
3154addCommandAlias(" check" , " all versionPolicyCheck scalafmtCheckAll scalafmtSbtCheck" )
3255addCommandAlias(" build" , " all compile test" )
0 commit comments