Fix build warnings that came with sbt 1.5.0 (#2857)

* Fix build warnings that came with sbt 1.5.0

* Fix more deprecation warnings

* Fix more warnings
This commit is contained in:
Chris Stewart 2021-04-06 06:01:11 -05:00 committed by GitHub
parent a2628cacd1
commit c738f23e58
7 changed files with 39 additions and 40 deletions

View File

@ -9,4 +9,4 @@ enablePlugins(JavaAppPackaging)
publish / skip := true
// Fork a new JVM for 'run' and 'test:run' to avoid JavaFX double initialization problems
fork in run := true
fork / run := true

View File

@ -37,4 +37,4 @@ Test / bloopGenerate := None
Compile / bloopGenerate := None
//https://stackoverflow.com/questions/26940253/in-sbt-how-do-you-override-scalacoptions-for-console-in-all-configurations
scalacOptions in Compile ~= (_.filterNot(s => s == "-Xfatal-warnings"))
Compile / scalacOptions ~= (_.filterNot(s => s == "-Xfatal-warnings"))

View File

@ -2,7 +2,7 @@ import com.typesafe.sbt.SbtGit.GitKeys._
import scala.util.Properties
cancelable in Global := true
Global / cancelable := true
//don't allow us to wipe all of our prod databases
flywayClean / aggregate := false
@ -19,12 +19,12 @@ lazy val benchSettings: Seq[Def.SettingsDefinition] = {
// .settings(benchSettings: _*)
// .configs(Benchmark)
List(
unmanagedSourceDirectories in Test += baseDirectory.value / "src" / "bench" / "scala",
Test / unmanagedSourceDirectories += baseDirectory.value / "src" / "bench" / "scala",
testFrameworks += new TestFramework("org.scalameter.ScalaMeterFramework"),
parallelExecution in Benchmark := false,
outputStrategy in Benchmark := Some(StdoutOutput),
fork in Benchmark := true,
connectInput in Benchmark := true,
Benchmark / parallelExecution := false,
Benchmark / outputStrategy := Some(StdoutOutput),
Benchmark / fork := true,
Benchmark / connectInput := true,
inConfig(Benchmark)(Defaults.testSettings)
)
}
@ -48,7 +48,7 @@ lazy val crypto = crossProject(JVMPlatform, JSPlatform)
libraryDependencies ++= Deps.cryptoJVM
)
.jsSettings(
npmDependencies in Compile ++= Seq(
Compile / npmDependencies ++= Seq(
"bcrypto" -> "5.4.0"
)
)
@ -57,7 +57,7 @@ lazy val crypto = crossProject(JVMPlatform, JSPlatform)
.in(file("crypto"))
lazy val cryptoJS = crypto.js
.settings(scalacOptions in Compile += {
.settings(Compile / scalacOptions += {
//Added to supress all of the dead code and unused variable warnings
//inside of org.bitcoins.crypto.facade which is used with scalajs
//see: https://www.scala-lang.org/2021/01/12/configuring-and-suppressing-warnings.html
@ -272,7 +272,7 @@ lazy val secp256k1jni = project
.settings(
libraryDependencies ++= Deps.secp256k1jni,
// we place lib files in this directory
unmanagedResourceDirectories in Compile += baseDirectory.value / "natives",
Compile / unmanagedResourceDirectories += baseDirectory.value / "natives",
//since this is not a scala module, we have no code coverage
//this also doesn't place nice with scoverage, see
//https://github.com/scoverage/sbt-scoverage/issues/275
@ -500,7 +500,7 @@ lazy val bench = project
.settings(
libraryDependencies ++= Deps.bench,
name := "bitcoin-s-bench",
skip in publish := true
publish / skip := true
)
.dependsOn(coreJVM % testAndCompile, testkit)
@ -598,16 +598,16 @@ lazy val docs = project
moduleName := name.value,
//removes scalajs projects from unidoc, see
//https://github.com/bitcoin-s/bitcoin-s/issues/2740
unidocProjectFilter in (ScalaUnidoc, unidoc) := {
ScalaUnidoc / unidoc / unidocProjectFilter := {
inAnyProject -- inProjects(jsProjects: _*)
},
target in (ScalaUnidoc, unidoc) := (baseDirectory in LocalRootProject).value / "website" / "static" / "api",
cleanFiles += (target in (ScalaUnidoc, unidoc)).value,
ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api",
cleanFiles += (ScalaUnidoc / unidoc / target).value,
docusaurusCreateSite := docusaurusCreateSite
.dependsOn(unidoc in Compile)
.dependsOn(Compile / unidoc)
.value,
docusaurusPublishGhpages := docusaurusPublishGhpages
.dependsOn(unidoc in Compile)
.dependsOn(Compile / unidoc)
.value
)
.enablePlugins(MdocPlugin,

View File

@ -1,8 +1,8 @@
publishArtifact := false
testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck,
"-verbosity",
"2")
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck,
"-verbosity",
"2")
coverageExcludedPackages := ".*gen"

View File

@ -1,8 +1,8 @@
publishArtifact := false
testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck,
"-verbosity",
"2")
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck,
"-verbosity",
"2")
coverageExcludedPackages := ".*gen"

View File

@ -5,15 +5,15 @@ import scala.util.Properties
val scala2_12 = "2.12.12"
val scala2_13 = "2.13.5"
scalafmtOnCompile in ThisBuild := !Properties.envOrNone("CI").contains("true")
ThisBuild / scalafmtOnCompile := !Properties.envOrNone("CI").contains("true")
scalaVersion in ThisBuild := scala2_13
ThisBuild / scalaVersion := scala2_13
crossScalaVersions in ThisBuild := List(scala2_13, scala2_12)
ThisBuild / crossScalaVersions := List(scala2_13, scala2_12)
//https://github.com/sbt/sbt/pull/5153
//https://github.com/bitcoin-s/bitcoin-s/pull/2194
excludeLintKeys in Global ++= Set(
Global / excludeLintKeys ++= Set(
com.typesafe.sbt.packager.Keys.maintainer,
Keys.mainClass,
com.typesafe.sbt.SbtGit.GitKeys.gitRemoteRepo
@ -22,4 +22,4 @@ excludeLintKeys in Global ++= Set(
//needed so that we can use our versions with docker
//see: https://github.com/dwijnand/sbt-dynver#portable-version-strings
//https://github.com/bitcoin-s/bitcoin-s/issues/2672
dynverSeparator in ThisBuild := "-"
ThisBuild / dynverSeparator := "-"

View File

@ -38,23 +38,22 @@ object CommonSettings {
url("https://twitter.com/Chris_Stewart_5")
)
),
scalacOptions in Compile ++= compilerOpts(scalaVersion =
scalaVersion.value),
Compile / scalacOptions ++= compilerOpts(scalaVersion = scalaVersion.value),
Test / scalacOptions ++= testCompilerOpts(scalaVersion =
scalaVersion.value),
//remove annoying import unused things in the scala console
//https://stackoverflow.com/questions/26940253/in-sbt-how-do-you-override-scalacoptions-for-console-in-all-configurations
scalacOptions in (Compile, console) ~= (_ filterNot (s =>
Compile / console / scalacOptions ~= (_ filterNot (s =>
s == "-Ywarn-unused-import"
|| s == "-Ywarn-unused"
|| s == "-Xfatal-warnings"
//for 2.13 -- they use different compiler opts
|| s == "-Xlint:unused")),
//we don't want -Xfatal-warnings for publishing with publish/publishLocal either
scalacOptions in (Compile, doc) ~= (_ filterNot (s =>
Compile / doc / scalacOptions ~= (_ filterNot (s =>
s == "-Xfatal-warnings")),
scalacOptions in (Test, console) ++= (scalacOptions in (Compile, console)).value,
scalacOptions in Test ++= testCompilerOpts(scalaVersion.value),
Test / console / scalacOptions ++= (Compile / console / scalacOptions).value,
Test / scalacOptions ++= testCompilerOpts(scalaVersion.value),
licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
)
@ -148,9 +147,9 @@ object CommonSettings {
lazy val testSettings: Seq[Setting[_]] = Seq(
//show full stack trace (-oF) of failed tests and duration of tests (-oD)
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oDF"),
logBuffered in Test := false,
skip.in(publish) := true
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oDF"),
Test / logBuffered := false,
skip / publish := true
) ++ settings
lazy val prodSettings: Seq[Setting[_]] = settings
@ -168,9 +167,9 @@ object CommonSettings {
//set the user to be 'bitcoin-s' rather than
//the default provided by sbt native packager
//which is 'demiourgos728'
daemonUser in Docker := "bitcoin-s",
packageName in Docker := packageName.value,
version in Docker := version.value,
Docker / daemonUser := "bitcoin-s",
Docker / packageName := packageName.value,
Docker / version := version.value,
dockerUpdateLatest := isSnapshot.value
)
}