aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@driver.xyz>2018-02-15 13:57:43 -0800
committerJakob Odersky <jakob@driver.xyz>2018-02-15 14:00:25 -0800
commitfc2c8ea7fa013a3c449ab0e392c55218a917f970 (patch)
tree92b2409ea802cde43118cf2b956931127410dda7
parent7aac5f023cfdfbd1439eb3347f4135043c3977d5 (diff)
downloadsbt-settings-fc2c8ea7fa013a3c449ab0e392c55218a917f970.tar.gz
sbt-settings-fc2c8ea7fa013a3c449ab0e392c55218a917f970.tar.bz2
sbt-settings-fc2c8ea7fa013a3c449ab0e392c55218a917f970.zip
Move fatal warnings check from plugin to settings
-rw-r--r--src/main/scala/xyz.driver.sbt/FatalWarnings.scala31
-rw-r--r--src/main/scala/xyz.driver.sbt/SbtSettings.scala15
2 files changed, 15 insertions, 31 deletions
diff --git a/src/main/scala/xyz.driver.sbt/FatalWarnings.scala b/src/main/scala/xyz.driver.sbt/FatalWarnings.scala
deleted file mode 100644
index b7fc585..0000000
--- a/src/main/scala/xyz.driver.sbt/FatalWarnings.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-package xyz.driver.sbt
-
-import sbt.{Def, _}
-import sbt.Keys._
-import xsbti.compile.CompileAnalysis
-
-import scala.collection.JavaConverters._
-
-object FatalWarnings extends AutoPlugin {
-
- override def requires = plugins.JvmPlugin
- override def trigger = allRequirements
-
- override def projectSettings: Seq[Def.Setting[_]] = Seq(
- compile in Compile := {
- val compiled: CompileAnalysis = (compile in Compile).value
- val problems = compiled.readSourceInfos().getAllSourceInfos.asScala.flatMap {
- case (_, info) =>
- info.getReportedProblems
- }
-
- val deprecationsOnly = problems.forall { problem =>
- problem.message().contains("is deprecated")
- }
-
- if (!deprecationsOnly) sys.error("Fatal warnings: some warnings other than deprecations were found.")
- compiled
- }
- )
-
-}
diff --git a/src/main/scala/xyz.driver.sbt/SbtSettings.scala b/src/main/scala/xyz.driver.sbt/SbtSettings.scala
index 45228f7..27945be 100644
--- a/src/main/scala/xyz.driver.sbt/SbtSettings.scala
+++ b/src/main/scala/xyz.driver.sbt/SbtSettings.scala
@@ -18,6 +18,7 @@ import sbtrelease.ReleasePlugin.autoImport.ReleaseKeys._
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
import sbtrelease.ReleasePlugin.autoImport._
import sbtrelease.{Version, _}
+import scala.collection.JavaConverters._
import IntegrationTestPackaging.autoImport.IntegrationTest
// we hide the existing definition for setReleaseVersion to replace it with our own
@@ -89,6 +90,20 @@ object SbtSettings extends AutoPlugin {
"-Ywarn-dead-code",
"-Ywarn-unused:_,-explicits,-implicits"
)
+ },
+ compile in Compile := {
+ val compiled = (compile in Compile).value
+ val problems = compiled.readSourceInfos().getAllSourceInfos.asScala.flatMap {
+ case (_, info) =>
+ info.getReportedProblems
+ }
+
+ val deprecationsOnly = problems.forall { problem =>
+ problem.message().contains("is deprecated")
+ }
+
+ if (!deprecationsOnly) sys.error("Fatal warnings: some warnings other than deprecations were found.")
+ compiled
}
)