Skip to content

Commit

Permalink
Set up global scalac options
Browse files Browse the repository at this point in the history
  • Loading branch information
jcazevedo committed Jan 7, 2023
1 parent f6c4cc0 commit b100c1e
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,34 @@ ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
// Enable the OrganizeImports Scalafix rule.
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0"

ThisBuild / scalacOptions ++= {
val allVersionFlags = List(
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen"
)

CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) =>
allVersionFlags ++ List(
"-deprecation",
"-Xlint:_,-unused",
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-unused:_,-implicits"
)

case Some((2, 13)) =>
allVersionFlags ++ List("-Ywarn-unused:_,-implicits")

case _ =>
allVersionFlags
}
}

lazy val phalanges = (project in file(".")).settings(
name := "phalanges",
description := "An implementation of finger trees as proposed by Hinze and Paterson.",
Expand All @@ -50,33 +78,6 @@ lazy val phalanges = (project in file(".")).settings(
"org.specs2" %% "specs2-core" % "4.17.0" % "test",
"org.specs2" %% "specs2-scalacheck" % "4.17.0" % "test"
),
scalacOptions ++= {
val allVersionFlags = List(
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen"
)

CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) =>
allVersionFlags ++ List(
"-deprecation",
"-Xlint:_,-unused",
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-unused:_,-implicits"
)

case Some((2, 13)) =>
allVersionFlags ++ List("-Ywarn-unused:_,-implicits")

case _ =>
allVersionFlags
}
},
Compile / console / scalacOptions --= Seq("-Xfatal-warnings", "-Ywarn-unused-import", "-Ywarn-unused:_,-implicits"),
Test / console / scalacOptions := (Compile / console / scalacOptions).value
)

0 comments on commit b100c1e

Please sign in to comment.