Make warnings in Java code fatal (#28402)
This commit is contained in:
parent
58fa1e3604
commit
327e16980d
51 changed files with 480 additions and 213 deletions
|
|
@ -19,6 +19,22 @@ object AkkaDisciplinePlugin extends AutoPlugin {
|
|||
|
||||
// We allow warnings in docs to get the 'snippets' right
|
||||
val nonFatalWarningsFor = Set("akka-docs")
|
||||
val nonFatalJavaWarningsFor = Set(
|
||||
// for sun.misc.Unsafe and AbstractScheduler
|
||||
"akka-actor",
|
||||
// references to deprecated PARSER fields in generated message formats?
|
||||
"akka-actor-typed-tests",
|
||||
// references to deprecated PARSER fields in generated message formats?
|
||||
"akka-cluster-typed",
|
||||
// use of deprecated akka.protobuf.GeneratedMessage
|
||||
"akka-protobuf",
|
||||
// references to deprecated PARSER fields in generated message formats?
|
||||
"akka-remote",
|
||||
// references to deprecated PARSER fields in generated message formats?
|
||||
"akka-distributed-data",
|
||||
// references to deprecated PARSER fields in generated message formats?
|
||||
"akka-cluster-sharding-typed",
|
||||
)
|
||||
|
||||
val looseProjects = Set(
|
||||
"akka-actor",
|
||||
|
|
@ -60,6 +76,10 @@ object AkkaDisciplinePlugin extends AutoPlugin {
|
|||
else Seq.empty
|
||||
),
|
||||
Test / scalacOptions --= testUndicipline,
|
||||
Compile / javacOptions ++= (
|
||||
if (!nonFatalJavaWarningsFor(name.value)) Seq("-Werror", "-Xlint:deprecation", "-Xlint:unchecked")
|
||||
else Seq.empty
|
||||
),
|
||||
Compile / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
|
||||
case Some((2, 13)) =>
|
||||
disciplineScalacOptions -- Set(
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ object TestExtras {
|
|||
},
|
||||
|
||||
checkTestsHaveRun := {
|
||||
require(
|
||||
file("akka-stream-tests/target/test-reports/TEST-akka.stream.scaladsl.FlowPublisherSinkSpec.xml").exists,
|
||||
"The jdk9-only FlowPublisherSinkSpec.scala should be run as part of the build"
|
||||
)
|
||||
require(
|
||||
file("akka-stream-tests/target/test-reports/TEST-akka.stream.javadsl.JavaFlowSupportCompileTest.xml").exists,
|
||||
"The jdk9-only JavaFlowSupportCompileTest.java should be run as part of the build"
|
||||
)
|
||||
def shouldExist(description: String, filename: String): Unit =
|
||||
require(file(filename).exists, s"$description should be run as part of the build")
|
||||
|
||||
List(
|
||||
"The java JavaExtension.java" -> "akka-actor-tests/target/test-reports/akka.actor.JavaExtension.xml",
|
||||
"The jdk9-only FlowPublisherSinkSpec.scala" -> "akka-stream-tests/target/test-reports/TEST-akka.stream.scaladsl.FlowPublisherSinkSpec.xml",
|
||||
"The jdk9-only JavaFlowSupportCompileTest.java" -> "akka-stream-tests/target/test-reports/TEST-akka.stream.javadsl.JavaFlowSupportCompileTest.xml",
|
||||
).foreach((shouldExist _).tupled)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue