1
- lazy val scala212 = " 2.12.18"
2
- lazy val scala213 = " 2.13.7"
1
+ import sbt .CrossVersion
2
+
3
+ lazy val scala212 = " 2.12.18"
4
+ lazy val scala213 = " 2.13.14"
5
+ lazy val scala3LTS = " 3.3.4"
6
+ lazy val scala3 = " 3.6.3"
3
7
4
8
lazy val commonSettings = List (
5
9
scalaVersion := scala212,
6
- scalacOptions ++= Seq (
7
- " -encoding" ,
8
- " utf8" ,
9
- " -deprecation" ,
10
- " -unchecked" ,
11
- " -Xlint" ,
12
- " -Xfatal-warnings"
13
- ),
14
- Compile / console / scalacOptions --= Seq (" -deprecation" , " -Xfatal-warnings" , " -Xlint" )
10
+ scalacOptions ++= {
11
+ CrossVersion .partialVersion(scalaVersion.value) match {
12
+ case Some ((2 , _)) => scalacOptions ++= Seq (" -Xlint" )
13
+ case _ => ()
14
+ }
15
+ Seq (
16
+ " -encoding" ,
17
+ " utf8" ,
18
+ " -deprecation" ,
19
+ " -unchecked" ,
20
+ " -Xfatal-warnings"
21
+ )
22
+ },
23
+ Compile / console / scalacOptions --= Seq (" -deprecation" , " -Xfatal-warnings" , " -Xlint" ),
24
+ scalafmtOnCompile := true
15
25
)
16
26
17
27
lazy val codegen = (project in file(" codegen" ))
@@ -32,20 +42,51 @@ lazy val codegen = (project in file("codegen"))
32
42
lazy val runtime = (project in file(" runtime" )).settings(
33
43
commonSettings,
34
44
name := " twinagle-runtime" ,
35
- crossScalaVersions := Seq (scala212, scala213),
36
- libraryDependencies ++= Seq (
37
- " com.twitter" %% " finagle-http" % " 21.12.0" ,
38
- " com.thesamet.scalapb" %% " scalapb-runtime" % scalapb.compiler.Version .scalapbVersion,
39
- " com.thesamet.scalapb" %% " scalapb-json4s" % " 0.12.1" ,
40
- " org.json4s" %% " json4s-native" % " 4.0.7" ,
41
- " org.specs2" %% " specs2-core" % " 4.20.5" % Test ,
42
- " org.specs2" %% " specs2-mock" % " 4.20.5" % Test
43
- ),
45
+ crossScalaVersions := Seq (scala212, scala213, scala3LTS, scala3),
46
+ // finagle uses 2.13 heavily so we will ignore our project runtime compat
47
+ excludeDependencies += " org.scala-lang.modules" % " scala-collection-compat_3" ,
48
+ libraryDependencies ++= {
49
+ Seq (
50
+ " com.twitter" %% " finagle-http" % " 24.2.0" cross CrossVersion .for3Use2_13,
51
+ " com.thesamet.scalapb" %% " scalapb-runtime" % " 0.11.17" ,
52
+ " com.thesamet.scalapb" %% " scalapb-json4s" % " 0.12.1" ,
53
+ " org.specs2" %% " specs2-core" % " 4.20.8" % Test cross CrossVersion .for3Use2_13
54
+ )
55
+ },
56
+ libraryDependencies ++= {
57
+ CrossVersion .partialVersion(scalaVersion.value) match {
58
+ case Some ((2 , 13 )) | Some ((2 , 12 )) =>
59
+ Seq (
60
+ " org.json4s" %% " json4s-native" % " 4.0.7" ,
61
+ " org.specs2" %% " specs2-mock" % " 4.20.8" % Test
62
+ )
63
+ case Some ((3 , 3 )) =>
64
+ Seq (
65
+ " org.playframework" %% " play-json" % " 3.0.4" ,
66
+ " org.scalamock" %% " scalamock" % " 6.1.1" % Test
67
+ )
68
+ case Some ((3 , _)) =>
69
+ Seq (
70
+ " org.playframework" %% " play-json" % " 3.0.4" ,
71
+ " org.scalamock" %% " scalamock" % " 7.1.0" % Test
72
+ )
73
+ case _ => Seq .empty
74
+ }
75
+ },
44
76
// compile protobuf messages for unit tests
45
77
Project .inConfig(Test )(sbtprotoc.ProtocPlugin .protobufConfigSettings),
46
- Test / PB .targets := Seq (
47
- scalapb.gen(flatPackage = true ) -> (Test / sourceManaged).value
48
- )
78
+ Test / scalacOptions += {
79
+ CrossVersion .partialVersion(scalaVersion.value) match {
80
+ case Some ((3 , minor)) if minor > 3 => " -experimental"
81
+ case _ => " "
82
+ }
83
+ },
84
+ Test / PB .targets := {
85
+ val gen3 = CrossVersion .partialVersion(scalaVersion.value).exists(a => a._1 == 3L )
86
+ Seq (
87
+ scalapb.gen(flatPackage = true , scala3Sources = gen3) -> (Test / sourceManaged).value
88
+ )
89
+ }
49
90
)
50
91
51
92
lazy val root = (project in file(" ." ))
0 commit comments