This commit is contained in:
Eugene Yokota 2022-01-29 23:29:07 -05:00
parent 31db59c825
commit e9ee8a6cab
46 changed files with 242 additions and 208 deletions

View File

@ -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

View File

@ -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,

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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")
}

View File

@ -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 {

View File

@ -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")
}

View File

@ -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 {

View File

@ -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")
}

View File

@ -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 {

View File

@ -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")
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 = <methodName> 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))
"<error>"
}
}
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 =

View File

@ -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] =

View File

@ -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)
}
}

View File

@ -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 =

View File

@ -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 {

View File

@ -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")
}

View File

@ -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 = <g>{x}</g> \ "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) {

View File

@ -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)

View File

@ -202,7 +202,7 @@ class MakePom(val log: Logger) {
if (moduleInfo.developers.nonEmpty) {
<developers>
{
moduleInfo.developers.map { developer: Developer =>
moduleInfo.developers.map { (developer: Developer) =>
<developer>
<id>{developer.id}</id>
<name>{developer.name}</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)

View File

@ -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 {

View File

@ -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 {

View File

@ -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", ****)"""
)
}

View File

@ -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)
}

View File

@ -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

View File

@ -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)

View File

@ -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
}

View File

@ -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")
}
}
}

View File

@ -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 =

View File

@ -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"""
}))
}

View File

@ -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"

View File

@ -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"
}

View File

@ -1 +1 @@
sbt.version=1.5.1
sbt.version=1.6.1

View File

@ -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"