From e9ee8a6cab6247574488114871c77db1a0fb7d0f Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sat, 29 Jan 2022 23:29:07 -0500 Subject: [PATCH] Scala 3 --- .scalafmt.conf | 11 ++-- build.sbt | 12 ++-- .../sbt/librarymanagement/CallerFormats.scala | 2 +- .../ConfigurationReportFormats.scala | 2 +- .../ConfigurationReportLiteFormats.scala | 2 +- .../FileRepositoryFormats.scala | 2 +- .../GetClassifiersConfigurationFormats.scala | 2 +- .../GetClassifiersModuleFormats.scala | 2 +- .../IvyFileConfigurationFormats.scala | 2 +- ...ModuleDescriptorConfigurationFormats.scala | 2 +- .../librarymanagement/ModuleIDFormats.scala | 2 +- .../ModuleReportFormats.scala | 2 +- .../ModuleSettingsFormats.scala | 2 +- .../OrganizationArtifactReportFormats.scala | 2 +- .../PatternsBasedRepositoryFormats.scala | 2 +- .../PomConfigurationFormats.scala | 2 +- .../librarymanagement/ResolverFormats.scala | 2 +- .../SftpRepositoryFormats.scala | 2 +- .../SshBasedRepositoryFormats.scala | 2 +- .../SshRepositoryFormats.scala | 2 +- .../UpdateConfigurationFormats.scala | 2 +- .../UpdateReportFormats.scala | 2 +- .../UpdateReportLiteFormats.scala | 2 +- .../ConfigurationExtra.scala | 66 +++++++------------ .../librarymanagement/EvictionWarning.scala | 39 +++++------ core/src/test/scala/ConfigMacroSpec.scala | 2 +- .../librarymanagement/VersionNumberSpec.scala | 15 ++--- .../ivy/InlineIvyConfigurationFormats.scala | 2 +- .../ivy/IvyConfigurationFormats.scala | 2 +- .../sbt/internal/librarymanagement/Ivy.scala | 41 ++++++------ .../librarymanagement/IvyRetrieve.scala | 26 +++++--- .../internal/librarymanagement/MakePom.scala | 4 +- .../librarymanagement/ivy/Credentials.scala | 21 +++--- .../ComponentManagerTest.scala | 2 +- .../librarymanagement/CredentialsSpec.scala | 14 +++- .../DMSerializationSpec.scala | 2 +- .../librarymanagement/EvictionErrorSpec.scala | 16 +++-- .../EvictionWarningSpec.scala | 40 ++++++++--- .../InconsistentDuplicateSpec.scala | 12 +++- .../librarymanagement/IvyRepoSpec.scala | 28 ++++---- .../MergeDescriptorSpec.scala | 27 ++++---- .../librarymanagement/ResolutionSpec.scala | 4 +- .../librarymanagement/SftpRepoSpec.scala | 2 +- project/Dependencies.scala | 16 +++-- project/build.properties | 2 +- project/plugins.sbt | 2 +- 46 files changed, 242 insertions(+), 208 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index e98e60599..be2e97005 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,11 +1,14 @@ -version = 2.0.0 +version = 3.2.1 +runner.dialect = scala3 + maxColumn = 100 project.git = true project.excludeFilters = [ /sbt-test/, /input_sources/, /contraband-scala/ ] -# http://docs.scala-lang.org/style/scaladoc.html recommends the JavaDoc style. +# https://docs.scala-lang.org/style/scaladoc.html recommends the JavaDoc style. # scala/scala is written that way too https://github.com/scala/scala/blob/v2.12.2/src/library/scala/Predef.scala -docstrings = JavaDoc +docstrings.style = Asterisk +docstrings.wrap = false # This also seems more idiomatic to include whitespace in import x.{ yyy } spaces.inImportCurlyBraces = true @@ -16,6 +19,6 @@ align.openParenCallSite = false align.openParenDefnSite = false # For better code clarity -danglingParentheses = true +danglingParentheses.preset = true trailingCommas = preserve diff --git a/build.sbt b/build.sbt index 00e45416b..c5f546833 100644 --- a/build.sbt +++ b/build.sbt @@ -40,17 +40,16 @@ ThisBuild / publishTo := { ThisBuild / Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat def commonSettings: Seq[Setting[_]] = Def.settings( - scalaVersion := scala212, + scalaVersion := scala3, // publishArtifact in packageDoc := false, resolvers += Resolver.typesafeIvyRepo("releases"), resolvers += Resolver.sonatypeRepo("snapshots"), resolvers += Resolver.sbtPluginRepo("releases"), - resolvers += "bintray-sbt-maven-releases" at "https://dl.bintray.com/sbt/maven-releases/", testFrameworks += new TestFramework("verify.runner.Framework"), // concurrentRestrictions in Global += Util.testExclusiveRestriction, testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), compile / javacOptions ++= Seq("-Xlint", "-Xlint:-serial"), - crossScalaVersions := Seq(scala212, scala213), + crossScalaVersions := Seq(scala3), resolvers += Resolver.sonatypeRepo("public"), scalacOptions := { val old = scalacOptions.value @@ -114,14 +113,16 @@ lazy val lmCore = (project in file("core")) .settings( commonSettings, name := "librarymanagement-core", + contrabandSjsonNewVersion := sjsonNewVersion, libraryDependencies ++= Seq( jsch, - scalaReflect.value, - scalaCompiler.value, + // scalaReflect.value, + // scalaCompiler.value, launcherInterface, gigahorseOkhttp, okhttpUrlconnection, sjsonnewScalaJson.value % Optional, + sjsonnew.value % Optional, scalaTest % Test, scalaCheck % Test, scalaVerify % Test, @@ -275,6 +276,7 @@ lazy val lmIvy = (project in file("ivy")) .settings( commonSettings, name := "librarymanagement-ivy", + contrabandSjsonNewVersion := sjsonNewVersion, libraryDependencies ++= Seq( ivy, scalaTest % Test, diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/CallerFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/CallerFormats.scala index 41c97f1be..5b3f57d80 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/CallerFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/CallerFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait CallerFormats { self: sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ConfigRefFormats with sjsonnew.BasicJsonProtocol => +trait CallerFormats { self: sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats => implicit lazy val CallerFormat: JsonFormat[sbt.librarymanagement.Caller] = new JsonFormat[sbt.librarymanagement.Caller] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.Caller = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportFormats.scala index c2017c8be..c8090c6e1 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait ConfigurationReportFormats { self: sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ModuleReportFormats with sbt.librarymanagement.OrganizationArtifactReportFormats with sjsonnew.BasicJsonProtocol => +trait ConfigurationReportFormats { self: sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ModuleReportFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.CallerFormats with sbt.librarymanagement.OrganizationArtifactReportFormats => implicit lazy val ConfigurationReportFormat: JsonFormat[sbt.librarymanagement.ConfigurationReport] = new JsonFormat[sbt.librarymanagement.ConfigurationReport] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ConfigurationReport = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportLiteFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportLiteFormats.scala index 59a27855a..b0181f495 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportLiteFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ConfigurationReportLiteFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait ConfigurationReportLiteFormats { self: sbt.librarymanagement.OrganizationArtifactReportFormats with sjsonnew.BasicJsonProtocol => +trait ConfigurationReportLiteFormats { self: sbt.librarymanagement.OrganizationArtifactReportFormats with sbt.librarymanagement.ModuleReportFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.CallerFormats => implicit lazy val ConfigurationReportLiteFormat: JsonFormat[sbt.internal.librarymanagement.ConfigurationReportLite] = new JsonFormat[sbt.internal.librarymanagement.ConfigurationReportLite] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.librarymanagement.ConfigurationReportLite = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/FileRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/FileRepositoryFormats.scala index 18099155e..da1e0c26f 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/FileRepositoryFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/FileRepositoryFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait FileRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sbt.librarymanagement.FileConfigurationFormats with sjsonnew.BasicJsonProtocol => +trait FileRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.FileConfigurationFormats => implicit lazy val FileRepositoryFormat: JsonFormat[sbt.librarymanagement.FileRepository] = new JsonFormat[sbt.librarymanagement.FileRepository] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.FileRepository = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfigurationFormats.scala index 19abfb80e..c76d4686a 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersConfigurationFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait GetClassifiersConfigurationFormats { self: sbt.librarymanagement.GetClassifiersModuleFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.UpdateConfigurationFormats with sjsonnew.BasicJsonProtocol => +trait GetClassifiersConfigurationFormats { self: sbt.librarymanagement.GetClassifiersModuleFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ConfigurationFormats with sbt.librarymanagement.UpdateConfigurationFormats with sbt.librarymanagement.RetrieveConfigurationFormats with sbt.librarymanagement.UpdateLoggingFormats with sbt.internal.librarymanagement.formats.LogicalClockFormats with sbt.librarymanagement.ArtifactTypeFilterFormats => implicit lazy val GetClassifiersConfigurationFormat: JsonFormat[sbt.librarymanagement.GetClassifiersConfiguration] = new JsonFormat[sbt.librarymanagement.GetClassifiersConfiguration] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.GetClassifiersConfiguration = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModuleFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModuleFormats.scala index e981e5761..bd9475f86 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModuleFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/GetClassifiersModuleFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait GetClassifiersModuleFormats { self: sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol => +trait GetClassifiersModuleFormats { self: sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ConfigurationFormats => implicit lazy val GetClassifiersModuleFormat: JsonFormat[sbt.librarymanagement.GetClassifiersModule] = new JsonFormat[sbt.librarymanagement.GetClassifiersModule] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.GetClassifiersModule = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala index a78fcc09d..990f2b9c0 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/IvyFileConfigurationFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait IvyFileConfigurationFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sjsonnew.BasicJsonProtocol => +trait IvyFileConfigurationFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol => implicit lazy val IvyFileConfigurationFormat: JsonFormat[sbt.librarymanagement.IvyFileConfiguration] = new JsonFormat[sbt.librarymanagement.IvyFileConfiguration] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.IvyFileConfiguration = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfigurationFormats.scala index 7005fb518..e774c1a5c 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleDescriptorConfigurationFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait ModuleDescriptorConfigurationFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ModuleInfoFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.internal.librarymanagement.formats.NodeSeqFormat with sbt.librarymanagement.ConfigurationFormats with sbt.librarymanagement.ConflictManagerFormats with sjsonnew.BasicJsonProtocol => +trait ModuleDescriptorConfigurationFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.ModuleInfoFormats with sbt.librarymanagement.ScmInfoFormats with sbt.librarymanagement.DeveloperFormats with sbt.internal.librarymanagement.formats.NodeSeqFormat with sbt.librarymanagement.ConflictManagerFormats => implicit lazy val ModuleDescriptorConfigurationFormat: JsonFormat[sbt.librarymanagement.ModuleDescriptorConfiguration] = new JsonFormat[sbt.librarymanagement.ModuleDescriptorConfiguration] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ModuleDescriptorConfiguration = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleIDFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleIDFormats.scala index b1c27558d..bb0df05a5 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleIDFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleIDFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait ModuleIDFormats { self: sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sjsonnew.BasicJsonProtocol => +trait ModuleIDFormats { self: sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats => implicit lazy val ModuleIDFormat: JsonFormat[sbt.librarymanagement.ModuleID] = new JsonFormat[sbt.librarymanagement.ModuleID] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ModuleID = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleReportFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleReportFormats.scala index efcc6d76f..43d2a196f 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleReportFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleReportFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait ModuleReportFormats { self: sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.CallerFormats with sjsonnew.BasicJsonProtocol => +trait ModuleReportFormats { self: sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.CallerFormats => implicit lazy val ModuleReportFormat: JsonFormat[sbt.librarymanagement.ModuleReport] = new JsonFormat[sbt.librarymanagement.ModuleReport] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ModuleReport = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala index 23b6bea80..f72bc1a96 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ModuleSettingsFormats.scala @@ -6,6 +6,6 @@ package sbt.librarymanagement import _root_.sjsonnew.JsonFormat -trait ModuleSettingsFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.IvyFileConfigurationFormats with sbt.librarymanagement.PomConfigurationFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ModuleInfoFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.internal.librarymanagement.formats.NodeSeqFormat with sbt.librarymanagement.ConfigurationFormats with sbt.librarymanagement.ConflictManagerFormats with sbt.librarymanagement.ModuleDescriptorConfigurationFormats => +trait ModuleSettingsFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.IvyFileConfigurationFormats with sbt.librarymanagement.PomConfigurationFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.ModuleInfoFormats with sbt.librarymanagement.ScmInfoFormats with sbt.librarymanagement.DeveloperFormats with sbt.internal.librarymanagement.formats.NodeSeqFormat with sbt.librarymanagement.ConflictManagerFormats with sbt.librarymanagement.ModuleDescriptorConfigurationFormats => implicit lazy val ModuleSettingsFormat: JsonFormat[sbt.librarymanagement.ModuleSettings] = flatUnionFormat3[sbt.librarymanagement.ModuleSettings, sbt.librarymanagement.IvyFileConfiguration, sbt.librarymanagement.PomConfiguration, sbt.librarymanagement.ModuleDescriptorConfiguration]("type") } diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReportFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReportFormats.scala index 1b2c4810f..2744325a2 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReportFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/OrganizationArtifactReportFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait OrganizationArtifactReportFormats { self: sbt.librarymanagement.ModuleReportFormats with sjsonnew.BasicJsonProtocol => +trait OrganizationArtifactReportFormats { self: sbt.librarymanagement.ModuleReportFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.CallerFormats => implicit lazy val OrganizationArtifactReportFormat: JsonFormat[sbt.librarymanagement.OrganizationArtifactReport] = new JsonFormat[sbt.librarymanagement.OrganizationArtifactReport] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.OrganizationArtifactReport = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepositoryFormats.scala index 96e5a93cd..843e70f3d 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepositoryFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/PatternsBasedRepositoryFormats.scala @@ -6,6 +6,6 @@ package sbt.librarymanagement import _root_.sjsonnew.JsonFormat -trait PatternsBasedRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sbt.librarymanagement.FileConfigurationFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.FileRepositoryFormats with sbt.librarymanagement.URLRepositoryFormats with sbt.librarymanagement.SshConnectionFormats with sbt.librarymanagement.SshRepositoryFormats with sbt.librarymanagement.SftpRepositoryFormats => +trait PatternsBasedRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.FileConfigurationFormats with sbt.librarymanagement.FileRepositoryFormats with sbt.librarymanagement.URLRepositoryFormats with sbt.librarymanagement.SshConnectionFormats with sbt.librarymanagement.SshAuthenticationFormats with sbt.librarymanagement.SshRepositoryFormats with sbt.librarymanagement.SftpRepositoryFormats => implicit lazy val PatternsBasedRepositoryFormat: JsonFormat[sbt.librarymanagement.PatternsBasedRepository] = flatUnionFormat4[sbt.librarymanagement.PatternsBasedRepository, sbt.librarymanagement.FileRepository, sbt.librarymanagement.URLRepository, sbt.librarymanagement.SshRepository, sbt.librarymanagement.SftpRepository]("type") } diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala index 0529fba88..229957379 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/PomConfigurationFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait PomConfigurationFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sjsonnew.BasicJsonProtocol => +trait PomConfigurationFormats { self: sbt.librarymanagement.ScalaModuleInfoFormats with sbt.librarymanagement.ConfigurationFormats with sjsonnew.BasicJsonProtocol => implicit lazy val PomConfigurationFormat: JsonFormat[sbt.librarymanagement.PomConfiguration] = new JsonFormat[sbt.librarymanagement.PomConfiguration] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.PomConfiguration = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/ResolverFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/ResolverFormats.scala index 67d790a14..5569ef568 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/ResolverFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/ResolverFormats.scala @@ -6,6 +6,6 @@ package sbt.librarymanagement import _root_.sjsonnew.JsonFormat -trait ResolverFormats { self: sjsonnew.BasicJsonProtocol with sbt.librarymanagement.ChainedResolverFormats with sbt.librarymanagement.MavenRepoFormats with sbt.librarymanagement.MavenCacheFormats with sbt.librarymanagement.PatternsFormats with sbt.librarymanagement.FileConfigurationFormats with sbt.librarymanagement.FileRepositoryFormats with sbt.librarymanagement.URLRepositoryFormats with sbt.librarymanagement.SshConnectionFormats with sbt.librarymanagement.SshRepositoryFormats with sbt.librarymanagement.SftpRepositoryFormats => +trait ResolverFormats { self: sjsonnew.BasicJsonProtocol with sbt.librarymanagement.ChainedResolverFormats with sbt.librarymanagement.MavenRepoFormats with sbt.librarymanagement.MavenCacheFormats with sbt.librarymanagement.PatternsFormats with sbt.librarymanagement.FileConfigurationFormats with sbt.librarymanagement.FileRepositoryFormats with sbt.librarymanagement.URLRepositoryFormats with sbt.librarymanagement.SshConnectionFormats with sbt.librarymanagement.SshAuthenticationFormats with sbt.librarymanagement.SshRepositoryFormats with sbt.librarymanagement.SftpRepositoryFormats => implicit lazy val ResolverFormat: JsonFormat[sbt.librarymanagement.Resolver] = flatUnionFormat7[sbt.librarymanagement.Resolver, sbt.librarymanagement.ChainedResolver, sbt.librarymanagement.MavenRepo, sbt.librarymanagement.MavenCache, sbt.librarymanagement.FileRepository, sbt.librarymanagement.URLRepository, sbt.librarymanagement.SshRepository, sbt.librarymanagement.SftpRepository]("type") } diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/SftpRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SftpRepositoryFormats.scala index a5fdb55a3..9441ada31 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/SftpRepositoryFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/SftpRepositoryFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait SftpRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sbt.librarymanagement.SshConnectionFormats with sjsonnew.BasicJsonProtocol => +trait SftpRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.SshConnectionFormats with sbt.librarymanagement.SshAuthenticationFormats => implicit lazy val SftpRepositoryFormat: JsonFormat[sbt.librarymanagement.SftpRepository] = new JsonFormat[sbt.librarymanagement.SftpRepository] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.SftpRepository = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepositoryFormats.scala index 7561f480a..8143d7239 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepositoryFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/SshBasedRepositoryFormats.scala @@ -6,6 +6,6 @@ package sbt.librarymanagement import _root_.sjsonnew.JsonFormat -trait SshBasedRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sbt.librarymanagement.SshConnectionFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.SshRepositoryFormats with sbt.librarymanagement.SftpRepositoryFormats => +trait SshBasedRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.SshConnectionFormats with sbt.librarymanagement.SshAuthenticationFormats with sbt.librarymanagement.SshRepositoryFormats with sbt.librarymanagement.SftpRepositoryFormats => implicit lazy val SshBasedRepositoryFormat: JsonFormat[sbt.librarymanagement.SshBasedRepository] = flatUnionFormat2[sbt.librarymanagement.SshBasedRepository, sbt.librarymanagement.SshRepository, sbt.librarymanagement.SftpRepository]("type") } diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/SshRepositoryFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/SshRepositoryFormats.scala index d9f141b18..861d359b1 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/SshRepositoryFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/SshRepositoryFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait SshRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sbt.librarymanagement.SshConnectionFormats with sjsonnew.BasicJsonProtocol => +trait SshRepositoryFormats { self: sbt.librarymanagement.PatternsFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.SshConnectionFormats with sbt.librarymanagement.SshAuthenticationFormats => implicit lazy val SshRepositoryFormat: JsonFormat[sbt.librarymanagement.SshRepository] = new JsonFormat[sbt.librarymanagement.SshRepository] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.SshRepository = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala index 8114a8576..70f7d3994 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateConfigurationFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait UpdateConfigurationFormats { self: sbt.librarymanagement.RetrieveConfigurationFormats with sbt.librarymanagement.UpdateLoggingFormats with sbt.internal.librarymanagement.formats.LogicalClockFormats with sbt.librarymanagement.ArtifactTypeFilterFormats with sjsonnew.BasicJsonProtocol => +trait UpdateConfigurationFormats { self: sbt.librarymanagement.RetrieveConfigurationFormats with sbt.librarymanagement.ConfigRefFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.UpdateLoggingFormats with sbt.internal.librarymanagement.formats.LogicalClockFormats with sbt.librarymanagement.ArtifactTypeFilterFormats => implicit lazy val UpdateConfigurationFormat: JsonFormat[sbt.librarymanagement.UpdateConfiguration] = new JsonFormat[sbt.librarymanagement.UpdateConfiguration] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.UpdateConfiguration = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportFormats.scala index 2defd540e..41951020d 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait UpdateReportFormats { self: sbt.librarymanagement.ConfigurationReportFormats with sbt.librarymanagement.UpdateStatsFormats with sjsonnew.BasicJsonProtocol => +trait UpdateReportFormats { self: sbt.librarymanagement.ConfigurationReportFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ModuleReportFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.CallerFormats with sbt.librarymanagement.OrganizationArtifactReportFormats with sbt.librarymanagement.UpdateStatsFormats => implicit lazy val UpdateReportFormat: JsonFormat[sbt.librarymanagement.UpdateReport] = new JsonFormat[sbt.librarymanagement.UpdateReport] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.UpdateReport = { __jsOpt match { diff --git a/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportLiteFormats.scala b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportLiteFormats.scala index 4e9641f9e..f28ed6713 100644 --- a/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportLiteFormats.scala +++ b/core/src/main/contraband-scala/sbt/librarymanagement/UpdateReportLiteFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait UpdateReportLiteFormats { self: sbt.librarymanagement.ConfigurationReportLiteFormats with sjsonnew.BasicJsonProtocol => +trait UpdateReportLiteFormats { self: sbt.librarymanagement.ConfigurationReportLiteFormats with sbt.librarymanagement.OrganizationArtifactReportFormats with sbt.librarymanagement.ModuleReportFormats with sbt.librarymanagement.ModuleIDFormats with sbt.librarymanagement.ArtifactFormats with sbt.librarymanagement.ConfigRefFormats with sbt.librarymanagement.ChecksumFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.InclExclRuleFormats with sbt.librarymanagement.CrossVersionFormats with sbt.librarymanagement.DisabledFormats with sbt.librarymanagement.BinaryFormats with sbt.librarymanagement.ConstantFormats with sbt.librarymanagement.PatchFormats with sbt.librarymanagement.FullFormats with sbt.librarymanagement.For3Use2_13Formats with sbt.librarymanagement.For2_13Use3Formats with sbt.librarymanagement.CallerFormats => implicit lazy val UpdateReportLiteFormat: JsonFormat[sbt.internal.librarymanagement.UpdateReportLite] = new JsonFormat[sbt.internal.librarymanagement.UpdateReportLite] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.librarymanagement.UpdateReportLite = { __jsOpt match { diff --git a/core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala b/core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala index 7431e8950..4acc996bb 100644 --- a/core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala +++ b/core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala @@ -4,10 +4,12 @@ package sbt.librarymanagement import scala.annotation.tailrec -import scala.language.experimental.macros +import scala.quoted.* object Configurations { - def config(name: String): Configuration = macro ConfigurationMacro.configMacroImpl + inline def config(name: String): Configuration = ${ + ConfigurationMacro.configMacroImpl('{ name }) + } def default: Vector[Configuration] = defaultMavenConfigurations def defaultMavenConfigurations: Vector[Configuration] = Vector(Compile, Runtime, Test, Provided, Optional) @@ -104,50 +106,26 @@ private[librarymanagement] abstract class ConfigurationExtra { def hide = Configuration.of(id, name, description, false, extendsConfigs, transitive) } -private[sbt] object ConfigurationMacro { - import scala.reflect.macros._ +private[sbt] object ConfigurationMacro: + def configMacroImpl(name: Expr[String])(using Quotes): Expr[Configuration] = { + import quotes.reflect.* + def enclosingTerm(sym: Symbol): Symbol = + sym match + case sym if sym.flags is Flags.Macro => enclosingTerm(sym.owner) + case sym if !sym.isTerm => enclosingTerm(sym.owner) + case _ => sym + val term = enclosingTerm(Symbol.spliceOwner) + if !term.isValDef then + report.error( + """config must be directly assigned to a val, such as `val Tooling = config("tooling")`.""" + ) - def configMacroImpl(c: blackbox.Context)(name: c.Expr[String]): c.Expr[Configuration] = { - import c.universe._ - val enclosingValName = definingValName( - c, - methodName => - s"""$methodName must be directly assigned to a val, such as `val Tooling = $methodName("tooling")`.""" - ) - if (enclosingValName.head.isLower) { - c.error(c.enclosingPosition, "configuration id must be capitalized") - } - val id = c.Expr[String](Literal(Constant(enclosingValName))) - reify { Configuration.of(id.splice, name.splice) } + val enclosingValName = term.name + if enclosingValName.head.isLower then report.error("configuration id must be capitalized") + val id = Expr(enclosingValName) + '{ Configuration.of($id, $name) } } - - def definingValName(c: blackbox.Context, invalidEnclosingTree: String => String): String = { - import c.universe.{ Apply => ApplyTree, _ } - val methodName = c.macroApplication.symbol.name - def processName(n: Name): String = - n.decodedName.toString.trim // trim is not strictly correct, but macros don't expose the API necessary - @tailrec def enclosingVal(trees: List[c.Tree]): String = { - trees match { - case ValDef(_, name, _, _) :: _ => processName(name) - case (_: ApplyTree | _: Select | _: TypeApply) :: xs => enclosingVal(xs) - // lazy val x: X = has this form for some reason (only when the explicit type is present, though) - case Block(_, _) :: DefDef(mods, name, _, _, _, _) :: _ if mods.hasFlag(Flag.LAZY) => - processName(name) - case _ => - c.error(c.enclosingPosition, invalidEnclosingTree(methodName.decodedName.toString)) - "" - } - } - enclosingVal(enclosingTrees(c).toList) - } - - def enclosingTrees(c: blackbox.Context): Seq[c.Tree] = - c.asInstanceOf[reflect.macros.runtime.Context] - .callsiteTyper - .context - .enclosingContextChain - .map(_.tree.asInstanceOf[c.Tree]) -} +end ConfigurationMacro private[librarymanagement] abstract class ConfigRefFunctions { implicit def configToConfigRef(c: Configuration): ConfigRef = diff --git a/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala b/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala index ae6c95638..25cae9c61 100644 --- a/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala +++ b/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala @@ -392,28 +392,29 @@ object EvictionWarning { ) } - implicit val evictionWarningLines: ShowLines[EvictionWarning] = ShowLines { a: EvictionWarning => - import ShowLines._ - val out: mutable.ListBuffer[String] = mutable.ListBuffer() - if (a.options.warnEvictionSummary && a.binaryIncompatibleEvictionExists) { - out += "There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings." - } + implicit val evictionWarningLines: ShowLines[EvictionWarning] = ShowLines { + (a: EvictionWarning) => + import ShowLines._ + val out: mutable.ListBuffer[String] = mutable.ListBuffer() + if (a.options.warnEvictionSummary && a.binaryIncompatibleEvictionExists) { + out += "There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings." + } - if (a.scalaEvictions.nonEmpty) { - out += "Scala version was updated by one of library dependencies:" - out ++= (a.scalaEvictions flatMap { _.lines }) - out += "To force scalaVersion, add the following:" - out += "\tscalaModuleInfo ~= (_.map(_.withOverrideScalaVersion(true)))" - } + if (a.scalaEvictions.nonEmpty) { + out += "Scala version was updated by one of library dependencies:" + out ++= (a.scalaEvictions flatMap { _.lines }) + out += "To force scalaVersion, add the following:" + out += "\tscalaModuleInfo ~= (_.map(_.withOverrideScalaVersion(true)))" + } - if (a.directEvictions.nonEmpty || a.transitiveEvictions.nonEmpty) { - out += "Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:" - out += "" - out ++= (a.directEvictions flatMap { _.lines }) - out ++= (a.transitiveEvictions flatMap { _.lines }) - } + if (a.directEvictions.nonEmpty || a.transitiveEvictions.nonEmpty) { + out += "Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:" + out += "" + out ++= (a.directEvictions flatMap { _.lines }) + out ++= (a.transitiveEvictions flatMap { _.lines }) + } - out.toList + out.toList } private[sbt] def infoAllTheThings(a: EvictionWarning): List[String] = diff --git a/core/src/test/scala/ConfigMacroSpec.scala b/core/src/test/scala/ConfigMacroSpec.scala index c35ab104b..ea409efa7 100644 --- a/core/src/test/scala/ConfigMacroSpec.scala +++ b/core/src/test/scala/ConfigMacroSpec.scala @@ -56,6 +56,6 @@ object ConfigMacroSpec extends Properties("ConfigMacroSpec") { s"Actual isPublic: ${c.isPublic}" |: (c.id == id) && (c.name == name) && - (c.isPublic == isPublic) + (c.isPublic == isPublic) } } diff --git a/core/src/test/scala/sbt/librarymanagement/VersionNumberSpec.scala b/core/src/test/scala/sbt/librarymanagement/VersionNumberSpec.scala index 9f240f432..608be5f03 100644 --- a/core/src/test/scala/sbt/librarymanagement/VersionNumberSpec.scala +++ b/core/src/test/scala/sbt/librarymanagement/VersionNumberSpec.scala @@ -133,7 +133,7 @@ class VersionNumberSpec extends AnyFreeSpec with Matchers with Inside { assertParsesToError(v) } - //// + // // private[this] final class VersionString(val value: String) @@ -148,13 +148,12 @@ class VersionNumberSpec extends AnyFreeSpec with Matchers with Inside { ts: Seq[String], es: Seq[String] ): Unit = - s"should parse to ($ns, $ts, $es)" in inside(v.value) { - case VersionNumber(ns1, ts1, es1) => - (ns1 shouldBe ns) - (ts1 shouldBe ts) - (es1 shouldBe es) - (VersionNumber(ns, ts, es).toString shouldBe v.value) - (VersionNumber(ns, ts, es) shouldBe VersionNumber(ns, ts, es)) + s"should parse to ($ns, $ts, $es)" in inside(v.value) { case VersionNumber(ns1, ts1, es1) => + (ns1 shouldBe ns) + (ts1 shouldBe ts) + (es1 shouldBe es) + (VersionNumber(ns, ts, es).toString shouldBe v.value) + (VersionNumber(ns, ts, es) shouldBe VersionNumber(ns, ts, es)) } private[this] def assertParsesToError(v: VersionString): Unit = diff --git a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfigurationFormats.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfigurationFormats.scala index 4fa266e4d..b73006cd3 100644 --- a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfigurationFormats.scala +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfigurationFormats.scala @@ -5,7 +5,7 @@ // DO NOT EDIT MANUALLY package sbt.librarymanagement.ivy import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError } -trait InlineIvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.librarymanagement.ivy.formats.UpdateOptionsFormat with sbt.librarymanagement.ivy.IvyPathsFormats with sbt.librarymanagement.ResolverFormats with sbt.librarymanagement.ModuleConfigurationFormats with sjsonnew.BasicJsonProtocol => +trait InlineIvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.librarymanagement.ivy.formats.UpdateOptionsFormat with sbt.librarymanagement.ivy.IvyPathsFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.ResolverFormats with sbt.librarymanagement.ModuleConfigurationFormats => implicit lazy val InlineIvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.InlineIvyConfiguration] = new JsonFormat[sbt.librarymanagement.ivy.InlineIvyConfiguration] { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ivy.InlineIvyConfiguration = { __jsOpt match { diff --git a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfigurationFormats.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfigurationFormats.scala index ee0807427..c281e7d05 100644 --- a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfigurationFormats.scala +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/IvyConfigurationFormats.scala @@ -6,6 +6,6 @@ package sbt.librarymanagement.ivy import _root_.sjsonnew.JsonFormat -trait IvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.librarymanagement.ivy.formats.UpdateOptionsFormat with sbt.librarymanagement.ivy.IvyPathsFormats with sbt.librarymanagement.ResolverFormats with sbt.librarymanagement.ModuleConfigurationFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.ivy.InlineIvyConfigurationFormats with sbt.librarymanagement.ivy.ExternalIvyConfigurationFormats => +trait IvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.GlobalLockFormat with sbt.internal.librarymanagement.formats.LoggerFormat with sbt.librarymanagement.ivy.formats.UpdateOptionsFormat with sbt.librarymanagement.ivy.IvyPathsFormats with sjsonnew.BasicJsonProtocol with sbt.librarymanagement.ResolverFormats with sbt.librarymanagement.ModuleConfigurationFormats with sbt.librarymanagement.ivy.InlineIvyConfigurationFormats with sbt.librarymanagement.ivy.ExternalIvyConfigurationFormats => implicit lazy val IvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.IvyConfiguration] = flatUnionFormat2[sbt.librarymanagement.ivy.IvyConfiguration, sbt.librarymanagement.ivy.InlineIvyConfiguration, sbt.librarymanagement.ivy.ExternalIvyConfiguration]("type") } diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala index e45a5fcf4..78b31d531 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala @@ -141,7 +141,8 @@ final class IvySbt( is } - /** Defines a parallel [[CachedResolutionResolveEngine]]. + /** + * Defines a parallel [[CachedResolutionResolveEngine]]. * * This is defined here because it needs access to [[mkIvy]]. */ @@ -160,8 +161,10 @@ final class IvySbt( } } - /** Provides a default ivy implementation that decides which resolution - * engine to use depending on the passed ivy configuration options. */ + /** + * Provides a default ivy implementation that decides which resolution + * engine to use depending on the passed ivy configuration options. + */ private class IvyImplementation extends Ivy { private val loggerEngine = new SbtMessageLoggerEngine override def getLoggerEngine: SbtMessageLoggerEngine = loggerEngine @@ -201,7 +204,7 @@ final class IvySbt( // ========== End Configuration/Setup ============ - /** Uses the configured Ivy instance within a safe context.*/ + /** Uses the configured Ivy instance within a safe context. */ def withIvy[T](log: Logger)(f: Ivy => T): T = withIvy(new IvyLoggerInterface(log))(f) @@ -292,7 +295,7 @@ final class IvySbt( IvySbt.wrapped(module, ivyXML), moduleID, defaultConf.name, - validate + ic.validate ) IvySbt.addMainArtifact(moduleID) IvySbt.addOverrides(moduleID, overrides, ivy.getSettings.getMatcher(PatternMatcher.EXACT)) @@ -320,7 +323,7 @@ final class IvySbt( mod } - /** Parses the Maven pom 'pomFile' from the given `PomConfiguration`.*/ + /** Parses the Maven pom 'pomFile' from the given `PomConfiguration`. */ private def configurePom(pc: PomConfiguration) = { val md = CustomPomParser.default.parseDescriptor(settings, toURL(pc.file), pc.validate) val dmd = IvySbt.toDefaultModuleDescriptor(md) @@ -334,7 +337,7 @@ final class IvySbt( (dmd, defaultConf) } - /** Parses the Ivy file 'ivyFile' from the given `IvyFileConfiguration`.*/ + /** Parses the Ivy file 'ivyFile' from the given `IvyFileConfiguration`. */ private def configureIvyFile(ifc: IvyFileConfiguration) = { val parser = new CustomXmlParser.CustomParser(settings, None) parser.setValidate(ifc.validate) @@ -517,8 +520,7 @@ private[sbt] object IvySbt { val ivyResolvers = resolvers.map(r => ConvertResolver(r, settings, updateOptions, log)) val (projectResolvers, rest) = ivyResolvers.partition(_.getName == ProjectResolver.InterProject) - if (projectResolvers.isEmpty) - ivyint.SbtChainResolver(name, rest, settings, updateOptions, log) + if (projectResolvers.isEmpty) ivyint.SbtChainResolver(name, rest, settings, updateOptions, log) else { // Force that we always look at the project resolver first by wrapping the chain resolver val delegatedName = s"$name-delegate" @@ -591,8 +593,7 @@ private[sbt] object IvySbt { private[sbt] def resetArtifactResolver( resolved: ResolvedModuleRevision ): ResolvedModuleRevision = - if (resolved eq null) - null + if (resolved eq null) null else { val desc = resolved.getDescriptor val updatedDescriptor = CustomPomParser.defaultTransform(desc.getParser, desc) @@ -690,7 +691,7 @@ private[sbt] object IvySbt { moduleID.addConflictManager(mid, matcher, manager) } - /** Converts the given sbt module id into an Ivy ModuleRevisionId.*/ + /** Converts the given sbt module id into an Ivy ModuleRevisionId. */ def toID(m: ModuleID) = { import m._ ModuleRevisionId.newInstance( @@ -758,7 +759,8 @@ private[sbt] object IvySbt { } private[sbt] def javaMap(m: Map[String, String], unqualify: Boolean = false) = { import scala.collection.JavaConverters._ - val map = if (unqualify) m map { case (k, v) => (k.stripPrefix("e:"), v) } else m + val map = if (unqualify) m map { case (k, v) => (k.stripPrefix("e:"), v) } + else m if (map.isEmpty) null else map.asJava } @@ -789,15 +791,14 @@ private[sbt] object IvySbt { elem: scala.xml.Elem, extra: Map[String, String] ): scala.xml.Elem = - extra.foldLeft(elem) { - case (e, (key, value)) => e % new scala.xml.UnprefixedAttribute(key, value, scala.xml.Null) + extra.foldLeft(elem) { case (e, (key, value)) => + e % new scala.xml.UnprefixedAttribute(key, value, scala.xml.Null) } private def hasInfo(module: ModuleID, x: scala.xml.NodeSeq) = { val info = {x} \ "info" if (info.nonEmpty) { def check(found: NodeSeq, expected: String, label: String) = - if (found.isEmpty) - sys.error("Missing " + label + " in inline Ivy XML.") + if (found.isEmpty) sys.error("Missing " + label + " in inline Ivy XML.") else { val str = found.text if (str != expected) @@ -918,7 +919,7 @@ private[sbt] object IvySbt { } } - /** Transforms an sbt ModuleID into an Ivy DefaultDependencyDescriptor.*/ + /** Transforms an sbt ModuleID into an Ivy DefaultDependencyDescriptor. */ def convertDependency( moduleID: DefaultModuleDescriptor, dependency: ModuleID, @@ -936,7 +937,9 @@ private[sbt] object IvySbt { dependency.configurations match { case None => // The configuration for this dependency was not explicitly specified, so use the default parser.parseDepsConfs(parser.getDefaultConf, dependencyDescriptor) - case Some(confs) => // The configuration mapping (looks like: test->default) was specified for this dependency + case Some( + confs + ) => // The configuration mapping (looks like: test->default) was specified for this dependency parser.parseDepsConfs(confs, dependencyDescriptor) } for (artifact <- dependency.explicitArtifacts) { diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala index a6d2604ce..a1784ffd0 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala @@ -54,14 +54,18 @@ object IvyRetrieve { private[sbt] def organizationArtifactReports( confReport: ConfigurationResolveReport ): Vector[OrganizationArtifactReport] = { - val moduleIds = confReport.getModuleIds.toArray.toVector collect { - case mId: IvyModuleId => mId + val moduleIds = confReport.getModuleIds.toArray.toVector collect { case mId: IvyModuleId => + mId } def organizationArtifact(mid: IvyModuleId): OrganizationArtifactReport = { val deps = confReport.getNodes(mid).toArray.toVector collect { case node: IvyNode => node } - OrganizationArtifactReport(mid.getOrganisation, mid.getName, deps map { - moduleRevisionDetail(confReport, _) - }) + OrganizationArtifactReport( + mid.getOrganisation, + mid.getName, + deps map { + moduleRevisionDetail(confReport, _) + } + ) } moduleIds map { organizationArtifact } } @@ -141,9 +145,13 @@ object IvyRetrieve { val edOpt = Option(dep.getEvictedData(confReport.getConfiguration)) edOpt match { case Some(ed) => - (true, nonEmptyString(Option(ed.getConflictManager) map { _.toString } getOrElse { - "transitive" - }), nonEmptyString(ed.getDetail)) + ( + true, + nonEmptyString(Option(ed.getConflictManager) map { _.toString } getOrElse { + "transitive" + }), + nonEmptyString(ed.getDetail) + ) case None => (true, None, None) } case _ => (false, None, None) @@ -218,7 +226,7 @@ object IvyRetrieve { getType, getExt, Option(getExtraAttribute("classifier")), - getConfigurations.toVector map { c: String => + getConfigurations.toVector map { (c: String) => ConfigRef(c) }, Option(getUrl) diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala index a030a277a..8e90b4eb1 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/MakePom.scala @@ -202,7 +202,7 @@ class MakePom(val log: Logger) { if (moduleInfo.developers.nonEmpty) { { - moduleInfo.developers.map { developer: Developer => + moduleInfo.developers.map { (developer: Developer) => {developer.id} {developer.name} @@ -431,7 +431,7 @@ class MakePom(val log: Logger) { def getScopeAndOptional(confs: Array[String]): (Option[String], Boolean) = { val (opt, notOptional) = confs.partition(_ == Optional.name) val defaultNotOptional = - Configurations.defaultMavenConfigurations.find({ c: Configuration => + Configurations.defaultMavenConfigurations.find({ (c: Configuration) => notOptional contains c.name }) val scope = defaultNotOptional.map(_.name) diff --git a/ivy/src/main/scala/sbt/librarymanagement/ivy/Credentials.scala b/ivy/src/main/scala/sbt/librarymanagement/ivy/Credentials.scala index 458972409..656247304 100644 --- a/ivy/src/main/scala/sbt/librarymanagement/ivy/Credentials.scala +++ b/ivy/src/main/scala/sbt/librarymanagement/ivy/Credentials.scala @@ -16,11 +16,11 @@ object Credentials { def apply(file: File): Credentials = new FileCredentials(file) - /** Add the provided credentials to Ivy's credentials cache.*/ + /** Add the provided credentials to Ivy's credentials cache. */ def add(realm: String, host: String, userName: String, passwd: String): Unit = CredentialsStore.INSTANCE.addCredentials(realm, host, userName, passwd) - /** Load credentials from the given file into Ivy's credentials cache.*/ + /** Load credentials from the given file into Ivy's credentials cache. */ def add(path: File, log: Logger): Unit = loadCredentials(path) match { case Left(err) => log.warn(err) @@ -41,23 +41,20 @@ object Credentials { def loadCredentials(path: File): Either[String, DirectCredentials] = if (path.exists) { val properties = read(path) - def get(keys: List[String]) = + def get(keys: List[String]): Either[String, String] = keys .flatMap(properties.get) .headOption .toRight(keys.head + " not specified in credentials file: " + path) - IvyUtil.separate(List(HostKeys, UserKeys, PasswordKeys).map(get)) match { - case (Nil, List(host, user, pass)) => - IvyUtil.separate(List(RealmKeys).map(get)) match { - case (_, List(realm)) => Right(new DirectCredentials(realm, host, user, pass)) - case _ => Right(new DirectCredentials(null, host, user, pass)) - } + IvyUtil.separate(List(HostKeys, UserKeys, PasswordKeys).map(get)) match + case (Nil, List(host: String, user: String, pass: String)) => + IvyUtil.separate(List(RealmKeys).map(get)) match + case (_, List(realm: String)) => Right(new DirectCredentials(realm, host, user, pass)) + case _ => Right(new DirectCredentials(null, host, user, pass)) case (errors, _) => Left(errors.mkString("\n")) - } - } else - Left("Credentials file " + path + " does not exist") + } else Left("Credentials file " + path + " does not exist") def register(cs: Seq[Credentials], log: Logger): Unit = cs foreach { diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/ComponentManagerTest.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/ComponentManagerTest.scala index dc2947e26..15a68f70e 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/ComponentManagerTest.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/ComponentManagerTest.scala @@ -121,7 +121,7 @@ object ComponentManagerTest extends BasicTestSuite { TestLogger { logger => withTemporaryDirectory { temp => // The actual classes we'll use at runtime. - //val mgr = new ComponentManager(xsbt.boot.Locks, new xsbt.boot.ComponentProvider(temp, true), Some(ivyHome), logger) + // val mgr = new ComponentManager(xsbt.boot.Locks, new xsbt.boot.ComponentProvider(temp, true), Some(ivyHome), logger) // A stub component manager object provider extends ComponentProvider { diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/CredentialsSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/CredentialsSpec.scala index e546f9758..13189de5b 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/CredentialsSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/CredentialsSpec.scala @@ -28,12 +28,22 @@ class CredentialsSpec extends AnyFunSuite { test("DirectCredentials.toString") { assert( - Credentials(realm = null, host = "example.org", userName = "username", passwd = "password").toString == + Credentials( + realm = null, + host = "example.org", + userName = "username", + passwd = "password" + ).toString == """DirectCredentials(null, "example.org", "username", ****)""" ) assert( - Credentials(realm = "realm", host = "example.org", userName = "username", passwd = "password").toString == + Credentials( + realm = "realm", + host = "example.org", + userName = "username", + passwd = "password" + ).toString == """DirectCredentials("realm", "example.org", "username", ****)""" ) } diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/DMSerializationSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/DMSerializationSpec.scala index 86cf43322..b7cb02ce4 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/DMSerializationSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/DMSerializationSpec.scala @@ -101,7 +101,7 @@ object DMSerializationSpec extends BasicTestSuite { def roundtripBuilder[A: JsonReader: JsonWriter](a: A)(f: (A, A) => Unit): Unit = { val json = isoString to (Converter toJsonUnsafe a) println(json) - val obj = Converter fromJsonUnsafe [A] (isoString from json) + val obj = Converter.fromJsonUnsafe[A](isoString from json) f(a, obj) } diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionErrorSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionErrorSpec.scala index a6b97c99e..5e67681ea 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionErrorSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionErrorSpec.scala @@ -101,17 +101,25 @@ object EvictionErrorSpec extends BaseIvySpecification { def oldAkkaPvp = List("com.typesafe.akka" % "*" % "pvp") lazy val `akkaActor2.1.4` = - ModuleID("com.typesafe.akka", "akka-actor", "2.1.4").withConfigurations(Some("compile")) cross CrossVersion.binary + ModuleID("com.typesafe.akka", "akka-actor", "2.1.4").withConfigurations( + Some("compile") + ) cross CrossVersion.binary lazy val `akkaActor2.3.0` = - ModuleID("com.typesafe.akka", "akka-actor", "2.3.0").withConfigurations(Some("compile")) cross CrossVersion.binary + ModuleID("com.typesafe.akka", "akka-actor", "2.3.0").withConfigurations( + Some("compile") + ) cross CrossVersion.binary lazy val `scala2.10.4` = ModuleID("org.scala-lang", "scala-library", "2.10.4").withConfigurations(Some("compile")) lazy val `scala2.13.3` = ModuleID("org.scala-lang", "scala-library", "2.13.3").withConfigurations(Some("compile")) lazy val `bananaSesame0.4` = - ModuleID("org.w3", "banana-sesame", "0.4").withConfigurations(Some("compile")) cross CrossVersion.binary // uses akka-actor 2.1.4 + ModuleID("org.w3", "banana-sesame", "0.4").withConfigurations( + Some("compile") + ) cross CrossVersion.binary // uses akka-actor 2.1.4 lazy val `akkaRemote2.3.4` = - ModuleID("com.typesafe.akka", "akka-remote", "2.3.4").withConfigurations(Some("compile")) cross CrossVersion.binary // uses akka-actor 2.3.4 + ModuleID("com.typesafe.akka", "akka-remote", "2.3.4").withConfigurations( + Some("compile") + ) cross CrossVersion.binary // uses akka-actor 2.3.4 lazy val `http4s0.21.11` = ("org.http4s" %% "http4s-blaze-server" % "0.21.11").withConfigurations(Some("compile")) // https://repo1.maven.org/maven2/org/typelevel/cats-effect_2.13/3.0.0-M4/cats-effect_2.13-3.0.0-M4.pom diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionWarningSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionWarningSpec.scala index 09975ba5f..4f8ded23f 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionWarningSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionWarningSpec.scala @@ -20,7 +20,11 @@ object EvictionWarningSpec extends BaseIvySpecification { val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false) val report = ivyUpdate(m) assert( - EvictionWarning(m, fullOptions.withWarnScalaVersionEviction(false), report).scalaEvictions.size == 0 + EvictionWarning( + m, + fullOptions.withWarnScalaVersionEviction(false), + report + ).scalaEvictions.size == 0 ) } @@ -79,7 +83,11 @@ object EvictionWarningSpec extends BaseIvySpecification { val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2")) val report = ivyUpdate(m) assert( - EvictionWarning(m, fullOptions.withWarnScalaVersionEviction(false), report).scalaEvictions.size == 0 + EvictionWarning( + m, + fullOptions.withWarnScalaVersionEviction(false), + report + ).scalaEvictions.size == 0 ) } @@ -302,11 +310,17 @@ object EvictionWarningSpec extends BaseIvySpecification { } def akkaActor214 = - ModuleID("com.typesafe.akka", "akka-actor", "2.1.4").withConfigurations(Some("compile")) cross CrossVersion.binary + ModuleID("com.typesafe.akka", "akka-actor", "2.1.4").withConfigurations( + Some("compile") + ) cross CrossVersion.binary def akkaActor230 = - ModuleID("com.typesafe.akka", "akka-actor", "2.3.0").withConfigurations(Some("compile")) cross CrossVersion.binary + ModuleID("com.typesafe.akka", "akka-actor", "2.3.0").withConfigurations( + Some("compile") + ) cross CrossVersion.binary def akkaActor234 = - ModuleID("com.typesafe.akka", "akka-actor", "2.3.4").withConfigurations(Some("compile")) cross CrossVersion.binary + ModuleID("com.typesafe.akka", "akka-actor", "2.3.4").withConfigurations( + Some("compile") + ) cross CrossVersion.binary def scala2102 = ModuleID("org.scala-lang", "scala-library", "2.10.2").withConfigurations(Some("compile")) def scala2103 = @@ -317,13 +331,21 @@ object EvictionWarningSpec extends BaseIvySpecification { def commonsIo14 = ModuleID("commons-io", "commons-io", "1.4").withConfigurations(Some("compile")) def commonsIo24 = ModuleID("commons-io", "commons-io", "2.4").withConfigurations(Some("compile")) def bnfparser10 = - ModuleID("ca.gobits.bnf", "bnfparser", "1.0").withConfigurations(Some("compile")) // uses commons-io 2.4 + ModuleID("ca.gobits.bnf", "bnfparser", "1.0").withConfigurations( + Some("compile") + ) // uses commons-io 2.4 def unfilteredUploads080 = - ModuleID("net.databinder", "unfiltered-uploads", "0.8.0").withConfigurations(Some("compile")) cross CrossVersion.binary // uses commons-io 1.4 + ModuleID("net.databinder", "unfiltered-uploads", "0.8.0").withConfigurations( + Some("compile") + ) cross CrossVersion.binary // uses commons-io 1.4 def bananaSesame04 = - ModuleID("org.w3", "banana-sesame", "0.4").withConfigurations(Some("compile")) cross CrossVersion.binary // uses akka-actor 2.1.4 + ModuleID("org.w3", "banana-sesame", "0.4").withConfigurations( + Some("compile") + ) cross CrossVersion.binary // uses akka-actor 2.1.4 def akkaRemote234 = - ModuleID("com.typesafe.akka", "akka-remote", "2.3.4").withConfigurations(Some("compile")) cross CrossVersion.binary // uses akka-actor 2.3.4 + ModuleID("com.typesafe.akka", "akka-remote", "2.3.4").withConfigurations( + Some("compile") + ) cross CrossVersion.binary // uses akka-actor 2.3.4 def fullOptions = EvictionWarningOptions.full def javaLibDirectDeps = Vector(commonsIo14, commonsIo24) diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/InconsistentDuplicateSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/InconsistentDuplicateSpec.scala index db9344070..46e830c04 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/InconsistentDuplicateSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/InconsistentDuplicateSpec.scala @@ -24,9 +24,15 @@ object InconsistentDuplicateSpec extends BasicTestSuite { } def akkaActor214 = - ModuleID("com.typesafe.akka", "akka-actor", "2.1.4").withConfigurations(Some("compile")) cross CrossVersion.binary + ModuleID("com.typesafe.akka", "akka-actor", "2.1.4").withConfigurations( + Some("compile") + ) cross CrossVersion.binary def akkaActor230 = - ModuleID("com.typesafe.akka", "akka-actor", "2.3.0").withConfigurations(Some("compile")) cross CrossVersion.binary + ModuleID("com.typesafe.akka", "akka-actor", "2.3.0").withConfigurations( + Some("compile") + ) cross CrossVersion.binary def akkaActor230Test = - ModuleID("com.typesafe.akka", "akka-actor", "2.3.0").withConfigurations(Some("test")) cross CrossVersion.binary + ModuleID("com.typesafe.akka", "akka-actor", "2.3.0").withConfigurations( + Some("test") + ) cross CrossVersion.binary } diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala index 97515d9ef..c3235b934 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/IvyRepoSpec.scala @@ -17,7 +17,7 @@ object IvyRepoSpec extends BaseIvySpecification { module( ourModuleID, Vector(dep), - None //, UpdateOptions().withCachedResolution(true) + None // , UpdateOptions().withCachedResolution(true) ) } @@ -31,13 +31,11 @@ object IvyRepoSpec extends BaseIvySpecification { val report = ivyUpdate(m) import Inside._ - inside(report.configuration(ConfigRef("compile")).map(_.modules)) { - case Some(Seq(mr)) => - inside(mr.artifacts) { - case Seq((ar, _)) => - assert(ar.`type` == "jar") - assert(ar.extension == "jar") - } + inside(report.configuration(ConfigRef("compile")).map(_.modules)) { case Some(Seq(mr)) => + inside(mr.artifacts) { case Seq((ar, _)) => + assert(ar.`type` == "jar") + assert(ar.extension == "jar") + } } } @@ -90,14 +88,12 @@ object IvyRepoSpec extends BaseIvySpecification { .get import Inside._ - inside(report2.configuration(ConfigRef("compile")).map(_.modules)) { - case Some(Seq(mr)) => - inside(mr.artifacts) { - case Seq((ar, _)) => - assert(ar.name == "libmodule-source") - assert(ar.`type` == "src") - assert(ar.extension == "jar") - } + inside(report2.configuration(ConfigRef("compile")).map(_.modules)) { case Some(Seq(mr)) => + inside(mr.artifacts) { case Seq((ar, _)) => + assert(ar.name == "libmodule-source") + assert(ar.`type` == "src") + assert(ar.extension == "jar") + } } } diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/MergeDescriptorSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/MergeDescriptorSpec.scala index 898402224..780613096 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/MergeDescriptorSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/MergeDescriptorSpec.scala @@ -14,20 +14,19 @@ object MergeDescriptorSpec extends BaseIvySpecification { None, UpdateOptions() ) - m.withModule(log) { - case (_, md, _) => - val deps = md.getDependencies - assert(deps.size == 1) - deps.headOption.getOrElse(sys.error("Dependencies not found")) match { - case dd @ MergedDescriptors(_, _) => - val arts = dd.getAllDependencyArtifacts - val a0: DependencyArtifactDescriptor = arts.toList(0) - val a1: DependencyArtifactDescriptor = arts.toList(1) - val configs0 = a0.getConfigurations.toList - val configs1 = a1.getConfigurations.toList - assert(configs0 == List("compile")) - assert(configs1 == List("test")) - } + m.withModule(log) { case (_, md, _) => + val deps = md.getDependencies + assert(deps.size == 1) + deps.headOption.getOrElse(sys.error("Dependencies not found")) match { + case dd @ MergedDescriptors(_, _) => + val arts = dd.getAllDependencyArtifacts + val a0: DependencyArtifactDescriptor = arts.toList(0) + val a1: DependencyArtifactDescriptor = arts.toList(1) + val configs0 = a0.getConfigurations.toList + val configs1 = a1.getConfigurations.toList + assert(configs0 == List("compile")) + assert(configs1 == List("test")) + } } } def guavaTest = diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/ResolutionSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/ResolutionSpec.scala index 818da8155..6b8fc49bc 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/ResolutionSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/ResolutionSpec.scala @@ -70,10 +70,10 @@ abstract class ResolutionSpec extends AbstractEngineSpec { // second resolution reads from the minigraph val report = update(m) val modules: Seq[String] = report.configurations.head.modules map { _.toString } - assert(modules exists { x: String => + assert(modules exists { (x: String) => x contains """org.jboss.netty:netty:3.2.0.Final""" }) - assert(!(modules exists { x: String => + assert(!(modules exists { (x: String) => x contains """org.jboss.netty:netty:3.2.1.Final""" })) } diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/SftpRepoSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/SftpRepoSpec.scala index 2bf13668d..c131e2900 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/SftpRepoSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/SftpRepoSpec.scala @@ -13,7 +13,7 @@ import java.nio.file.Paths object SftpRepoSpec extends BaseIvySpecification { val repo: Option[String] = None // val repo: Option[String] = Some("some repo") - //a dependency which depends on another in the repo + // a dependency which depends on another in the repo def org(repo: String) = s"com.${repo}" def module(org: String) = org % "some-lib" % "version" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 59367176b..48df24769 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -5,12 +5,13 @@ import sbt.contraband.ContrabandPlugin.autoImport._ object Dependencies { val scala212 = "2.12.15" val scala213 = "2.13.6" + val scala3 = "3.1.0" def nightlyVersion: Option[String] = sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version") private val ioVersion = nightlyVersion.getOrElse("1.6.0") - private val utilVersion = nightlyVersion.getOrElse("1.6.0") + private val utilVersion = nightlyVersion.getOrElse("2.0.0-alpha1") private val sbtIO = "org.scala-sbt" %% "io" % ioVersion @@ -51,16 +52,17 @@ object Dependencies { val jsch = "com.jcraft" % "jsch" % "0.1.54" intransitive () val scalaReflect = Def.setting { "org.scala-lang" % "scala-reflect" % scalaVersion.value } val scalaCompiler = Def.setting { "org.scala-lang" % "scala-compiler" % scalaVersion.value } - val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.2.0" - val scalaTest = "org.scalatest" %% "scalatest" % "3.2.0" + val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "2.0.1" + val scalaTest = "org.scalatest" %% "scalatest" % "3.2.10" val scalaVerify = "com.eed3si9n.verify" %% "verify" % "1.0.0" - val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.14.0" + val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.15.3" + val sjsonNewVersion = "0.10.0" val sjsonnew = Def.setting { - "com.eed3si9n" %% "sjson-new-core" % contrabandSjsonNewVersion.value + "com.eed3si9n" %% "sjson-new-core" % sjsonNewVersion } val sjsonnewScalaJson = Def.setting { - "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value + "com.eed3si9n" %% "sjson-new-scalajson" % sjsonNewVersion } - val gigahorseOkhttp = "com.eed3si9n" %% "gigahorse-okhttp" % "0.5.0" + val gigahorseOkhttp = "com.eed3si9n" %% "gigahorse-okhttp" % "0.6.0" val okhttpUrlconnection = "com.squareup.okhttp3" % "okhttp-urlconnection" % "3.7.0" } diff --git a/project/build.properties b/project/build.properties index f0be67b9f..3161d2146 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.1 +sbt.version=1.6.1 diff --git a/project/plugins.sbt b/project/plugins.sbt index f55cc0ddd..ff65f715d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,7 +2,7 @@ addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.0.0") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.2") -addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.5.1") +addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.5.3") addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.14") scalacOptions += "-language:postfixOps"