Skip to content

Rename isDotty -> isScala3 #4119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import microsites._
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._

val isDotty = Def.setting(
val isScala3 = Def.setting(
CrossVersion.partialVersion(scalaVersion.value).exists(_._1 == 3)
)

Expand Down Expand Up @@ -146,7 +146,7 @@ def doctestGenTestsDottyCompat(isDotty: Boolean, genTests: Seq[File]): Seq[File]
if (isDotty) Nil else genTests

lazy val commonSettings = Seq(
scalacOptions ++= commonScalacOptions(scalaVersion.value, isDotty.value),
scalacOptions ++= commonScalacOptions(scalaVersion.value, isScala3.value),
Compile / unmanagedSourceDirectories ++= scalaVersionSpecificFolders("main", baseDirectory.value, scalaVersion.value),
Test / unmanagedSourceDirectories ++= scalaVersionSpecificFolders("test", baseDirectory.value, scalaVersion.value),
resolvers ++= Seq(Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")),
Expand All @@ -161,7 +161,7 @@ def macroDependencies(scalaVersion: String) =
lazy val catsSettings = Seq(
incOptions := incOptions.value.withLogRecompileOnMacro(false),
libraryDependencies ++= (
if (isDotty.value) Nil
if (isScala3.value) Nil
else
Seq(
compilerPlugin(("org.typelevel" %% "kind-projector" % kindProjectorVersion).cross(CrossVersion.full))
Expand All @@ -170,9 +170,10 @@ lazy val catsSettings = Seq(
) ++ commonSettings ++ publishSettings ++ simulacrumSettings

lazy val simulacrumSettings = Seq(
libraryDependencies ++= (if (isDotty.value) Nil else Seq(compilerPlugin(scalafixSemanticdb))),
libraryDependencies ++= (if (isScala3.value) Nil else Seq(compilerPlugin(scalafixSemanticdb))),
scalacOptions ++= (
if (isDotty.value) Nil else Seq(s"-P:semanticdb:targetroot:${baseDirectory.value}/target/.semanticdb", "-Yrangepos")
if (isScala3.value) Nil
else Seq(s"-P:semanticdb:targetroot:${baseDirectory.value}/target/.semanticdb", "-Yrangepos")
),
libraryDependencies += "org.typelevel" %% "simulacrum-scalafix-annotations" % "0.5.4"
)
Expand All @@ -190,7 +191,7 @@ lazy val commonJsSettings = Seq(
else tv
val a = (LocalRootProject / baseDirectory).value.toURI.toString
val g = "https://raw.githubusercontent.com/typelevel/cats/" + tagOrHash
val opt = if (isDotty.value) "-scalajs-mapSourceURI" else "-P:scalajs:mapSourceURI"
val opt = if (isScala3.value) "-scalajs-mapSourceURI" else "-P:scalajs:mapSourceURI"
s"$opt:$a->$g/"
},
Global / scalaJSStage := FullOptStage,
Expand Down Expand Up @@ -711,7 +712,7 @@ lazy val algebra = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.settings(testingDependencies)
.settings(
scalacOptions := {
if (isDotty.value)
if (isScala3.value)
scalacOptions.value.filterNot(Set("-Xfatal-warnings"))
else scalacOptions.value
},
Expand All @@ -727,7 +728,7 @@ lazy val algebraLaws = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.settings(testingDependencies)
.settings(
scalacOptions := {
if (isDotty.value)
if (isScala3.value)
scalacOptions.value.filterNot(Set("-Xfatal-warnings"))
else scalacOptions.value
},
Expand All @@ -751,13 +752,13 @@ lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.settings(includeGeneratedSrc)
.settings(
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion % Test,
doctestGenTests := doctestGenTestsDottyCompat(isDotty.value, doctestGenTests.value)
doctestGenTests := doctestGenTestsDottyCompat(isScala3.value, doctestGenTests.value)
)
.settings(
Compile / scalacOptions :=
(Compile / scalacOptions).value.filter {
case "-Xfatal-warnings" if isDotty.value => false
case _ => true
case "-Xfatal-warnings" if isScala3.value => false
case _ => true
}
)
.jsSettings(commonJsSettings)
Expand Down Expand Up @@ -1120,7 +1121,7 @@ lazy val sharedReleaseProcess = Seq(
)

lazy val warnUnusedImport = Seq(
scalacOptions ++= (if (isDotty.value) Nil else Seq("-Ywarn-unused:imports")),
scalacOptions ++= (if (isScala3.value) Nil else Seq("-Ywarn-unused:imports")),
Compile / console / scalacOptions ~= (_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports"))),
Test / console / scalacOptions := (Compile / console / scalacOptions).value
)