From 9b5243213acf1422768b01062740a0f54e759fc0 Mon Sep 17 00:00:00 2001 From: Dominik Zajkowski Date: Wed, 7 Jul 2021 17:07:45 +0200 Subject: [PATCH 1/3] [Kaizen] Bump sbt to 1.5.4 --- build.sbt | 59 +++++++++++++++++++------------------- project/Dependencies.scala | 6 ++-- project/build.properties | 2 +- version.sbt | 2 +- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/build.sbt b/build.sbt index 1ec33f4874..6608a30bf4 100644 --- a/build.sbt +++ b/build.sbt @@ -37,8 +37,11 @@ updateOptions := updateOptions.value.withGigahorse(false) // artifact name will include scala version crossPaths := true -val `scala-2.12` = "2.12.10" -val `scala-2.13` = "2.13.4" +// patch for error on 'early-semver' problems +ThisBuild / evictionErrorLevel := Level.Info + +val `scala-2.12` = "2.12.13" +val `scala-2.13` = "2.13.6" val supportedScalaVersions = List(`scala-2.12`, `scala-2.13`) def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq( @@ -53,8 +56,8 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq( "com.github.vovapolu" %% "scaluzzi" % "0.1.16" ), // Scalanet snapshots are published to Sonatype after each build. - resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", - testOptions in Test += Tests + resolvers += "Sonatype OSS Snapshots".at("https://oss.sonatype.org/content/repositories/snapshots"), + (Test / testOptions) += Tests .Argument(TestFrameworks.ScalaTest, "-l", "EthashMinerSpec"), // miner tests disabled by default, scalacOptions := Seq( "-unchecked", @@ -67,7 +70,7 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq( "utf-8" ), scalacOptions ++= (if (mantisDev) Seq.empty else compilerOptimizationsForProd), - scalacOptions in (Compile, console) ~= (_.filterNot( + (Compile / console / scalacOptions) ~= (_.filterNot( Set( "-Ywarn-unused-import", "-Xfatal-warnings" @@ -75,10 +78,10 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq( )), scalacOptions ~= (options => if (mantisDev) options.filterNot(_ == "-Xfatal-warnings") else options), Test / parallelExecution := true, - testOptions in Test += Tests.Argument("-oDG"), - (scalastyleConfig in Test) := file("scalastyle-test-config.xml"), + (Test / testOptions) += Tests.Argument("-oDG"), + (Test / scalastyleConfig) := file("scalastyle-test-config.xml"), // Only publish selected libraries. - skip in publish := true + (publish / skip) := true ) val publishSettings = Seq( @@ -88,7 +91,7 @@ val publishSettings = Seq( // Adding an "it" config because in `Dependencies.scala` some are declared with `% "it,test"` // which would fail if the project didn't have configuration to add to. -val Integration = config("it") extend Test +val Integration = config("it").extend(Test) lazy val bytes = { val bytes = project @@ -143,11 +146,11 @@ lazy val rlp = { } lazy val node = { - val Benchmark = config("benchmark") extend Test + val Benchmark = config("benchmark").extend(Test) - val Evm = config("evm") extend Test + val Evm = config("evm").extend(Test) - val Rpc = config("rpcTest") extend Test + val Rpc = config("rpcTest").extend(Test) val malletDeps = Seq( Dependencies.scopt @@ -183,10 +186,10 @@ lazy val node = { ).flatten ++ malletDeps } - scalastyleSources in Test ++= { (unmanagedSourceDirectories in Integration).value } + (Test / scalastyleSources) ++= (Integration / unmanagedSourceDirectories).value - (test in Evm) := (test in Evm).dependsOn(solidityCompile).value - (sourceDirectory in Evm) := baseDirectory.value / "src" / "evmTest" + (Evm / test) := (Evm / test).dependsOn(solidityCompile).value + (Evm / sourceDirectory) := baseDirectory.value / "src" / "evmTest" val node = project .in(file(".")) @@ -204,11 +207,11 @@ lazy val node = { gitCurrentTags, gitDescribedVersion, gitUncommittedChanges, - libraryDependencies in Compile + (Compile / libraryDependencies) ), buildInfoPackage := "io.iohk.ethereum.utils", - fork in Test := true, - buildInfoOptions in Compile += BuildInfoOption.ToMap + (Test / fork) := true, + (Compile / buildInfoOptions) += BuildInfoOption.ToMap ) .settings(commonSettings("mantis"): _*) .settings(inConfig(Integration)(scalafixConfigSettings(Integration))) @@ -232,19 +235,19 @@ lazy val node = { .settings( // protobuf compilation // Into a subdirectory of src_managed to avoid it deleting other generated files; see https://github.com/sbt/sbt-buildinfo/issues/149 - PB.targets in Compile := Seq( - scalapb.gen() -> (sourceManaged in Compile).value / "protobuf" + (Compile / PB.targets) := Seq( + scalapb.gen() -> (Compile / sourceManaged).value / "protobuf" ), // have the protobuf API version file as a resource - unmanagedResourceDirectories in Compile += baseDirectory.value / "src" / "main" / "protobuf", + (Compile / unmanagedResourceDirectories) += baseDirectory.value / "src" / "main" / "protobuf", // Packaging - mainClass in Compile := Some("io.iohk.ethereum.App"), - discoveredMainClasses in Compile := Seq(), + (Compile / mainClass) := Some("io.iohk.ethereum.App"), + (Compile / discoveredMainClasses) := Seq(), // Requires the 'ant-javafx.jar' that comes with Oracle JDK // Enables creating an executable with the configuration files, has to be run on the OS corresponding to the desired version ThisBuild / jdkPackagerType := "image", - mappings in Universal ++= directory((resourceDirectory in Compile).value / "conf"), - mappings in Universal += (resourceDirectory in Compile).value / "logback.xml" -> "conf/logback.xml", + (Universal / mappings) ++= directory((Compile / resourceDirectory).value / "conf"), + (Universal / mappings) += (Compile / resourceDirectory).value / "logback.xml" -> "conf/logback.xml", bashScriptExtraDefines += """addJava "-Dconfig.file=${app_home}/../conf/app.conf"""", bashScriptExtraDefines += """addJava "-Dlogback.configurationFile=${app_home}/../conf/logback.xml"""", batScriptExtraDefines += """call :add_java "-Dconfig.file=%APP_HOME%\conf\app.conf"""", @@ -258,7 +261,7 @@ lazy val node = { node else //node.settings(PB.protocExecutable := file("protoc")) - node.settings(PB.runProtoc in Compile := (args => Process("protoc", args) !)) + node.settings((Compile / PB.runProtoc) := (args => Process("protoc", args) !)) } @@ -345,7 +348,5 @@ addCommandAlias( |""".stripMargin ) -// Scala 2.12 only has up to 1.4.5, while 2.13 only from 1.4.7 -// In theory we should be able to switch on `scalaVersion.value` but it doesn't seem to work. -scapegoatVersion in ThisBuild := (sys.env.getOrElse("SCAPEGOAT_VERSION", "1.4.7")) +(ThisBuild / scapegoatVersion) := "1.4.9" scapegoatReports := Seq("xml") diff --git a/project/Dependencies.scala b/project/Dependencies.scala index d089cc7354..f31b67ca31 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -4,13 +4,12 @@ object Dependencies { private val akkaVersion = "2.6.9" - val akkaUtil: Seq[ModuleID] = { + val akkaUtil: Seq[ModuleID] = Seq( "com.typesafe.akka" %% "akka-actor" % akkaVersion ) - } - val akka: Seq[ModuleID] = { + val akka: Seq[ModuleID] = Seq( "com.typesafe.akka" %% "akka-actor" % akkaVersion, "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion, @@ -21,7 +20,6 @@ object Dependencies { "com.typesafe.akka" %% "akka-stream" % akkaVersion, "com.miguno.akka" %% "akka-mock-scheduler" % "0.5.5" % "it,test" ) - } val akkaHttp: Seq[ModuleID] = { val akkaHttpVersion = "10.2.0" diff --git a/project/build.properties b/project/build.properties index daac5dbf66..7d9ef1ea53 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.4.6 +sbt.version = 1.5.4 diff --git a/version.sbt b/version.sbt index f19bc5374b..18c33b8e32 100644 --- a/version.sbt +++ b/version.sbt @@ -3,4 +3,4 @@ // based on `git` tags by https://github.com/dwijnand/sbt-dynver, // which is a dependency of `sbt-ci-release`. -version in ThisBuild := "3.2.4-SNAPSHOT" +(ThisBuild / version) := "3.2.4-SNAPSHOT" From 5d1c9565726f60ee3d2fe356832e4a11a524a3f1 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Wed, 7 Jul 2021 10:07:12 -0700 Subject: [PATCH 2/3] Fix nix build --- nix/mantis.nix | 2 +- nix/protoc.patch | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nix/mantis.nix b/nix/mantis.nix index 6dd5fd5603..739509289e 100644 --- a/nix/mantis.nix +++ b/nix/mantis.nix @@ -20,7 +20,7 @@ let version = let versionSbt = builtins.readFile ../version.sbt; - captures = builtins.match ''.*version in ThisBuild := "([^"]+)".*'' versionSbt; + captures = builtins.match ''.* := "([^"]+)".*'' versionSbt; in builtins.elemAt captures 0; diff --git a/nix/protoc.patch b/nix/protoc.patch index 85cb08f66d..c0df75261d 100644 --- a/nix/protoc.patch +++ b/nix/protoc.patch @@ -1,12 +1,12 @@ diff --git a/build.sbt b/build.sbt -index 4ac21ff40..ccd34412e 100644 +index 59551123e..88eb70276 100644 --- a/build.sbt +++ b/build.sbt -@@ -43,6 +43,7 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq( +@@ -50,6 +50,7 @@ def commonSettings(projectName: String): Seq[sbt.Def.Setting[_]] = Seq( scalaVersion := `scala-2.13`, - // Scalanet snapshots are published to Sonatype after each build. - resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", + semanticdbEnabled := true, // enable SemanticDB + semanticdbVersion := scalafixSemanticdb.revision, // use Scalafix compatible version + PB.runProtoc in Compile := (args => Process("@protobuf@/bin/protoc", args)!), - testOptions in Test += Tests - .Argument(TestFrameworks.ScalaTest, "-l", "EthashMinerSpec"), // miner tests disabled by default, - scalacOptions := Seq( + ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value), + ThisBuild / scalafixDependencies ++= List( + "com.github.liancheng" %% "organize-imports" % "0.5.0", From 5323b044b384a601b802b5fb34552a4ccbe08170 Mon Sep 17 00:00:00 2001 From: Dominik Zajkowski Date: Thu, 8 Jul 2021 10:11:06 +0200 Subject: [PATCH 3/3] [Kaizen] Update depsSha256 to new deps --- nix/overlay.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/overlay.nix b/nix/overlay.nix index ba096b6f0e..ad4173cf4e 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -3,7 +3,7 @@ rev: final: prev: { mantis = final.callPackage ./mantis.nix { src = ../.; - depsSha256 = "sha256-9XlUBMUe1jQyqguhQgk5DAZ9UtcG6JyCWaBZsIbzBDY="; + depsSha256 = "sha256-4DTSCv7491nG4+jF2VptULubFkVTW0IXRpGqNzuXU90="; }; mantis-hash = final.mantis.override {