Skip to content

Commit 21efdab

Browse files
committed
Enable -Werror option
1 parent 82914a8 commit 21efdab

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

io/src/main/scala/sbt/internal/io/ErrorHandling.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
package sbt.internal.io
1313

1414
import java.io.IOException
15+
import scala.annotation.nowarn
1516

1617
private[sbt] object ErrorHandling {
1718
def translate[T](msg: => String)(f: => T) =
@@ -22,6 +23,7 @@ private[sbt] object ErrorHandling {
2223
case e: Exception => throw new TranslatedException(msg + e.toString, e)
2324
}
2425

26+
@nowarn("msg=ThreadDeath")
2527
def wideConvert[T](f: => T): Either[Throwable, T] =
2628
try {
2729
Right(f)

io/src/main/scala/sbt/internal/io/SourceModificationWatch.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import sbt.nio.file.{ AnyPath, FileAttributes, FileTreeView, Glob, RecursiveGlob
2424
import sbt.nio.file.Glob.GlobOps
2525

2626
import scala.annotation.tailrec
27+
import scala.annotation.nowarn
2728
import scala.jdk.CollectionConverters._
2829
import scala.collection.{ immutable, mutable }
2930
import scala.concurrent.duration._
@@ -298,6 +299,7 @@ private[sbt] object WatchState {
298299
init
299300
}
300301

302+
@nowarn("msg=WatchState")
301303
def empty(globs: Seq[Glob]): WatchState = {
302304
val service = new WatchService {
303305
override def init(): Unit = {}

io/src/test/scala/sbt/io/IOSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,6 @@ class IOSpec extends AnyFunSuite {
274274
}
275275

276276
def normalizeForWindows(s: String): String = {
277-
s.replaceAllLiterally("""\""", "/")
277+
s.replace("""\""", "/")
278278
}
279279
}

project/HouseRulesPluglin.scala

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,17 @@ object HouseRulesPlugin extends AutoPlugin {
1313
scalacOptions ++= Seq("-encoding", "utf8"),
1414
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked"),
1515
scalacOptions += "-language:implicitConversions",
16-
scalacOptions ++= "-Werror"
17-
.ifScala(v => {
18-
sys.props.get("sbt.build.fatal") match {
19-
case Some(_) => java.lang.Boolean.getBoolean("sbt.build.fatal")
20-
case _ => v == 12
21-
}
22-
})
23-
.value
24-
.toList,
16+
scalacOptions ++= Seq(
17+
"-Wconf:msg=Compiler synthesis of Manifest and OptManifest is deprecated:silent",
18+
"-Wconf:msg=type Traversable in package scala:silent",
19+
),
20+
scalacOptions ++= {
21+
sys.props.get("sbt.build.fatal") match {
22+
case Some("false") =>
23+
Nil
24+
case _ =>
25+
Seq("-Werror")
26+
}
27+
}
2528
)
26-
27-
private def scalaPartV = Def setting (CrossVersion partialVersion scalaVersion.value)
28-
29-
private implicit final class AnyWithIfScala[A](val __x: A) {
30-
def ifScala(p: Long => Boolean) =
31-
Def setting (scalaPartV.value collect { case (2, y) if p(y) => __x })
32-
}
3329
}

0 commit comments

Comments
 (0)