mirror of https://github.com/sbt/sbt.git
more stable managed classpath ordering
This commit is contained in:
parent
a2bbf741ad
commit
15e785a1e4
|
|
@ -13,19 +13,13 @@ import report.{ArtifactDownloadReport, ConfigurationResolveReport, ResolveReport
|
|||
|
||||
object IvyRetrieve
|
||||
{
|
||||
def reports(report: ResolveReport): Map[String, ConfigurationResolveReport] =
|
||||
( for( conf <- report.getConfigurations) yield (conf, report.getConfigurationReport(conf)) ).toMap
|
||||
def reports(report: ResolveReport): Seq[ConfigurationResolveReport] =
|
||||
report.getConfigurations map report.getConfigurationReport
|
||||
|
||||
def moduleReports(confReport: ConfigurationResolveReport): Map[ModuleID, ModuleReport] =
|
||||
moduleReportMap(confReport) map { case (mid, arts) => (mid, artifactReports(mid, arts) ) }
|
||||
def moduleReports(confReport: ConfigurationResolveReport): Seq[ModuleReport] =
|
||||
for( revId <- confReport.getModuleRevisionIds.toArray collect { case revId: ModuleRevisionId => revId }) yield
|
||||
artifactReports(toModuleID(revId), confReport getDownloadReports revId)
|
||||
|
||||
def moduleReportMap(confReport: ConfigurationResolveReport): Map[ModuleID, Seq[ArtifactDownloadReport]] =
|
||||
{
|
||||
val modules =
|
||||
for( revId <- confReport.getModuleRevisionIds.toArray collect { case revId: ModuleRevisionId => revId }) yield
|
||||
(toModuleID(revId), (confReport getDownloadReports revId).toSeq)
|
||||
modules.toMap
|
||||
}
|
||||
def artifactReports(mid: ModuleID, artReport: Seq[ArtifactDownloadReport]): ModuleReport =
|
||||
{
|
||||
val missing = new mutable.ListBuffer[Artifact]
|
||||
|
|
@ -38,7 +32,7 @@ object IvyRetrieve
|
|||
else
|
||||
resolved += ((art,file))
|
||||
}
|
||||
new ModuleReport(mid, resolved.toMap, missing.toSet)
|
||||
new ModuleReport(mid, resolved.toSeq, missing.toSeq)
|
||||
}
|
||||
|
||||
def toModuleID(revID: ModuleRevisionId): ModuleID =
|
||||
|
|
@ -51,27 +45,28 @@ object IvyRetrieve
|
|||
}
|
||||
|
||||
def updateReport(report: ResolveReport): UpdateReport =
|
||||
new UpdateReport(reports(report) mapValues configurationReport)
|
||||
new UpdateReport(reports(report) map configurationReport)
|
||||
|
||||
def configurationReport(confReport: ConfigurationResolveReport): ConfigurationReport =
|
||||
new ConfigurationReport(confReport.getConfiguration, moduleReports(confReport))
|
||||
}
|
||||
|
||||
final class UpdateReport(val configurations: Map[String, ConfigurationReport])
|
||||
final class UpdateReport(val configurations: Seq[ConfigurationReport])
|
||||
{
|
||||
override def toString = "Update report:\n" + configurations.values.mkString
|
||||
def allModules: Seq[ModuleID] = configurations.values.toSeq.flatMap(_.allModules).distinct
|
||||
override def toString = "Update report:\n" + configurations.mkString
|
||||
def allModules: Seq[ModuleID] = configurations.flatMap(_.allModules).distinct
|
||||
def retrieve(f: (String, ModuleID, Artifact, File) => File): UpdateReport =
|
||||
new UpdateReport(configurations map { case (k,v) => (k, v retrieve f)} )
|
||||
new UpdateReport(configurations map { _ retrieve f} )
|
||||
def configuration(s: String) = configurations.find(_.configuration == s)
|
||||
}
|
||||
final class ConfigurationReport(val configuration: String, val modules: Map[ModuleID, ModuleReport])
|
||||
final class ConfigurationReport(val configuration: String, val modules: Seq[ModuleReport])
|
||||
{
|
||||
override def toString = "\t" + configuration + ":\n" + modules.values.mkString
|
||||
def allModules: Seq[ModuleID] = modules.keys.toSeq
|
||||
override def toString = "\t" + configuration + ":\n" + modules.mkString
|
||||
def allModules: Seq[ModuleID] = modules.map(_.module)
|
||||
def retrieve(f: (String, ModuleID, Artifact, File) => File): ConfigurationReport =
|
||||
new ConfigurationReport(configuration, modules map { case (k,v) => (k, v.retrieve( (mid,art,file) => f(configuration, mid, art, file)) ) })
|
||||
new ConfigurationReport(configuration, modules map { _.retrieve( (mid,art,file) => f(configuration, mid, art, file)) })
|
||||
}
|
||||
final class ModuleReport(val module: ModuleID, val artifacts: Map[Artifact, File], val missingArtifacts: Set[Artifact])
|
||||
final class ModuleReport(val module: ModuleID, val artifacts: Seq[(Artifact, File)], val missingArtifacts: Seq[Artifact])
|
||||
{
|
||||
override def toString =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@ object CacheIvy
|
|||
updateReportFormat
|
||||
}
|
||||
implicit def updateReportFormat(implicit m: Format[String], cr: Format[ConfigurationReport]): Format[UpdateReport] =
|
||||
wrap[UpdateReport, Map[String,ConfigurationReport]](_.configurations, c => new UpdateReport(c))
|
||||
wrap[UpdateReport, Seq[ConfigurationReport]](_.configurations, c => new UpdateReport(c))
|
||||
implicit def confReportFormat(implicit mf: Format[ModuleID], mr: Format[ModuleReport]): Format[ConfigurationReport] =
|
||||
wrap[ConfigurationReport, (String,Map[ModuleID,ModuleReport])]( r => (r.configuration, r.modules), { case (c,m) => new ConfigurationReport(c,m) })
|
||||
wrap[ConfigurationReport, (String,Seq[ModuleReport])]( r => (r.configuration, r.modules), { case (c,m) => new ConfigurationReport(c,m) })
|
||||
implicit def moduleReportFormat(implicit f: Format[Artifact], ff: Format[File], mid: Format[ModuleID]): Format[ModuleReport] =
|
||||
wrap[ModuleReport, (ModuleID, Map[Artifact, File], Set[Artifact])]( m => (m.module, m.artifacts, m.missingArtifacts), { case (m, as, ms) => new ModuleReport(m, as,ms) })
|
||||
wrap[ModuleReport, (ModuleID, Seq[(Artifact, File)], Seq[Artifact])]( m => (m.module, m.artifacts, m.missingArtifacts), { case (m, as, ms) => new ModuleReport(m, as,ms) })
|
||||
implicit def artifactFormat(implicit sf: Format[String], of: Format[Seq[Configuration]], cf: Format[Configuration], uf: Format[Option[URL]]): Format[Artifact] =
|
||||
wrap[Artifact, (String,String,String,Option[String],Seq[Configuration],Option[URL],Map[String,String])](
|
||||
a => (a.name, a.`type`, a.extension, a.classifier, a.configurations.toSeq, a.url, a.extraAttributes),
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ object Defaults
|
|||
}
|
||||
else
|
||||
{
|
||||
IO.writeLines(descriptor, plugins.toSeq)
|
||||
IO.writeLines(descriptor, plugins.toSeq.sorted)
|
||||
descriptor :: Nil
|
||||
}
|
||||
}
|
||||
|
|
@ -693,9 +693,9 @@ object Classpaths
|
|||
def managedJars(config: Configuration, up: UpdateReport): Classpath =
|
||||
allJars( confReport(config.name, up) )
|
||||
def confReport(config: String, up: UpdateReport): ConfigurationReport =
|
||||
up.configurations.getOrElse(config, error("Configuration '" + config + "' unresolved by 'update'."))
|
||||
def allJars(cr: ConfigurationReport): Seq[File] = cr.modules.values.toSeq.flatMap(mr => allJars(mr.artifacts))
|
||||
def allJars(as: Iterable[(Artifact,File)]): Iterable[File] = as collect { case (a, f) if isJar(a) => f }
|
||||
up.configuration(config) getOrElse error("Configuration '" + config + "' unresolved by 'update'.")
|
||||
def allJars(cr: ConfigurationReport): Seq[File] = cr.modules.flatMap(mr => allJars(mr.artifacts))
|
||||
def allJars(as: Seq[(Artifact,File)]): Seq[File] = as collect { case (a, f) if isJar(a) => f }
|
||||
def isJar(a: Artifact): Boolean = a.`type` == "jar"
|
||||
|
||||
lazy val dbResolver = Resolver.url("sbt-db", new URL("http://databinder.net/repo/"))(Resolver.ivyStylePatterns)
|
||||
|
|
|
|||
Loading…
Reference in New Issue