mirror of https://github.com/sbt/sbt.git
Fix lm-coursier compilation
This commit is contained in:
parent
327b816ebe
commit
e3b78cec99
|
|
@ -1,6 +1,5 @@
|
|||
package sbt.librarymanagement
|
||||
|
||||
import sbt.librarymanagement.Configurations.config
|
||||
import org.scalatest.funspec.AnyFunSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package sbt.librarymanagement
|
|||
|
||||
import sbt.internal.librarymanagement.UnitSpec
|
||||
import CrossVersion._
|
||||
import scala.annotation.nowarn
|
||||
|
||||
class CrossVersionTest extends UnitSpec {
|
||||
"sbtApiVersion" should "for xyz return None" in {
|
||||
|
|
@ -339,7 +340,7 @@ class CrossVersionTest extends UnitSpec {
|
|||
|
||||
"Disabled" should "have structural equality" in {
|
||||
Disabled() shouldBe Disabled()
|
||||
}
|
||||
}: @nowarn
|
||||
"CrossVersion.full" should "have structural equality" in {
|
||||
CrossVersion.full shouldBe CrossVersion.full
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package coursier.cache.protocol
|
||||
|
||||
import java.net.{URL, URLConnection, URLStreamHandler, URLStreamHandlerFactory}
|
||||
import java.net.{ URL, URLConnection, URLStreamHandler, URLStreamHandlerFactory }
|
||||
|
||||
class CustomprotocolHandler extends URLStreamHandlerFactory {
|
||||
def createURLStreamHandler(protocol: String): URLStreamHandler = new URLStreamHandler {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package lmcoursier
|
|||
import java.io.File
|
||||
import dataclass.{ data, since }
|
||||
import coursier.cache.CacheDefaults
|
||||
import coursier.params.rule.{ Rule, RuleResolution }
|
||||
import lmcoursier.credentials.Credentials
|
||||
import lmcoursier.definitions.{
|
||||
Authentication,
|
||||
|
|
@ -16,20 +15,10 @@ import lmcoursier.definitions.{
|
|||
Reconciliation,
|
||||
Strict
|
||||
}
|
||||
import sbt.librarymanagement.{
|
||||
CrossVersion,
|
||||
InclExclRule,
|
||||
ModuleDescriptorConfiguration,
|
||||
ModuleID,
|
||||
ModuleInfo,
|
||||
Resolver,
|
||||
UpdateConfiguration
|
||||
}
|
||||
import sbt.librarymanagement.{ InclExclRule, ModuleID, Resolver }
|
||||
import xsbti.Logger
|
||||
|
||||
import scala.concurrent.duration.{ Duration, FiniteDuration }
|
||||
import java.net.URL
|
||||
import java.net.URLClassLoader
|
||||
|
||||
@data class CoursierConfiguration(
|
||||
log: Option[Logger] = None,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package lmcoursier
|
||||
|
||||
import java.io.File
|
||||
import java.net.{ URL, URLClassLoader, URLConnection, MalformedURLException }
|
||||
import java.net.{ URL, URLClassLoader }
|
||||
|
||||
import coursier.{ Organization, Resolution, organizationString }
|
||||
import coursier.{ Organization, Resolution }
|
||||
import coursier.core.{ Classifier, Configuration }
|
||||
import coursier.cache.{ CacheDefaults, CachePolicy }
|
||||
import coursier.cache.CacheDefaults
|
||||
import coursier.util.Artifact
|
||||
import coursier.internal.Typelevel
|
||||
import lmcoursier.definitions.ToCoursier
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ object FromSbt {
|
|||
)
|
||||
|
||||
val prefix = "e:" + SbtPomExtraProperties.POM_INFO_KEY_PREFIX
|
||||
val properties = projectID.extraAttributes
|
||||
val properties = projectID.extraAttributes.view
|
||||
.filterKeys(_.startsWith(prefix))
|
||||
.toSeq
|
||||
.map { case (k, v) => (k.stripPrefix("e:"), v) }
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package lmcoursier
|
||||
|
||||
import coursier.ivy.IvyXml.{ mappings => initialIvyXmlMappings }
|
||||
import lmcoursier.definitions.{ Configuration, Module, ModuleName, Organization, ToCoursier }
|
||||
import lmcoursier.definitions.{ Configuration, Module, ModuleName, Organization }
|
||||
import sbt.librarymanagement.{ CrossVersion, InclExclRule, ModuleID }
|
||||
import sbt.util.Logger
|
||||
|
||||
|
|
@ -68,9 +68,9 @@ object Inputs {
|
|||
def helper(
|
||||
done: Set[Configuration],
|
||||
toAdd: List[Configuration]
|
||||
): Stream[(Configuration, Seq[Configuration])] =
|
||||
): LazyList[(Configuration, Seq[Configuration])] =
|
||||
toAdd match {
|
||||
case Nil => Stream.empty
|
||||
case Nil => LazyList.empty
|
||||
case config :: rest =>
|
||||
val extends0 = map.getOrElse(config, Nil)
|
||||
val missingExtends = extends0.filterNot(done)
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ object IvyXml {
|
|||
}
|
||||
|
||||
val publications = project.publications
|
||||
.groupBy { case (_, p) => p }
|
||||
.mapValues { _.map { case (cfg, _) => cfg } }
|
||||
.groupMap((_, p) => p)((cfg, _) => cfg)
|
||||
|
||||
val publicationElems = publications.map { case (pub, configs) =>
|
||||
val n = <artifact name={pub.name} type={pub.`type`.value} ext={pub.ext.value} conf={
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package lmcoursier.credentials
|
||||
|
||||
import java.io.File
|
||||
|
||||
abstract class Credentials extends Serializable
|
||||
|
||||
object Credentials
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package lmcoursier.definitions
|
|||
object FromCoursier {
|
||||
|
||||
def cachePolicy(r: coursier.cache.CachePolicy): CachePolicy =
|
||||
r match {
|
||||
(r: @unchecked) match {
|
||||
case coursier.cache.CachePolicy.LocalOnly => CachePolicy.LocalOnly
|
||||
case coursier.cache.CachePolicy.LocalOnlyIfValid => CachePolicy.LocalOnlyIfValid
|
||||
case coursier.cache.CachePolicy.LocalUpdateChanging => CachePolicy.LocalUpdateChanging
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import org.apache.ivy.plugins.resolver.IBiblioResolver
|
|||
import sbt.librarymanagement.{ Configuration => _, MavenRepository => _, _ }
|
||||
import sbt.util.Logger
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.jdk.CollectionConverters._
|
||||
|
||||
object Resolvers {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package lmcoursier.internal
|
||||
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
import java.util.GregorianCalendar
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import coursier.cache.CacheUrl
|
||||
|
|
@ -13,6 +12,7 @@ import sbt.librarymanagement.{ Artifact => _, Configuration => _, _ }
|
|||
import sbt.util.Logger
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import coursier.core.MinimizedExclusions
|
||||
|
||||
private[internal] object SbtUpdateReport {
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ private[internal] object SbtUpdateReport {
|
|||
def clean(dep: Dependency): Dependency =
|
||||
dep
|
||||
.withConfiguration(Configuration.empty)
|
||||
.withExclusions(Set.empty)
|
||||
.withMinimizedExclusions(MinimizedExclusions.zero)
|
||||
.withOptional(false)
|
||||
|
||||
def lookupProject(mv: coursier.core.Resolution.ModuleVersion): Option[Project] =
|
||||
|
|
@ -259,17 +259,11 @@ private[internal] object SbtUpdateReport {
|
|||
|
||||
val reverseDependencies = {
|
||||
val transitiveReverseDependencies = res.reverseDependencies.toVector
|
||||
.map { case (k, v) =>
|
||||
clean(k) -> v.map(clean)
|
||||
}
|
||||
.groupBy(_._1)
|
||||
.mapValues(_.flatMap(_._2))
|
||||
.map { case (k, v) => clean(k) -> v.map(clean) }
|
||||
.groupMapReduce(_._1)((_, deps) => deps)(_ ++ _)
|
||||
|
||||
(transitiveReverseDependencies.toVector ++ directReverseDependencies.toVector)
|
||||
.groupBy(_._1)
|
||||
.mapValues(_.flatMap(_._2).toVector)
|
||||
.toVector
|
||||
.toMap
|
||||
.groupMapReduce(_._1)((_, deps) => deps)(_ ++ _)
|
||||
}
|
||||
|
||||
groupedDepArtifacts.toVector.map { case (dep, artifacts) =>
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ object UpdateRun {
|
|||
)
|
||||
|
||||
val projCache = params.res.values.foldLeft(Map.empty[ModuleVersion, Project])(
|
||||
_ ++ _.projectCache.mapValues(_._2)
|
||||
_ ++ _.projectCache.view.mapValues(_._2).toMap
|
||||
)
|
||||
val repr = Print.dependenciesUnknownConfigs(finalDeps.toVector, projCache)
|
||||
log.info(repr.split('\n').map(" " + _).mkString("\n"))
|
||||
|
|
@ -87,10 +87,6 @@ object UpdateRun {
|
|||
}
|
||||
|
||||
private def grouped[K, V](map: Seq[(K, V)]): Map[K, Seq[V]] =
|
||||
map
|
||||
.groupBy(_._1)
|
||||
.mapValues(_.map(_._2))
|
||||
.iterator
|
||||
.toMap
|
||||
map.groupMap(_._1)((_, values) => values)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,20 +3,11 @@ package lmcoursier
|
|||
import coursier.cache.CacheDefaults
|
||||
import lmcoursier.credentials._
|
||||
import lmcoursier.definitions._
|
||||
import sbt.librarymanagement.{
|
||||
Resolver,
|
||||
UpdateConfiguration,
|
||||
ModuleID,
|
||||
CrossVersion,
|
||||
ModuleInfo,
|
||||
ModuleDescriptorConfiguration
|
||||
}
|
||||
import sbt.librarymanagement.{ Resolver, UpdateConfiguration }
|
||||
import xsbti.Logger
|
||||
|
||||
import scala.concurrent.duration.{ Duration, FiniteDuration }
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
import java.net.URLClassLoader
|
||||
|
||||
package object syntax {
|
||||
implicit class CoursierConfigurationModule(value: CoursierConfiguration.type) {
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ final class ResolutionSpec extends AnyPropSpec with Matchers {
|
|||
val resolution =
|
||||
lmEngine.update(coursierModule, UpdateConfiguration(), UnresolvedWarningConfiguration(), log)
|
||||
|
||||
val r = resolution.right.get
|
||||
val r = resolution.toOption.get
|
||||
|
||||
val componentConfig = r.configurations.find(_.configuration == Component.toConfigRef).get
|
||||
componentConfig.modules should have size 2
|
||||
|
|
@ -100,7 +100,7 @@ final class ResolutionSpec extends AnyPropSpec with Matchers {
|
|||
val resolution =
|
||||
lmEngine.update(coursierModule, UpdateConfiguration(), UnresolvedWarningConfiguration(), log)
|
||||
|
||||
val r = resolution.right.get
|
||||
val r = resolution.toOption.get
|
||||
|
||||
val modules = r.configurations.flatMap(_.modules)
|
||||
modules.map(_.module.name) should contain("main_2.12")
|
||||
|
|
@ -155,7 +155,7 @@ final class ResolutionSpec extends AnyPropSpec with Matchers {
|
|||
lmEngine.update(coursierModule, UpdateConfiguration(), UnresolvedWarningConfiguration(), log)
|
||||
|
||||
|
||||
val report = resolution.right.get
|
||||
val report = resolution.toOption.get
|
||||
|
||||
val modules = report.configurations.flatMap(_.modules)
|
||||
modules.map(_.module).map(module => (module.organization, module.name, module.revision)) should contain(
|
||||
|
|
@ -196,7 +196,7 @@ final class ResolutionSpec extends AnyPropSpec with Matchers {
|
|||
lmEngine.update(coursierModule, UpdateConfiguration(), UnresolvedWarningConfiguration(), log)
|
||||
|
||||
|
||||
val report = resolution.right.get
|
||||
val report = resolution.toOption.get
|
||||
|
||||
val modules = report.configurations.flatMap(_.modules)
|
||||
modules.map(_.module).map(module => (module.organization, module.name, module.revision)) should contain(
|
||||
|
|
@ -213,7 +213,7 @@ final class ResolutionSpec extends AnyPropSpec with Matchers {
|
|||
val resolution =
|
||||
lmEngine.update(coursierModule, UpdateConfiguration(), UnresolvedWarningConfiguration(), log)
|
||||
|
||||
val r = resolution.right.get
|
||||
val r = resolution.toOption.get
|
||||
|
||||
val componentConfig = r.configurations.find(_.configuration == Compile.toConfigRef).get
|
||||
componentConfig.modules.map(_.module.name) should have size 5
|
||||
|
|
@ -249,7 +249,7 @@ final class ResolutionSpec extends AnyPropSpec with Matchers {
|
|||
|
||||
assert(resolution.isRight)
|
||||
val componentConfig =
|
||||
resolution.right.get.configurations.find(_.configuration == Compile.toConfigRef).get
|
||||
resolution.toOption.get.configurations.find(_.configuration == Compile.toConfigRef).get
|
||||
val compress = componentConfig.modules.find(_.module.name == "commons-compress").get
|
||||
compress.licenses should have size 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue