@@ -3,12 +3,14 @@ import scoverage._
33import xerial .sbt .Sonatype ._
44
55def scala213 = Def .setting(scalaVersion.value.startsWith(" 2.13" ))
6+ def scala3 = Def .setting(scalaVersion.value.startsWith(" 3." ))
7+
68lazy val crossVersionSourcesSettings =
79 Seq (Compile , Test ).map { sc =>
810 (sc / unmanagedSourceDirectories) ++= {
911 (sc / unmanagedSourceDirectories).value.flatMap { dir =>
1012 if (dir.getPath.endsWith(" scala" ))
11- Seq (new File (dir.getPath + (if (scala213.value) " _2.13+" else " _2.13-" )))
13+ Seq (new File (dir.getPath + (if (scala213.value || scala3.value ) " _2.13+" else " _2.13-" )))
1214 else
1315 Seq .empty
1416 }
@@ -54,41 +56,51 @@ val publishSettings = sonatypeSettings ++ Seq(
5456val commonSettings = Seq (
5557 organization := " com.daodecode" ,
5658 scalaVersion := " 2.13.11" ,
57- crossScalaVersions := Seq (scalaVersion.value, " 2.12.18" ),
59+ crossScalaVersions := Seq (scalaVersion.value, " 2.12.18" , " 3.3.0 " ),
5860 scalafmtConfig := Some (scalaj.base / " scalafmt-config/.scalafmt.conf" )
5961) ++ releaseSettings ++ crossVersionSourcesSettings
6062
63+ val Scala212ScalacOptions = Seq (
64+ " -Xlint" ,
65+ " -unchecked" ,
66+ " -deprecation" ,
67+ " -Xfatal-warnings" ,
68+ " -Ywarn-inaccessible" ,
69+ " -Ywarn-dead-code" ,
70+ " -Ywarn-adapted-args" ,
71+ " -Ywarn-nullary-unit" ,
72+ " -feature" ,
73+ " -Ywarn-unused" ,
74+ " -Ywarn-unused-import" ,
75+ " -encoding" , " UTF-8"
76+ )
77+
78+ val Scala213ScalacOptions = Seq (
79+ " -Xlint" ,
80+ " -unchecked" ,
81+ " -deprecation" ,
82+ " -Xfatal-warnings" ,
83+ " -Ywarn-dead-code" ,
84+ " -feature" ,
85+ " -Ywarn-unused" ,
86+ " -encoding" , " UTF-8" ,
87+ " -Wconf:origin=scala.collection.compat.*:s"
88+ )
89+
90+ val Scala3ScalacOptions = Seq (
91+ " -unchecked" ,
92+ " -deprecation" ,
93+ " -Werror" ,
94+ " -feature" ,
95+ " -encoding" , " UTF-8"
96+ )
97+
6198val moduleSettings = commonSettings ++ Seq (
62- scalacOptions :=
63- (if (scala213.value)
64- Seq (
65- " -Xlint" ,
66- " -unchecked" ,
67- " -deprecation" ,
68- " -Xfatal-warnings" ,
69- " -Ywarn-dead-code" ,
70- " -feature" ,
71- " -Ywarn-unused" ,
72- " -encoding" ,
73- " UTF-8" ,
74- " -Wconf:origin=scala.collection.compat.*:s"
75- )
76- else
77- Seq (
78- " -Xlint" ,
79- " -unchecked" ,
80- " -deprecation" ,
81- " -Xfatal-warnings" ,
82- " -Ywarn-inaccessible" ,
83- " -Ywarn-dead-code" ,
84- " -Ywarn-adapted-args" ,
85- " -Ywarn-nullary-unit" ,
86- " -feature" ,
87- " -Ywarn-unused" ,
88- " -Ywarn-unused-import" ,
89- " -encoding" ,
90- " UTF-8"
91- )),
99+ scalacOptions := (
100+ if (scala3.value) Scala3ScalacOptions
101+ else if (scala213.value) Scala213ScalacOptions
102+ else Scala212ScalacOptions
103+ ),
92104 libraryDependencies ++= Seq (
93105 " org.scalatest" %% " scalatest" % " 3.2.16" % " test"
94106 )
0 commit comments