From 8bfae66b9d3c93bd0b024b8626a0f4a98f4293dd Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Sat, 7 Dec 2019 15:49:13 -0800 Subject: [PATCH] Update build.sbt to handle util projects As part of re-integrating util into the sbt main project, I had to update the build.sbt and a few dependencies (like the contraband plugin). --- build.sbt | 222 ++++++++++++++---- .../util/codec/LogOptionFormats.scala | 8 +- .../util/codec/ProgressEventFormats.scala | 8 +- .../util/codec/ProgressItemFormats.scala | 8 +- .../util/codec/StringEventFormats.scala | 8 +- .../util/codec/SuccessEventFormats.scala | 8 +- .../util/codec/TraceEventFormats.scala | 8 +- project/Dependencies.scala | 39 +-- project/plugins.sbt | 2 +- 9 files changed, 218 insertions(+), 93 deletions(-) diff --git a/build.sbt b/build.sbt index a9bde0e46..933904c6c 100644 --- a/build.sbt +++ b/build.sbt @@ -52,7 +52,7 @@ def buildLevelSettings: Seq[Setting[_]] = ) ) -def commonSettings: Seq[Setting[_]] = Def.settings( +def commonBaseSettings: Seq[Setting[_]] = Def.settings( headerLicense := Some( HeaderLicense.Custom( """|sbt @@ -71,7 +71,6 @@ def commonSettings: Seq[Setting[_]] = Def.settings( "bintray-scala-hedgehog", url("https://dl.bintray.com/hedgehogqa/scala-hedgehog") )(Resolver.ivyStylePatterns), - addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.4" cross CrossVersion.binary), testFrameworks += TestFramework("hedgehog.sbt.Framework"), concurrentRestrictions in Global += Util.testExclusiveRestriction, testOptions in Test += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), @@ -95,6 +94,11 @@ def commonSettings: Seq[Setting[_]] = Def.settings( fork in compile := true, fork in run := true ) +def commonSettings: Seq[Setting[_]] = + commonBaseSettings :+ + addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.4" cross CrossVersion.binary) +def utilCommonSettings: Seq[Setting[_]] = + commonBaseSettings :+ (crossScalaVersions := (scala212 :: scala213 :: Nil)) def minimalSettings: Seq[Setting[_]] = commonSettings ++ customCommands ++ @@ -106,7 +110,8 @@ def baseSettings: Seq[Setting[_]] = def testedBaseSettings: Seq[Setting[_]] = baseSettings ++ testDependencies -def sbt10Plus = +val sbt13Plus = Seq("1.3.0") +val sbt10Plus = Seq( "1.0.0", "1.0.1", @@ -121,15 +126,19 @@ def sbt10Plus = "1.1.5", "1.1.6", "1.2.0", - "1.2.1", /*DOA,*/ "1.2.3", - "1.2.4", /*DOA,*/ "1.2.6", + "1.2.1", + /*DOA,*/ "1.2.3", + "1.2.4", + /*DOA,*/ "1.2.6", "1.2.7", "1.2.8", ) ++ sbt13Plus -def sbt13Plus = Seq("1.3.0") +val noUtilVersion = + Set("1.0.4", "1.1.4", "1.1.5", "1.1.6", "1.2.3", "1.2.4", "1.2.6", "1.2.7", "1.2.8") -def mimaSettings = mimaSettingsSince(sbt10Plus) -def mimaSettingsSince(versions: Seq[String]) = Def settings ( +val mimaSettings = mimaSettingsSince(sbt10Plus) +val utilMimaSettings = mimaSettingsSince(sbt10Plus.filterNot(noUtilVersion)) +def mimaSettingsSince(versions: Seq[String]): Seq[Def.Setting[_]] = Def settings ( mimaPreviousArtifacts := { val crossVersion = if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled versions.map(v => organization.value % moduleName.value % v cross crossVersion).toSet @@ -144,9 +153,7 @@ def mimaSettingsSince(versions: Seq[String]) = Def settings ( ), ) -val scriptedSbtReduxMimaSettings = Def settings ( - mimaPreviousArtifacts := Set() -) +val scriptedSbtReduxMimaSettings = Def.settings(mimaPreviousArtifacts := Set()) lazy val sbtRoot: Project = (project in file(".")) .enablePlugins(ScriptedPlugin) // , SiteScaladocPlugin, GhpagesPlugin) @@ -259,11 +266,11 @@ val collectionProj = (project in file("internal") / "util-collection") exclude[IncompatibleSignatureProblem]("sbt.internal.util.Types.some") ), ) - .configure(addSbtUtilPosition) + .dependsOn(utilPosition) // Command line-related utilities. val completeProj = (project in file("internal") / "util-complete") - .dependsOn(collectionProj) + .dependsOn(collectionProj, utilControl, utilLogging) .settings( testedBaseSettings, name := "Completion", @@ -282,24 +289,141 @@ val completeProj = (project in file("internal") / "util-complete") exclude[IncompatibleSignatureProblem]("sbt.internal.util.complete.*"), ), ) - .configure(addSbtIO, addSbtUtilControl, addSbtUtilLogging) + .configure(addSbtIO) // A logic with restricted negation as failure for a unique, stable model val logicProj = (project in file("internal") / "util-logic") - .dependsOn(collectionProj) + .dependsOn(collectionProj, utilRelation) .settings( testedBaseSettings, name := "Logic", mimaSettings, ) - .configure(addSbtUtilRelation) +// defines Java structures used across Scala versions, such as the API structures and relationships extracted by +// the analysis compiler phases and passed back to sbt. The API structures are defined in a simple +// format from which Java sources are generated by the datatype generator Projproject +lazy val utilInterface = (project in file("internal") / "util-interface").settings( + utilCommonSettings, + javaOnlySettings, + crossPaths := false, + name := "Util Interface", + exportJars := true, + utilMimaSettings, +) + +lazy val utilControl = (project in file("internal") / "util-control").settings( + utilCommonSettings, + name := "Util Control", + utilMimaSettings, +) + +lazy val utilPosition = (project in file("internal") / "util-position") + .settings( + utilCommonSettings, + name := "Util Position", + scalacOptions += "-language:experimental.macros", + libraryDependencies ++= Seq(scalaReflect.value, scalatest % "test"), + utilMimaSettings, + ) + +lazy val utilLogging = (project in file("internal") / "util-logging") + .enablePlugins(ContrabandPlugin, JsonCodecPlugin) + .dependsOn(utilInterface) + .settings( + utilCommonSettings, + name := "Util Logging", + libraryDependencies ++= + Seq(jline, log4jApi, log4jCore, disruptor, sjsonNewScalaJson.value, scalaReflect.value), + libraryDependencies ++= Seq(scalacheck % "test", scalatest % "test"), + libraryDependencies ++= (scalaVersion.value match { + case v if v.startsWith("2.12.") => List(compilerPlugin(silencerPlugin)) + case _ => List() + }), + Compile / scalacOptions ++= (scalaVersion.value match { + case v if v.startsWith("2.12.") => List("-Ywarn-unused:-locals,-explicits,-privates") + case _ => List() + }), + sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala", + contrabandFormatsForType in generateContrabands in Compile := { tpe => + val old = (contrabandFormatsForType in generateContrabands in Compile).value + val name = tpe.removeTypeParameters.name + if (name == "Throwable") Nil + else old(tpe) + }, + utilMimaSettings, + mimaBinaryIssueFilters ++= Seq( + exclude[DirectMissingMethodProblem]("sbt.internal.util.SuccessEvent.copy*"), + exclude[DirectMissingMethodProblem]("sbt.internal.util.TraceEvent.copy*"), + exclude[DirectMissingMethodProblem]("sbt.internal.util.StringEvent.copy*"), + // Private final class constructors changed + exclude[DirectMissingMethodProblem]("sbt.util.InterfaceUtil#ConcretePosition.this"), + exclude[DirectMissingMethodProblem]("sbt.util.InterfaceUtil#ConcreteProblem.this"), + exclude[ReversedMissingMethodProblem]("sbt.internal.util.ConsoleOut.flush"), + // This affects Scala 2.11 only it seems, so it's ok? + exclude[InheritedNewAbstractMethodProblem]( + "sbt.internal.util.codec.JsonProtocol.LogOptionFormat" + ), + exclude[InheritedNewAbstractMethodProblem]( + "sbt.internal.util.codec.JsonProtocol.ProgressItemFormat" + ), + exclude[InheritedNewAbstractMethodProblem]( + "sbt.internal.util.codec.JsonProtocol.ProgressEventFormat" + ), + ), + ) + .configure(addSbtIO) + +lazy val utilRelation = (project in file("internal") / "util-relation") + .settings( + utilCommonSettings, + name := "Util Relation", + libraryDependencies ++= Seq(scalacheck % "test"), + utilMimaSettings, + ) + +// Persisted caching based on sjson-new +lazy val utilCache = (project in file("util-cache")) + .settings( + utilCommonSettings, + name := "Util Cache", + libraryDependencies ++= + Seq(sjsonNewScalaJson.value, sjsonNewMurmurhash.value, scalaReflect.value), + libraryDependencies ++= Seq(scalatest % "test"), + utilMimaSettings, + mimaBinaryIssueFilters ++= Seq( + // Added a method to a sealed trait, technically not a problem for Scala + exclude[ReversedMissingMethodProblem]("sbt.util.HashFileInfo.hashArray"), + ) + ) + .configure(addSbtIO) + +// Builds on cache to provide caching for filesystem-related operations +lazy val utilTracking = (project in file("util-tracking")) + .dependsOn(utilCache) + .settings( + utilCommonSettings, + name := "Util Tracking", + libraryDependencies ++= Seq(scalatest % "test"), + utilMimaSettings, + ) + .configure(addSbtIO) + +lazy val utilScripted = (project in file("internal") / "util-scripted") + .dependsOn(utilLogging, utilInterface) + .settings( + utilCommonSettings, + name := "Util Scripted", + libraryDependencies ++= scalaParsers.value, + utilMimaSettings, + ) + .configure(addSbtIO) /* **** Intermediate-level Modules **** */ // Runner for uniform test interface lazy val testingProj = (project in file("testing")) .enablePlugins(ContrabandPlugin, JsonCodecPlugin) - .dependsOn(testAgentProj) + .dependsOn(testAgentProj, utilLogging) .settings( baseSettings, name := "Testing", @@ -342,7 +466,7 @@ lazy val testingProj = (project in file("testing")) exclude[DirectMissingMethodProblem]("sbt.JUnitXmlTestsListener.testSuite"), ) ) - .configure(addSbtIO, addSbtCompilerClasspath, addSbtUtilLogging) + .configure(addSbtIO, addSbtCompilerClasspath) // Testing agent for running tests in a separate process. lazy val testAgentProj = (project in file("testing") / "agent") @@ -358,7 +482,7 @@ lazy val testAgentProj = (project in file("testing") / "agent") // Basic task engine lazy val taskProj = (project in file("tasks")) - .dependsOn(collectionProj) + .dependsOn(collectionProj, utilControl) .settings( testedBaseSettings, name := "Tasks", @@ -380,11 +504,10 @@ lazy val taskProj = (project in file("tasks")) exclude[IncompatibleSignatureProblem]("sbt.NodeView.*"), ) ) - .configure(addSbtUtilControl) // Standard task system. This provides map, flatMap, join, and more on top of the basic task model. lazy val stdTaskProj = (project in file("tasks-standard")) - .dependsOn(collectionProj) + .dependsOn(collectionProj, utilLogging, utilCache) .dependsOn(taskProj % "compile;test->test") .settings( testedBaseSettings, @@ -396,12 +519,12 @@ lazy val stdTaskProj = (project in file("tasks-standard")) exclude[DirectMissingMethodProblem]("sbt.Task.mapTask"), ), ) - .configure(addSbtIO, addSbtUtilLogging, addSbtUtilCache) + .configure(addSbtIO) // Embedded Scala code runner lazy val runProj = (project in file("run")) .enablePlugins(ContrabandPlugin) - .dependsOn(collectionProj) + .dependsOn(collectionProj, utilLogging, utilControl) .settings( testedBaseSettings, name := "Run", @@ -422,7 +545,7 @@ lazy val runProj = (project in file("run")) exclude[DirectMissingMethodProblem]("sbt.OutputStrategy#LoggedOutput.copy$default$*"), ) ) - .configure(addSbtIO, addSbtUtilLogging, addSbtUtilControl, addSbtCompilerClasspath) + .configure(addSbtIO, addSbtCompilerClasspath) val sbtProjDepsCompileScopeFilter = ScopeFilter( @@ -431,7 +554,7 @@ val sbtProjDepsCompileScopeFilter = ) lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux")) - .dependsOn(commandProj) + .dependsOn(commandProj, utilLogging, utilScripted) .settings( baseSettings, name := "Scripted sbt Redux", @@ -451,7 +574,7 @@ lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux")) mimaSettings, scriptedSbtReduxMimaSettings, ) - .configure(addSbtIO, addSbtUtilLogging, addSbtCompilerInterface, addSbtUtilScripted, addSbtLmCore) + .configure(addSbtIO, addSbtCompilerInterface, addSbtLmCore) lazy val scriptedSbtOldProj = (project in file("scripted-sbt-old")) .dependsOn(scriptedSbtReduxProj) @@ -481,7 +604,16 @@ lazy val scriptedPluginProj = (project in file("scripted-plugin")) // Implementation and support code for defining actions. lazy val actionsProj = (project in file("main-actions")) - .dependsOn(completeProj, runProj, stdTaskProj, taskProj, testingProj) + .dependsOn( + completeProj, + runProj, + stdTaskProj, + taskProj, + testingProj, + utilLogging, + utilRelation, + utilTracking, + ) .settings( testedBaseSettings, name := "Actions", @@ -498,9 +630,6 @@ lazy val actionsProj = (project in file("main-actions")) ) .configure( addSbtIO, - addSbtUtilLogging, - addSbtUtilRelation, - addSbtUtilTracking, addSbtCompilerInterface, addSbtCompilerClasspath, addSbtCompilerApiInfo, @@ -510,7 +639,7 @@ lazy val actionsProj = (project in file("main-actions")) lazy val protocolProj = (project in file("protocol")) .enablePlugins(ContrabandPlugin, JsonCodecPlugin) - .dependsOn(collectionProj) + .dependsOn(collectionProj, utilLogging) .settings( testedBaseSettings, name := "Protocol", @@ -546,12 +675,11 @@ lazy val protocolProj = (project in file("protocol")) exclude[DirectMissingMethodProblem]("sbt.internal.*"), ) ) - .configure(addSbtUtilLogging) // General command support and core commands not specific to a build system lazy val commandProj = (project in file("main-command")) .enablePlugins(ContrabandPlugin, JsonCodecPlugin) - .dependsOn(protocolProj, completeProj) + .dependsOn(protocolProj, completeProj, utilLogging) .settings( testedBaseSettings, name := "Command", @@ -603,7 +731,6 @@ lazy val commandProj = (project in file("main-command")) ) .configure( addSbtIO, - addSbtUtilLogging, addSbtCompilerInterface, addSbtCompilerClasspath, addSbtLmCore, @@ -623,7 +750,15 @@ lazy val coreMacrosProj = (project in file("core-macros")) // Fixes scope=Scope for Setting (core defined in collectionProj) to define the settings system used in build definitions lazy val mainSettingsProj = (project in file("main-settings")) - .dependsOn(completeProj, commandProj, stdTaskProj, coreMacrosProj) + .dependsOn( + completeProj, + commandProj, + stdTaskProj, + coreMacrosProj, + utilLogging, + utilCache, + utilRelation, + ) .settings( testedBaseSettings, name := "Main Settings", @@ -673,9 +808,6 @@ lazy val mainSettingsProj = (project in file("main-settings")) ) .configure( addSbtIO, - addSbtUtilLogging, - addSbtUtilCache, - addSbtUtilRelation, addSbtCompilerInterface, addSbtCompilerClasspath, addSbtLmCore @@ -708,7 +840,8 @@ lazy val mainProj = (project in file("main")) collectionProj, scriptedSbtReduxProj, scriptedPluginProj, - zincLmIntegrationProj + zincLmIntegrationProj, + utilLogging, ) .settings( testedBaseSettings, @@ -809,7 +942,6 @@ lazy val mainProj = (project in file("main")) ) .configure( addSbtIO, - addSbtUtilLogging, addSbtLmCore, addSbtLmIvy, addSbtCompilerInterface, @@ -1023,7 +1155,15 @@ def allProjects = mainProj, sbtProj, bundledLauncherProj, - coreMacrosProj + coreMacrosProj, + utilCache, + utilControl, + utilInterface, + utilLogging, + utilPosition, + utilRelation, + utilScripted, + utilTracking, ) lazy val nonRoots = allProjects.map(p => LocalProject(p.id)) diff --git a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/LogOptionFormats.scala b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/LogOptionFormats.scala index f5e851f68..e52700c19 100644 --- a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/LogOptionFormats.scala +++ b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/LogOptionFormats.scala @@ -7,10 +7,10 @@ package sbt.internal.util.codec import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } trait LogOptionFormats { self: sjsonnew.BasicJsonProtocol => implicit lazy val LogOptionFormat: JsonFormat[sbt.internal.util.LogOption] = new JsonFormat[sbt.internal.util.LogOption] { - override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.LogOption = { - __jsOpt match { - case Some(__js) => - unbuilder.readString(__js) match { + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.LogOption = { + jsOpt match { + case Some(js) => + unbuilder.readString(js) match { case "Always" => sbt.internal.util.LogOption.Always case "Never" => sbt.internal.util.LogOption.Never case "Auto" => sbt.internal.util.LogOption.Auto diff --git a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/ProgressEventFormats.scala b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/ProgressEventFormats.scala index 6478f743a..4d836c02d 100644 --- a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/ProgressEventFormats.scala +++ b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/ProgressEventFormats.scala @@ -7,10 +7,10 @@ package sbt.internal.util.codec import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } trait ProgressEventFormats { self: sbt.internal.util.codec.ProgressItemFormats with sjsonnew.BasicJsonProtocol => implicit lazy val ProgressEventFormat: JsonFormat[sbt.internal.util.ProgressEvent] = new JsonFormat[sbt.internal.util.ProgressEvent] { - override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.ProgressEvent = { - __jsOpt match { - case Some(__js) => - unbuilder.beginObject(__js) + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.ProgressEvent = { + jsOpt match { + case Some(js) => + unbuilder.beginObject(js) val level = unbuilder.readField[String]("level") val items = unbuilder.readField[Vector[sbt.internal.util.ProgressItem]]("items") val lastTaskCount = unbuilder.readField[Option[Int]]("lastTaskCount") diff --git a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/ProgressItemFormats.scala b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/ProgressItemFormats.scala index 261ab93d4..3aac75e91 100644 --- a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/ProgressItemFormats.scala +++ b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/ProgressItemFormats.scala @@ -7,10 +7,10 @@ package sbt.internal.util.codec import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } trait ProgressItemFormats { self: sjsonnew.BasicJsonProtocol => implicit lazy val ProgressItemFormat: JsonFormat[sbt.internal.util.ProgressItem] = new JsonFormat[sbt.internal.util.ProgressItem] { - override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.ProgressItem = { - __jsOpt match { - case Some(__js) => - unbuilder.beginObject(__js) + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.ProgressItem = { + jsOpt match { + case Some(js) => + unbuilder.beginObject(js) val name = unbuilder.readField[String]("name") val elapsedMicros = unbuilder.readField[Long]("elapsedMicros") unbuilder.endObject() diff --git a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/StringEventFormats.scala b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/StringEventFormats.scala index 8b8ef3fe6..2d142f6ec 100644 --- a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/StringEventFormats.scala +++ b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/StringEventFormats.scala @@ -7,10 +7,10 @@ package sbt.internal.util.codec import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } trait StringEventFormats { self: sjsonnew.BasicJsonProtocol => implicit lazy val StringEventFormat: JsonFormat[sbt.internal.util.StringEvent] = new JsonFormat[sbt.internal.util.StringEvent] { - override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.StringEvent = { - __jsOpt match { - case Some(__js) => - unbuilder.beginObject(__js) + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.StringEvent = { + jsOpt match { + case Some(js) => + unbuilder.beginObject(js) val level = unbuilder.readField[String]("level") val message = unbuilder.readField[String]("message") val channelName = unbuilder.readField[Option[String]]("channelName") diff --git a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/SuccessEventFormats.scala b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/SuccessEventFormats.scala index 8c556ba4e..19621d7c1 100644 --- a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/SuccessEventFormats.scala +++ b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/SuccessEventFormats.scala @@ -7,10 +7,10 @@ package sbt.internal.util.codec import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } trait SuccessEventFormats { self: sjsonnew.BasicJsonProtocol => implicit lazy val SuccessEventFormat: JsonFormat[sbt.internal.util.SuccessEvent] = new JsonFormat[sbt.internal.util.SuccessEvent] { - override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.SuccessEvent = { - __jsOpt match { - case Some(__js) => - unbuilder.beginObject(__js) + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.SuccessEvent = { + jsOpt match { + case Some(js) => + unbuilder.beginObject(js) val message = unbuilder.readField[String]("message") unbuilder.endObject() sbt.internal.util.SuccessEvent(message) diff --git a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/TraceEventFormats.scala b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/TraceEventFormats.scala index babad8d58..379196a9b 100644 --- a/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/TraceEventFormats.scala +++ b/internal/util-logging/src/main/contraband-scala/sbt/internal/util/codec/TraceEventFormats.scala @@ -7,10 +7,10 @@ package sbt.internal.util.codec import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } trait TraceEventFormats { self: sjsonnew.BasicJsonProtocol => implicit lazy val TraceEventFormat: JsonFormat[sbt.internal.util.TraceEvent] = new JsonFormat[sbt.internal.util.TraceEvent] { - override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.TraceEvent = { - __jsOpt match { - case Some(__js) => - unbuilder.beginObject(__js) + override def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.util.TraceEvent = { + jsOpt match { + case Some(js) => + unbuilder.beginObject(js) val level = unbuilder.readField[String]("level") val message = unbuilder.readField[Throwable]("message") val channelName = unbuilder.readField[Option[String]]("channelName") diff --git a/project/Dependencies.scala b/project/Dependencies.scala index dec43838a..86c6099ea 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -5,13 +5,13 @@ import sbt.contraband.ContrabandPlugin.autoImport._ object Dependencies { // WARNING: Please Scala update versions in PluginCross.scala too val scala212 = "2.12.10" + val scala213 = "2.13.1" lazy val checkPluginCross = settingKey[Unit]("Make sure scalaVersion match up") val baseScalaVersion = scala212 def nightlyVersion: Option[String] = sys.props.get("sbt.build.version") // sbt modules private val ioVersion = nightlyVersion.getOrElse("1.3.1") - private val utilVersion = nightlyVersion.getOrElse("1.3.2") private val lmVersion = sys.props.get("sbt.build.lm.version") match { case Some(version) => version @@ -21,14 +21,6 @@ object Dependencies { private val sbtIO = "org.scala-sbt" %% "io" % ioVersion - private val utilPosition = "org.scala-sbt" %% "util-position" % utilVersion - private val utilLogging = "org.scala-sbt" %% "util-logging" % utilVersion - private val utilCache = "org.scala-sbt" %% "util-cache" % utilVersion - private val utilControl = "org.scala-sbt" %% "util-control" % utilVersion - private val utilRelation = "org.scala-sbt" %% "util-relation" % utilVersion - private val utilTracking = "org.scala-sbt" %% "util-tracking" % utilVersion - private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion - private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion @@ -76,21 +68,6 @@ object Dependencies { def addSbtIO(p: Project): Project = addSbtModule(p, sbtIoPath, "io", sbtIO) - def addSbtUtilPosition(p: Project): Project = - addSbtModule(p, sbtUtilPath, "utilPosition", utilPosition) - def addSbtUtilLogging(p: Project): Project = - addSbtModule(p, sbtUtilPath, "utilLogging", utilLogging) - def addSbtUtilCache(p: Project): Project = - addSbtModule(p, sbtUtilPath, "utilCache", utilCache) - def addSbtUtilControl(p: Project): Project = - addSbtModule(p, sbtUtilPath, "utilControl", utilControl) - def addSbtUtilRelation(p: Project): Project = - addSbtModule(p, sbtUtilPath, "utilRelation", utilRelation) - def addSbtUtilTracking(p: Project): Project = - addSbtModule(p, sbtUtilPath, "utilTracking", utilTracking) - def addSbtUtilScripted(p: Project): Project = - addSbtModule(p, sbtUtilPath, "utilScripted", utilScripted) - def addSbtLmCore(p: Project): Project = addSbtModule(p, sbtLmPath, "lmCore", libraryManagementCore) def addSbtLmIvy(p: Project): Project = @@ -119,6 +96,10 @@ object Dependencies { "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value } + val sjsonNewMurmurhash = Def.setting { + "com.eed3si9n" %% "sjson-new-murmurhash" % contrabandSjsonNewVersion.value + } + val jline = "jline" % "jline" % "2.14.6" val scalatest = "org.scalatest" %% "scalatest" % "3.0.8" val scalacheck = "org.scalacheck" %% "scalacheck" % "1.14.0" @@ -126,12 +107,13 @@ object Dependencies { val junit = "junit" % "junit" % "4.11" val templateResolverApi = "org.scala-sbt" % "template-resolver" % "0.1" - private def scala211Module(name: String, moduleVersion: String) = Def setting ( + private def scala212Module(name: String, moduleVersion: String) = Def setting ( ("org.scala-lang.modules" %% name % moduleVersion) :: Nil ) - val scalaXml = scala211Module("scala-xml", "1.2.0") - val scalaParsers = scala211Module("scala-parser-combinators", "1.1.2") + val scalaXml = scala212Module("scala-xml", "1.2.0") + val scalaParsers = scala212Module("scala-parser-combinators", "1.1.2") + val scalaReflect = Def.setting { "org.scala-lang" % "scala-reflect" % scalaVersion.value } def log4jVersion = "2.11.2" val log4jApi = "org.apache.logging.log4j" % "log4j-api" % log4jVersion @@ -143,4 +125,7 @@ object Dependencies { val scalaCacheCaffeine = "com.github.cb372" %% "scalacache-caffeine" % "0.20.0" val hedgehog = "hedgehog" %% "hedgehog-sbt" % "0.1.0" + val disruptor = "com.lmax" % "disruptor" % "3.4.2" + val silencerPlugin = "com.github.ghik" %% "silencer-plugin" % "1.4.2" + val silencerLib = "com.github.ghik" %% "silencer-lib" % "1.4.2" % Provided } diff --git a/project/plugins.sbt b/project/plugins.sbt index 6bcc67599..01c64e095 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0") addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.5") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.2.1") -addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.1") +addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.4.4") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "3.0.2") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14")