Skip to content

Commit 02530e8

Browse files
authored
update build settings. prepare Scala 3 (mockito#441)
1 parent 46bdaab commit 02530e8

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

build.sbt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ lazy val commonSettings =
4444
Seq("-Xsource:2.12", "-Ypartial-unification")
4545
case Some((2, 12)) =>
4646
Seq("-Ypartial-unification", "-Ywarn-unused:locals")
47-
case _ =>
47+
case Some((2, 13)) =>
4848
Seq("-Ywarn-unused:locals")
49+
case _ =>
50+
Seq()
4951
}
5052
},
5153
Test / scalacOptions += "-Ywarn-value-discard",
@@ -120,8 +122,8 @@ lazy val cats = (project in file("cats"))
120122
commonSettings,
121123
publishSettings,
122124
libraryDependencies ++= Seq(
123-
Dependencies.cats,
124-
Dependencies.catsLaws % "test",
125+
Dependencies.cats.value,
126+
Dependencies.catsLaws.value % "test",
125127
Dependencies.disciplineScalatest % "test",
126128
Dependencies.scalatest % "test"
127129
)
@@ -146,10 +148,10 @@ lazy val common = (project in file("common"))
146148
.settings(
147149
commonSettings,
148150
noPublishingSettings,
149-
libraryDependencies ++= Dependencies.commonLibraries ++ Seq(
150-
Dependencies.scalaReflection(scalaVersion.value),
151-
Dependencies.catsLaws % "test",
152-
Dependencies.scalacheck % "test"
151+
libraryDependencies ++= Dependencies.commonLibraries ++
152+
Dependencies.scalaReflection.value ++ Seq(
153+
Dependencies.catsLaws.value % "test",
154+
Dependencies.scalacheck.value % "test"
153155
)
154156
)
155157

@@ -161,7 +163,7 @@ lazy val core = (project in file("core"))
161163
publishSettings,
162164
name := "mockito-scala",
163165
libraryDependencies ++= Dependencies.commonLibraries,
164-
libraryDependencies += Dependencies.scalaReflection(scalaVersion.value),
166+
libraryDependencies ++= Dependencies.scalaReflection.value,
165167
//TODO remove when we remove the deprecated classes in org.mockito.integrations.Dependencies.scalatest
166168
libraryDependencies += Dependencies.scalatest % "provided",
167169
// include the macro classes and resources in the main jar
@@ -184,7 +186,7 @@ lazy val macroSub = (project in file("macro"))
184186
commonSettings,
185187
noPublishingSettings,
186188
libraryDependencies ++= Dependencies.commonLibraries,
187-
libraryDependencies += Dependencies.scalaReflection(scalaVersion.value),
189+
libraryDependencies ++= Dependencies.scalaReflection.value,
188190
publish := {},
189191
publishLocal := {},
190192
publishArtifact := false
@@ -194,7 +196,7 @@ lazy val macroCommon = (project in file("macro-common"))
194196
.settings(
195197
commonSettings,
196198
noPublishingSettings,
197-
libraryDependencies += Dependencies.scalaReflection(scalaVersion.value),
199+
libraryDependencies ++= Dependencies.scalaReflection.value,
198200
publish := {},
199201
publishLocal := {},
200202
publishArtifact := false

project/Dependencies.scala

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sbt._
2+
import sbt.Keys._
23

34
object Dependencies {
45

@@ -10,7 +11,13 @@ object Dependencies {
1011
"ru.vyarus" % "generics-resolver" % "3.0.3"
1112
)
1213

13-
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.15.2"
14+
val scalacheck = Def.setting(
15+
if (scalaBinaryVersion.value == "3") {
16+
"org.scalacheck" %% "scalacheck" % "1.15.4"
17+
} else {
18+
"org.scalacheck" %% "scalacheck" % "1.15.2"
19+
}
20+
)
1421

1522
val scalatest = "org.scalatest" %% "scalatest" % scalatestVersion
1623

@@ -19,11 +26,29 @@ object Dependencies {
1926
"org.hamcrest" % "hamcrest-core" % "2.2" % "provided"
2027
)
2128

22-
def scalaReflection(scalaVersion: String) = "org.scala-lang" % "scala-reflect" % scalaVersion
29+
val scalaReflection = Def.setting(
30+
if (scalaBinaryVersion.value == "3") {
31+
Nil
32+
} else {
33+
Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value)
34+
}
35+
)
2336

24-
val cats = "org.typelevel" %% "cats-core" % "2.0.0" % "provided"
37+
val cats = Def.setting(
38+
if (scalaBinaryVersion.value == "3") {
39+
"org.typelevel" %% "cats-core" % "2.7.0" % "provided"
40+
} else {
41+
"org.typelevel" %% "cats-core" % "2.0.0" % "provided"
42+
}
43+
)
2544
val scalaz = "org.scalaz" %% "scalaz-core" % "7.3.6" % "provided"
2645

27-
val catsLaws = "org.typelevel" %% "cats-laws" % "2.0.0"
46+
val catsLaws = Def.setting(
47+
if (scalaBinaryVersion.value == "3") {
48+
"org.typelevel" %% "cats-laws" % "2.7.0"
49+
} else {
50+
"org.typelevel" %% "cats-laws" % "2.0.0"
51+
}
52+
)
2853
val disciplineScalatest = "org.typelevel" %% "discipline-scalatest" % "2.1.1"
2954
}

0 commit comments

Comments
 (0)