mirror of https://github.com/sbt/sbt.git
Merge pull request #65 from dwijnand/upgrades
Upgrade from sbt/datatype to sbt/contraband, + fixes and cleanups
This commit is contained in:
commit
0f9babaa31
|
|
@ -2,6 +2,4 @@ language: scala
|
|||
scala:
|
||||
- 2.11.8
|
||||
jdk:
|
||||
- openjdk7
|
||||
- oraclejdk7
|
||||
- oraclejdk8
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ lazy val lm = (project in file("librarymanagement")).
|
|||
libraryDependencies ++= scalaXml.value,
|
||||
resourceGenerators in Compile += Def.task(Util.generateVersionFile(version.value, resourceManaged.value, streams.value, (compile in Compile).value)).taskValue,
|
||||
binaryIssueFilters ++= Seq(),
|
||||
datatypeFormatsForType in generateDatatypes in Compile := DatatypeConfig.getFormats,
|
||||
contrabandFormatsForType in generateContrabands in Compile := DatatypeConfig.getFormats,
|
||||
// WORKAROUND sbt/sbt#2205 include managed sources in packageSrc
|
||||
mappings in (Compile, packageSrc) ++= {
|
||||
val srcs = (managedSources in Compile).value
|
||||
|
|
@ -59,7 +59,7 @@ lazy val lm = (project in file("librarymanagement")).
|
|||
}
|
||||
).
|
||||
configure(addSbtIO, addSbtUtilLogging, addSbtUtilTesting, addSbtUtilCollection, addSbtUtilCompletion, addSbtUtilCache).
|
||||
enablePlugins(DatatypePlugin, JsonCodecPlugin)
|
||||
enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
||||
|
||||
def customCommands: Seq[Setting[_]] = Seq(
|
||||
commands += Command.command("release") { state =>
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
{ "name": "name", "type": "String" },
|
||||
{ "name": "type", "type": "String", "default": "Artifact.DefaultType", "since": "0.0.1" },
|
||||
{ "name": "extension", "type": "String", "default": "Artifact.DefaultExtension", "since": "0.0.1" },
|
||||
{ "name": "classifier", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "classifier", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "url", "type": "java.net.URL?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "url", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" }
|
||||
],
|
||||
"parentsCompanion": "sbt.librarymanagement.ArtifactFunctions"
|
||||
|
|
@ -208,14 +208,14 @@
|
|||
"target": "Scala",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{ "name": "scalaFullVersion", "type": "String" },
|
||||
{ "name": "scalaBinaryVersion", "type": "String" },
|
||||
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*" },
|
||||
{ "name": "checkExplicit", "type": "boolean" },
|
||||
{ "name": "filterImplicit", "type": "boolean" },
|
||||
{ "name": "overrideScalaVersion", "type": "boolean" },
|
||||
{ "name": "scalaOrganization", "type": "String", "default": "sbt.librarymanagement.ScalaArtifacts.Organization", "since": "0.0.1" },
|
||||
{ "name": "scalaArtifacts", "type": "String*", "default": "sbt.librarymanagement.ScalaArtifacts.Artifacts", "since": "0.0.1" }
|
||||
{ "name": "scalaFullVersion", "type": "String" },
|
||||
{ "name": "scalaBinaryVersion", "type": "String" },
|
||||
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*" },
|
||||
{ "name": "checkExplicit", "type": "boolean" },
|
||||
{ "name": "filterImplicit", "type": "boolean" },
|
||||
{ "name": "overrideScalaVersion", "type": "boolean" },
|
||||
{ "name": "scalaOrganization", "type": "String", "default": "sbt.librarymanagement.ScalaArtifacts.Organization", "since": "0.0.1" },
|
||||
{ "name": "scalaArtifacts", "type": "scala.Vector[String]", "default": "sbt.librarymanagement.ScalaArtifacts.Artifacts", "since": "0.0.1" }
|
||||
],
|
||||
"parentsCompanion": "sbt.librarymanagement.IvyScalaFunctions"
|
||||
},
|
||||
|
|
@ -245,7 +245,7 @@
|
|||
{ "name": "organization", "type": "String" },
|
||||
{ "name": "name", "type": "String" },
|
||||
{ "name": "revision", "type": "String" },
|
||||
{ "name": "configurations", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "configurations", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "isChanging", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
{ "name": "isTransitive", "type": "boolean", "default": "true", "since": "0.0.1" },
|
||||
{ "name": "isForce", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
|
|
@ -254,12 +254,10 @@
|
|||
{ "name": "exclusions", "type": "sbt.librarymanagement.InclExclRule*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" },
|
||||
{ "name": "crossVersion", "type": "sbt.librarymanagement.CrossVersion", "default": "sbt.librarymanagement.Disabled()", "since": "0.0.1" },
|
||||
{ "name": "branchName", "type": "String?", "default": "None", "since": "0.0.1" }
|
||||
{ "name": "branchName", "type": "Option[String]", "default": "None", "since": "0.0.1" }
|
||||
],
|
||||
"toString": [
|
||||
"organization + \":\" + name + \":\" + revision +",
|
||||
" (configurations match { case Some(s) => \":\" + s; case None => \"\" }) +",
|
||||
" (if (extraAttributes.isEmpty) \"\" else \" \" + extraString)"
|
||||
"this.toStringImpl"
|
||||
],
|
||||
"parentsCompanion": "sbt.librarymanagement.ModuleIDFunctions"
|
||||
},
|
||||
|
|
@ -270,15 +268,15 @@
|
|||
"type": "record",
|
||||
"doc": "Additional information about a project module",
|
||||
"fields": [
|
||||
{ "name": "nameFormal", "type": "String" },
|
||||
{ "name": "description", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "java.net.URL?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "startYear", "type": "int?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "licenses", "type": "scala.Tuple2[String, java.net.URL]*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "organizationName", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "organizationHomepage", "type": "java.net.URL?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "scmInfo", "type": "sbt.librarymanagement.ScmInfo?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "developers", "type": "sbt.librarymanagement.Developer*", "default": "Vector.empty", "since": "0.0.1" }
|
||||
{ "name": "nameFormal", "type": "String" },
|
||||
{ "name": "description", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "startYear", "type": "Option[Int]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "licenses", "type": "scala.Tuple2[String, java.net.URL]*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "organizationName", "type": "String", "default": "\"\"", "since": "0.0.1" },
|
||||
{ "name": "organizationHomepage", "type": "Option[java.net.URL]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "scmInfo", "type": "Option[sbt.librarymanagement.ScmInfo]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "developers", "type": "sbt.librarymanagement.Developer*", "default": "Vector.empty", "since": "0.0.1" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -295,18 +293,18 @@
|
|||
{ "name": "module", "type": "sbt.librarymanagement.ModuleID" },
|
||||
{ "name": "artifacts", "type": "scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]*" },
|
||||
{ "name": "missingArtifacts", "type": "sbt.librarymanagement.Artifact*" },
|
||||
{ "name": "status", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "publicationDate", "type": "java.util.Date?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "resolver", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "artifactResolver", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "status", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "publicationDate", "type": "Option[java.util.Calendar]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "resolver", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "artifactResolver", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "evicted", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
{ "name": "evictedData", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "evictedReason", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "problem", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "evictedData", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "evictedReason", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "problem", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "homepage", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "extraAttributes", "type": "Map[String, String]", "default": "Map.empty", "since": "0.0.1" },
|
||||
{ "name": "isDefault", "type": "boolean?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "branch", "type": "String?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "isDefault", "type": "Option[Boolean]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "branch", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "configurations", "type": "String*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "licenses", "type": "scala.Tuple2[String, Option[String]]*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "callers", "type": "sbt.librarymanagement.Caller*", "default": "Vector.empty", "since": "0.0.1" }
|
||||
|
|
@ -359,7 +357,7 @@
|
|||
{ "name": "excludes", "type": "sbt.internal.librarymanagement.SbtExclusionRule*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "ivyXML", "type": "scala.xml.NodeSeq", "default": "scala.xml.NodeSeq.Empty", "since": "0.0.1" },
|
||||
{ "name": "configurations", "type": "sbt.librarymanagement.Configuration*", "default": "Vector.empty", "since": "0.0.1" },
|
||||
{ "name": "defaultConfiguration", "type": "sbt.librarymanagement.Configuration?", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "defaultConfiguration", "type": "Option[sbt.librarymanagement.Configuration]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "conflictManager", "type": "sbt.librarymanagement.ConflictManager", "default": "sbt.librarymanagement.ConflictManager.default", "since": "0.0.1" }
|
||||
],
|
||||
"parentsCompanion": "sbt.internal.librarymanagement.InlineConfigurationFunctions"
|
||||
|
|
@ -754,10 +752,10 @@
|
|||
"target": "Scala",
|
||||
"type": "record",
|
||||
"fields": [
|
||||
{ "name": "retrieveDirectory", "type": "java.io.File" },
|
||||
{ "name": "outputPattern", "type": "String" },
|
||||
{ "name": "sync", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
{ "name": "configurationsToRetrieve", "type": "Set[sbt.librarymanagement.Configuration]?", "default": "None", "since": "0.0.1" }
|
||||
{ "name": "retrieveDirectory", "type": "java.io.File" },
|
||||
{ "name": "outputPattern", "type": "String" },
|
||||
{ "name": "sync", "type": "boolean", "default": "false", "since": "0.0.1" },
|
||||
{ "name": "configurationsToRetrieve", "type": "Option[Set[sbt.librarymanagement.Configuration]]", "default": "None", "since": "0.0.1" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -90,7 +90,7 @@ class IvyCache(val ivyHome: Option[File], fileToStore: File => CacheStore) {
|
|||
private def basicLocalIvy(lock: Option[xsbti.GlobalLock], log: Logger) =
|
||||
{
|
||||
val local = Resolver.defaultLocal
|
||||
val paths = new IvyPaths(new File("."), ivyHome)
|
||||
val paths = IvyPaths(new File("."), ivyHome)
|
||||
val conf = new InlineIvyConfiguration(paths, Vector(local), Vector.empty, Vector.empty, false, lock, IvySbt.DefaultChecksums, None, UpdateOptions(), log)
|
||||
(new IvySbt(conf, fileToStore), local)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,16 +85,18 @@ object IvyRetrieve {
|
|||
case Some(dd) => (toExtraAttributes(dd.getExtraAttributes), dd.isForce, dd.isChanging, dd.isTransitive, false)
|
||||
case None => (Map.empty[String, String], false, false, true, false)
|
||||
}
|
||||
new Caller(m, callerConfigurations, extraAttributes, isForce, isChanging, isTransitive, isDirectlyForce)
|
||||
Caller(m, callerConfigurations, extraAttributes, isForce, isChanging, isTransitive, isDirectlyForce)
|
||||
}
|
||||
val revId = dep.getResolvedId
|
||||
val moduleId = toModuleID(revId)
|
||||
val branch = nonEmptyString(revId.getBranch)
|
||||
val (status, publicationDate, resolver, artifactResolver) = dep.isLoaded match {
|
||||
case true =>
|
||||
val c = new ju.GregorianCalendar()
|
||||
c.setTimeInMillis(dep.getPublication)
|
||||
(
|
||||
nonEmptyString(dep.getDescriptor.getStatus),
|
||||
Some(new ju.Date(dep.getPublication)),
|
||||
Some(c),
|
||||
nonEmptyString(dep.getModuleRevision.getResolver.getName),
|
||||
nonEmptyString(dep.getModuleRevision.getArtifactResolver.getName)
|
||||
)
|
||||
|
|
@ -142,7 +144,7 @@ object IvyRetrieve {
|
|||
val callers = dep.getCallers(confReport.getConfiguration).toVector map { toCaller }
|
||||
val (resolved, missing) = artifacts(moduleId, confReport getDownloadReports revId)
|
||||
|
||||
new ModuleReport(moduleId, resolved, missing, status, publicationDate, resolver, artifactResolver,
|
||||
ModuleReport(moduleId, resolved, missing, status, publicationDate, resolver, artifactResolver,
|
||||
evicted, evictedData, evictedReason, problem, homepage, extraAttributes, isDefault, branch,
|
||||
configurations, licenses, callers)
|
||||
}
|
||||
|
|
@ -161,11 +163,11 @@ object IvyRetrieve {
|
|||
}
|
||||
|
||||
def updateReport(report: ResolveReport, cachedDescriptor: File): UpdateReport =
|
||||
new UpdateReport(cachedDescriptor, reports(report) map configurationReport, updateStats(report), Map.empty) recomputeStamps ()
|
||||
UpdateReport(cachedDescriptor, reports(report) map configurationReport, updateStats(report), Map.empty) recomputeStamps ()
|
||||
def updateStats(report: ResolveReport): UpdateStats =
|
||||
new UpdateStats(report.getResolveTime, report.getDownloadTime, report.getDownloadSize, false)
|
||||
UpdateStats(report.getResolveTime, report.getDownloadTime, report.getDownloadSize, false)
|
||||
def configurationReport(confReport: ConfigurationResolveReport): ConfigurationReport =
|
||||
new ConfigurationReport(confReport.getConfiguration, moduleReports(confReport), organizationArtifactReports(confReport))
|
||||
ConfigurationReport(confReport.getConfiguration, moduleReports(confReport), organizationArtifactReports(confReport))
|
||||
|
||||
/**
|
||||
* Tries to find Ivy graph path the from node to target.
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ private[sbt] class JsonUtil(fileToStore: File => CacheStore) {
|
|||
def toLite(ur: UpdateReport): UpdateReportLite =
|
||||
UpdateReportLite(ur.configurations map { cr =>
|
||||
ConfigurationReportLite(cr.configuration, cr.details map { oar =>
|
||||
new OrganizationArtifactReport(oar.organization, oar.name, oar.modules map { mr =>
|
||||
new ModuleReport(
|
||||
OrganizationArtifactReport(oar.organization, oar.name, oar.modules map { mr =>
|
||||
ModuleReport(
|
||||
mr.module, mr.artifacts, mr.missingArtifacts, mr.status,
|
||||
mr.publicationDate, mr.resolver, mr.artifactResolver,
|
||||
mr.evicted, mr.evictedData, mr.evictedReason,
|
||||
|
|
@ -63,7 +63,7 @@ private[sbt] class JsonUtil(fileToStore: File => CacheStore) {
|
|||
|
||||
def fromLite(lite: UpdateReportLite, cachedDescriptor: File): UpdateReport =
|
||||
{
|
||||
val stats = new UpdateStats(0L, 0L, 0L, false)
|
||||
val stats = UpdateStats(0L, 0L, 0L, false)
|
||||
val configReports = lite.configurations map { cr =>
|
||||
val details = cr.details
|
||||
val modules = details flatMap {
|
||||
|
|
@ -71,8 +71,8 @@ private[sbt] class JsonUtil(fileToStore: File => CacheStore) {
|
|||
!mr.evicted && mr.problem.isEmpty
|
||||
}
|
||||
}
|
||||
new ConfigurationReport(cr.configuration, modules, details)
|
||||
ConfigurationReport(cr.configuration, modules, details)
|
||||
}
|
||||
new UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
|
||||
UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ final class RichUpdateReport(report: UpdateReport) {
|
|||
{
|
||||
val files = report.cachedDescriptor +: allFiles
|
||||
val stamps = files.map(f => (f, f.lastModified)).toMap
|
||||
new UpdateReport(report.cachedDescriptor, report.configurations, report.stats, stamps)
|
||||
UpdateReport(report.cachedDescriptor, report.configurations, report.stats, stamps)
|
||||
}
|
||||
|
||||
import DependencyFilter._
|
||||
|
|
@ -64,8 +64,8 @@ final class RichUpdateReport(report: UpdateReport) {
|
|||
val newConfigurations = report.configurations.map { confReport =>
|
||||
import confReport._
|
||||
val newModules = modules map { modReport => f(configuration, modReport) }
|
||||
new ConfigurationReport(configuration, newModules, details)
|
||||
ConfigurationReport(configuration, newModules, details)
|
||||
}
|
||||
new UpdateReport(report.cachedDescriptor, newConfigurations, report.stats, report.stamps)
|
||||
UpdateReport(report.cachedDescriptor, newConfigurations, report.stats, report.stamps)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
package sbt.internal.librarymanagement.formats
|
||||
|
||||
import sjsonnew._
|
||||
import java.util._
|
||||
import java.text._
|
||||
|
||||
trait DateFormat { self: BasicJsonProtocol =>
|
||||
private val format = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy")
|
||||
|
||||
implicit lazy val DateFormat: JsonFormat[Date] = project(_.toString, format.parse _)
|
||||
}
|
||||
|
|
@ -4,5 +4,8 @@ import sjsonnew._
|
|||
import scala.xml._
|
||||
|
||||
trait NodeSeqFormat { self: BasicJsonProtocol =>
|
||||
implicit lazy val NodeSeqFormat: JsonFormat[NodeSeq] = ???
|
||||
implicit lazy val NodeSeqFormat: JsonFormat[NodeSeq] = project[NodeSeq, String](
|
||||
xml => <binary>{ xml }</binary>.toString,
|
||||
str => XML.loadString(str).child
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,13 +402,13 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
val cachedDescriptor = getSettings.getResolutionCacheManager.getResolvedIvyFileInCache(md0.getModuleRevisionId)
|
||||
val rootModuleConfigs = md0.getConfigurations.toVector
|
||||
val cachedReports = reports filter { !_.stats.cached }
|
||||
val stats = new UpdateStats(resolveTime, (cachedReports map { _.stats.downloadTime }).sum, (cachedReports map { _.stats.downloadSize }).sum, false)
|
||||
val stats = UpdateStats(resolveTime, (cachedReports map { _.stats.downloadTime }).sum, (cachedReports map { _.stats.downloadSize }).sum, false)
|
||||
val configReports = rootModuleConfigs map { conf =>
|
||||
log.debug("::: -----------")
|
||||
val crs = reports flatMap { _.configurations filter { _.configuration == conf.getName } }
|
||||
mergeConfigurationReports(conf.getName, crs, os, log)
|
||||
}
|
||||
new UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
|
||||
UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
|
||||
}
|
||||
// memory usage 62%, of which 58% is in mergeOrganizationArtifactReports
|
||||
def mergeConfigurationReports(rootModuleConf: String, reports: Vector[ConfigurationReport], os: Vector[IvyOverride], log: Logger): ConfigurationReport =
|
||||
|
|
@ -420,7 +420,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
!mr.evicted && mr.problem.isEmpty
|
||||
}
|
||||
}
|
||||
new ConfigurationReport(rootModuleConf, modules, details)
|
||||
ConfigurationReport(rootModuleConf, modules, details)
|
||||
}
|
||||
/**
|
||||
* Returns a tuple of (merged org + name combo, newly evicted modules)
|
||||
|
|
@ -579,7 +579,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
val notEvicted = (survivor ++ newlyEvicted) filter { m => !m.evicted }
|
||||
log.debug("::: adds " + (notEvicted map { _.module }).mkString(", "))
|
||||
log.debug("::: evicted " + (evicted map { _.module }).mkString(", "))
|
||||
val x = new OrganizationArtifactReport(organization, name, survivor ++ newlyEvicted)
|
||||
val x = OrganizationArtifactReport(organization, name, survivor ++ newlyEvicted)
|
||||
val nextModules = transitivelyEvict(rootModuleConf, rest, allModules, evicted, log)
|
||||
x :: resolveConflicts(rest, nextModules)
|
||||
})
|
||||
|
|
@ -644,7 +644,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
}
|
||||
val newlyEvicted = affected map { _.withEvicted(true).withEvictedReason(Some("transitive-evict")) }
|
||||
if (affected.isEmpty) oar
|
||||
else new OrganizationArtifactReport(organization, name, unaffected ++ newlyEvicted)
|
||||
else OrganizationArtifactReport(organization, name, unaffected ++ newlyEvicted)
|
||||
}
|
||||
Seq(((organization, name), oars))
|
||||
}
|
||||
|
|
@ -686,6 +686,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
case _ =>
|
||||
val strategy = lcm.getStrategy
|
||||
val infos = conflicts map { ModuleReportArtifactInfo(_) }
|
||||
log.debug(s"- Using $strategy with $infos")
|
||||
Option(strategy.findLatest(infos.toArray, None.orNull)) match {
|
||||
case Some(ModuleReportArtifactInfo(m)) =>
|
||||
(Vector(m), conflicts filterNot { _ == m } map { _.withEvicted(true).withEvictedReason(Some(lcm.toString)) }, lcm.toString)
|
||||
|
|
@ -761,13 +762,14 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
}
|
||||
mergeConfigurationReports(conf0.getName, remappedCRs, os, log)
|
||||
}
|
||||
new UpdateReport(ur.cachedDescriptor, configurations, ur.stats, ur.stamps)
|
||||
UpdateReport(ur.cachedDescriptor, configurations, ur.stats, ur.stamps)
|
||||
}
|
||||
}
|
||||
|
||||
private[sbt] case class ModuleReportArtifactInfo(moduleReport: ModuleReport) extends IvyArtifactInfo {
|
||||
override def getLastModified: Long = moduleReport.publicationDate map { _.getTime } getOrElse 0L
|
||||
override def getLastModified: Long = moduleReport.publicationDate map { _.getTimeInMillis } getOrElse 0L
|
||||
override def getRevision: String = moduleReport.module.revision
|
||||
override def toString: String = s"ModuleReportArtifactInfo(${moduleReport.module}, $getRevision, $getLastModified)"
|
||||
}
|
||||
private[sbt] case class IvyOverride(moduleId: IvyModuleId, pm: PatternMatcher, ddm: OverrideDependencyDescriptorMediator) {
|
||||
override def toString: String = s"""IvyOverride($moduleId,$pm,${ddm.getVersion},${ddm.getBranch})"""
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ abstract class ArtifactFunctions {
|
|||
def apply(name: String, url: URL): Artifact = Artifact(name, extract(url, DefaultType), extract(url, DefaultExtension), None, Vector.empty, Some(url))
|
||||
|
||||
def apply(name: String, `type`: String, extension: String, classifier: Option[String], configurations: Vector[Configuration], url: Option[URL]): Artifact =
|
||||
Artifact(name, `type`, extension, classifier, configurations, url, Map.empty)
|
||||
Artifact(name, `type`, extension, classifier, configurations, url, Map.empty[String, String])
|
||||
|
||||
val DefaultExtension = "jar"
|
||||
val DefaultType = "jar"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
package sbt.librarymanagement
|
||||
|
||||
object Configurations {
|
||||
def config(name: String) = new Configuration(name)
|
||||
def config(name: String) = Configuration(name)
|
||||
def default: Seq[Configuration] = defaultMavenConfigurations
|
||||
def defaultMavenConfigurations: Seq[Configuration] = Seq(Compile, Runtime, Test, Provided, Optional)
|
||||
def defaultInternal: Seq[Configuration] = Seq(CompileInternal, RuntimeInternal, TestInternal)
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ abstract class CrossVersionFunctions {
|
|||
val TransitionSbtVersion = CrossVersionUtil.TransitionSbtVersion
|
||||
|
||||
/** Cross-versions a module with the full version (typically the full Scala version). */
|
||||
def full: CrossVersion = new Full()
|
||||
def full: CrossVersion = Full()
|
||||
|
||||
/** Cross-versions a module with the binary version (typically the binary Scala version). */
|
||||
def binary: CrossVersion = new Binary()
|
||||
def binary: CrossVersion = Binary()
|
||||
|
||||
private[sbt] def append(s: String): Option[String => String] = Some(x => crossName(x, s))
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import org.apache.ivy.core.module.descriptor
|
|||
import org.apache.ivy.util.filter.{ Filter => IvyFilter }
|
||||
|
||||
abstract class InclExclRuleFunctions {
|
||||
def everything = new InclExclRule("*", "*", "*", Vector.empty)
|
||||
def everything = InclExclRule("*", "*", "*", Vector.empty)
|
||||
}
|
||||
|
||||
abstract class ArtifactTypeFilterExtra {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package sbt.librarymanagement
|
|||
import java.net.URL
|
||||
|
||||
import sbt.internal.librarymanagement.mavenint.SbtPomExtraProperties
|
||||
import scala.collection.mutable.ListBuffer
|
||||
|
||||
abstract class ModuleIDExtra {
|
||||
def organization: String
|
||||
|
|
@ -38,6 +39,31 @@ abstract class ModuleIDExtra {
|
|||
branchName: Option[String] = branchName
|
||||
): ModuleID
|
||||
|
||||
protected def toStringImpl: String =
|
||||
s"""$organization:$name:$revision""" +
|
||||
(configurations match { case Some(s) => ":" + s; case None => "" }) +
|
||||
{
|
||||
val attr = attributeString
|
||||
if (attr == "") ""
|
||||
else " " + attr
|
||||
} +
|
||||
(if (extraAttributes.isEmpty) "" else " " + extraString)
|
||||
|
||||
protected def attributeString: String =
|
||||
{
|
||||
val buffer = ListBuffer.empty[String]
|
||||
if (isChanging) {
|
||||
buffer += "changing"
|
||||
}
|
||||
if (!isTransitive) {
|
||||
buffer += "intransitive"
|
||||
}
|
||||
if (isForce) {
|
||||
buffer += "force"
|
||||
}
|
||||
buffer.toList.mkString(";")
|
||||
}
|
||||
|
||||
/** String representation of the extra attributes, excluding any information only attributes. */
|
||||
def extraString: String = extraDependencyAttributes.map { case (k, v) => k + "=" + v } mkString ("(", ", ", ")")
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ final class RawRepository(val resolver: DependencyResolver) extends Resolver(res
|
|||
|
||||
abstract class MavenRepositoryFunctions {
|
||||
def apply(name: String, root: String, localIfFile: Boolean = true): MavenRepository =
|
||||
new MavenRepo(name, root, localIfFile)
|
||||
MavenRepo(name, root, localIfFile)
|
||||
}
|
||||
|
||||
abstract class PatternsFunctions {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ abstract class ConfigurationReportExtra {
|
|||
}
|
||||
|
||||
def retrieve(f: (String, ModuleID, Artifact, File) => File): ConfigurationReport =
|
||||
new ConfigurationReport(configuration, modules map { _.retrieve((mid, art, file) => f(configuration, mid, art, file)) }, details)
|
||||
ConfigurationReport(configuration, modules map { _.retrieve((mid, art, file) => f(configuration, mid, art, file)) }, details)
|
||||
}
|
||||
|
||||
abstract class ModuleReportExtra {
|
||||
|
|
@ -37,7 +37,7 @@ abstract class ModuleReportExtra {
|
|||
def artifacts: Vector[(Artifact, File)]
|
||||
def missingArtifacts: Vector[Artifact]
|
||||
def status: Option[String]
|
||||
def publicationDate: Option[ju.Date]
|
||||
def publicationDate: Option[ju.Calendar]
|
||||
def resolver: Option[String]
|
||||
def artifactResolver: Option[String]
|
||||
def evicted: Boolean
|
||||
|
|
@ -99,7 +99,7 @@ abstract class ModuleReportExtra {
|
|||
artifacts: Vector[(Artifact, File)] = artifacts,
|
||||
missingArtifacts: Vector[Artifact] = missingArtifacts,
|
||||
status: Option[String] = status,
|
||||
publicationDate: Option[ju.Date] = publicationDate,
|
||||
publicationDate: Option[ju.Calendar] = publicationDate,
|
||||
resolver: Option[String] = resolver,
|
||||
artifactResolver: Option[String] = artifactResolver,
|
||||
evicted: Boolean = evicted,
|
||||
|
|
@ -141,7 +141,7 @@ abstract class UpdateReportExtra {
|
|||
}
|
||||
|
||||
def retrieve(f: (String, ModuleID, Artifact, File) => File): UpdateReport =
|
||||
new UpdateReport(cachedDescriptor, configurations map { _ retrieve f }, stats, stamps)
|
||||
UpdateReport(cachedDescriptor, configurations map { _ retrieve f }, stats, stamps)
|
||||
|
||||
/** Gets the report for the given configuration, or `None` if the configuration was not resolved.*/
|
||||
def configuration(s: String) = configurations.find(_.configuration == s)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ trait BaseIvySpecification extends UnitSpec {
|
|||
def module(moduleId: ModuleID, deps: Vector[ModuleID], scalaFullVersion: Option[String],
|
||||
uo: UpdateOptions = UpdateOptions(), overrideScalaVersion: Boolean = true): IvySbt#Module = {
|
||||
val ivyScala = scalaFullVersion map { fv =>
|
||||
new IvyScala(
|
||||
IvyScala(
|
||||
scalaFullVersion = fv,
|
||||
scalaBinaryVersion = CrossVersionUtil.binaryScalaVersion(fv),
|
||||
configurations = Vector.empty,
|
||||
|
|
@ -56,7 +56,7 @@ trait BaseIvySpecification extends UnitSpec {
|
|||
def chainResolver = ChainedResolver("sbt-chain", resolvers)
|
||||
|
||||
def mkIvyConfiguration(uo: UpdateOptions): IvyConfiguration = {
|
||||
val paths = new IvyPaths(currentBase, Some(currentTarget))
|
||||
val paths = IvyPaths(currentBase, Some(currentTarget))
|
||||
val other = Vector.empty
|
||||
val moduleConfs = Vector(ModuleConfiguration("*", chainResolver))
|
||||
val off = false
|
||||
|
|
@ -66,8 +66,8 @@ trait BaseIvySpecification extends UnitSpec {
|
|||
}
|
||||
|
||||
def makeUpdateConfiguration: UpdateConfiguration = {
|
||||
val retrieveConfig = new RetrieveConfiguration(currentManaged, Resolver.defaultRetrievePattern).withSync(false)
|
||||
new UpdateConfiguration(Some(retrieveConfig), false, UpdateLogging.Full, ArtifactTypeFilter.forbid(Set("src", "doc")))
|
||||
val retrieveConfig = RetrieveConfiguration(currentManaged, Resolver.defaultRetrievePattern).withSync(false)
|
||||
UpdateConfiguration(Some(retrieveConfig), false, UpdateLogging.Full, ArtifactTypeFilter.forbid(Set("src", "doc")))
|
||||
}
|
||||
|
||||
def ivyUpdateEither(module: IvySbt#Module): Either[UnresolvedWarning, UpdateReport] = {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class CustomPomParserTest extends UnitSpec {
|
|||
withTemporaryDirectory { cacheDir =>
|
||||
val repoUrl = getClass.getResource("/test-maven-repo")
|
||||
val local = MavenRepository("Test Repo", repoUrl.toExternalForm)
|
||||
val paths = new IvyPaths(new File("."), Some(cacheDir))
|
||||
val paths = IvyPaths(new File("."), Some(cacheDir))
|
||||
val conf = new InlineIvyConfiguration(paths, Vector(local), Vector.empty, Vector.empty, false, None, Vector("sha1", "md5"), None, UpdateOptions(), log)
|
||||
val ivySbt = new IvySbt(conf, DefaultFileToStore)
|
||||
val resolveOpts = new ResolveOptions().setConfs(Array("default"))
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ class DMSerializationSpec extends UnitSpec {
|
|||
}
|
||||
|
||||
lazy val updateReportExample =
|
||||
new UpdateReport(new File("./foo"), Vector(configurationReportExample),
|
||||
new UpdateStats(0, 0, 0, false), Map(new File("./foo") -> 0))
|
||||
UpdateReport(new File("./foo"), Vector(configurationReportExample),
|
||||
UpdateStats(0, 0, 0, false), Map(new File("./foo") -> 0))
|
||||
lazy val configurationReportExample =
|
||||
new ConfigurationReport("compile", Vector(moduleReportExample),
|
||||
ConfigurationReport("compile", Vector(moduleReportExample),
|
||||
Vector(organizationArtifactReportExample))
|
||||
lazy val organizationArtifactReportExample =
|
||||
new OrganizationArtifactReport("org", "name", Vector(moduleReportExample))
|
||||
OrganizationArtifactReport("org", "name", Vector(moduleReportExample))
|
||||
lazy val moduleReportExample =
|
||||
ModuleReport(ModuleID("org", "name", "1.0"), Vector.empty, Vector.empty)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +1,24 @@
|
|||
import sbt.datatype.{ CodecCodeGen, TpeRef }
|
||||
import sbt.contraband.ast._
|
||||
import sbt.contraband.CodecCodeGen
|
||||
|
||||
object DatatypeConfig {
|
||||
|
||||
/** Extract the only type parameter from a TpeRef */
|
||||
def oneArg(tpe: TpeRef): TpeRef = {
|
||||
val pat = s"""${CodecCodeGen.removeTypeParameters(tpe.name)}[<\\[](.+?)[>\\]]""".r
|
||||
def oneArg(tpe: Type): Type = {
|
||||
val pat = s"""${tpe.removeTypeParameters.name}[<\\[](.+?)[>\\]]""".r
|
||||
val pat(arg0) = tpe.name
|
||||
TpeRef(arg0, false, false, false)
|
||||
NamedType(arg0 split '.' toList)
|
||||
}
|
||||
|
||||
/** Extract the two type parameters from a TpeRef */
|
||||
def twoArgs(tpe: TpeRef): List[TpeRef] = {
|
||||
val pat = s"""${CodecCodeGen.removeTypeParameters(tpe.name)}[<\\[](.+?), (.+?)[>\\]]""".r
|
||||
def twoArgs(tpe: Type): List[Type] = {
|
||||
val pat = s"""${tpe.removeTypeParameters.name}[<\\[](.+?), (.+?)[>\\]]""".r
|
||||
val pat(arg0, arg1) = tpe.name
|
||||
TpeRef(arg0, false, false, false) :: TpeRef(arg1, false, false, false) :: Nil
|
||||
NamedType(arg0 split '.' toList) :: NamedType(arg1 split '.' toList) :: Nil
|
||||
}
|
||||
|
||||
/** Codecs that were manually written. */
|
||||
val myCodecs: PartialFunction[String, TpeRef => List[String]] = {
|
||||
case "java.util.Date" => { _ => "sbt.internal.librarymanagement.formats.DateFormat" :: Nil }
|
||||
|
||||
val myCodecs: PartialFunction[String, Type => List[String]] = {
|
||||
case "scala.xml.NodeSeq" => { _ => "sbt.internal.librarymanagement.formats.NodeSeqFormat" :: Nil }
|
||||
|
||||
case "org.apache.ivy.plugins.resolver.DependencyResolver" =>
|
||||
|
|
@ -32,7 +31,7 @@ object DatatypeConfig {
|
|||
{ _ => "sbt.internal.librarymanagement.formats.UpdateOptionsFormat" :: Nil }
|
||||
|
||||
// TODO: These are handled by BasicJsonProtocol, and sbt-datatype should handle them by default, imo
|
||||
case "Option" | "Set" => { tpe => getFormats(oneArg(tpe)) }
|
||||
case "Option" | "Set" | "scala.Vector" => { tpe => getFormats(oneArg(tpe)) }
|
||||
case "Map" | "Tuple2" | "scala.Tuple2" => { tpe => twoArgs(tpe).flatMap(getFormats) }
|
||||
case "Int" | "Long" => { _ => Nil }
|
||||
}
|
||||
|
|
@ -43,13 +42,13 @@ object DatatypeConfig {
|
|||
"sbt.librarymanagement.ExclusionRule")
|
||||
|
||||
/** Returns the list of formats required to encode the given `TpeRef`. */
|
||||
val getFormats: TpeRef => List[String] =
|
||||
val getFormats: Type => List[String] =
|
||||
CodecCodeGen.extensibleFormatsForType {
|
||||
case TpeRef("sbt.internal.librarymanagement.RetrieveConfiguration", false, false, false) =>
|
||||
case NamedType(List("sbt", "internal", "librarymanagement", "RetrieveConfiguration"), _) =>
|
||||
"sbt.librarymanagement.RetrieveConfigurationFormats" :: Nil
|
||||
case tpe @ TpeRef(name, _, _, _) if myCodecs isDefinedAt CodecCodeGen.removeTypeParameters(name) =>
|
||||
myCodecs(CodecCodeGen.removeTypeParameters(name))(tpe)
|
||||
case TpeRef(name, _, _, _) if excluded contains CodecCodeGen.removeTypeParameters(name) =>
|
||||
case tpe: Type if myCodecs isDefinedAt tpe.removeTypeParameters.name =>
|
||||
myCodecs(tpe.removeTypeParameters.name)(tpe)
|
||||
case tpe: Type if excluded contains tpe.removeTypeParameters.name =>
|
||||
Nil
|
||||
case other =>
|
||||
CodecCodeGen.formatsForType(other)
|
||||
|
|
|
|||
|
|
@ -2,18 +2,18 @@ import sbt._
|
|||
import Keys._
|
||||
|
||||
object Dependencies {
|
||||
lazy val scala211 = "2.11.8"
|
||||
val scala211 = "2.11.8"
|
||||
|
||||
val ioVersion = "1.0.0-M6"
|
||||
val utilVersion = "0.1.0-M15"
|
||||
private val ioVersion = "1.0.0-M9"
|
||||
private val utilVersion = "1.0.0-M17"
|
||||
|
||||
private lazy val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||
|
||||
private lazy val utilCollection = "org.scala-sbt" %% "util-collection" % utilVersion
|
||||
private lazy val utilLogging = "org.scala-sbt" %% "util-logging" % utilVersion
|
||||
private lazy val utilTesting = "org.scala-sbt" %% "util-testing" % utilVersion
|
||||
private lazy val utilCompletion = "org.scala-sbt" %% "util-completion" % utilVersion
|
||||
private lazy val utilCache = "org.scala-sbt" %% "util-cache" % utilVersion
|
||||
private val utilCollection = "org.scala-sbt" %% "util-collection" % utilVersion
|
||||
private val utilLogging = "org.scala-sbt" %% "util-logging" % utilVersion
|
||||
private val utilTesting = "org.scala-sbt" %% "util-testing" % utilVersion
|
||||
private val utilCompletion = "org.scala-sbt" %% "util-completion" % utilVersion
|
||||
private val utilCache = "org.scala-sbt" %% "util-cache" % utilVersion
|
||||
|
||||
def getSbtModulePath(key: String, name: String) = {
|
||||
val localProps = new java.util.Properties()
|
||||
|
|
@ -32,7 +32,7 @@ object Dependencies {
|
|||
case None => p settings (libraryDependencies += c.fold(m)(m % _))
|
||||
}
|
||||
|
||||
def addSbtIO(p: Project): Project = addSbtModule(p, sbtIoPath, "io", sbtIO)
|
||||
def addSbtIO(p: Project): Project = addSbtModule(p, sbtIoPath, "io", sbtIO)
|
||||
|
||||
def addSbtUtilCollection(p: Project): Project = addSbtModule(p, sbtUtilPath, "utilCollection", utilCollection)
|
||||
def addSbtUtilLogging(p: Project): Project = addSbtModule(p, sbtUtilPath, "utilLogging", utilLogging)
|
||||
|
|
@ -40,13 +40,13 @@ object Dependencies {
|
|||
def addSbtUtilCompletion(p: Project): Project = addSbtModule(p, sbtUtilPath, "utilComplete", utilCompletion)
|
||||
def addSbtUtilCache(p: Project): Project = addSbtModule(p, sbtUtilPath, "utilCache", utilCache)
|
||||
|
||||
lazy val launcherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0"
|
||||
lazy val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-2cc8d2761242b072cedb0a04cb39435c4fa24f9a"
|
||||
lazy val jsch = "com.jcraft" % "jsch" % "0.1.46" intransitive ()
|
||||
lazy val scalaReflect = Def.setting { "org.scala-lang" % "scala-reflect" % scalaVersion.value }
|
||||
lazy val scalaXml = scala211Module("scala-xml", "1.0.5")
|
||||
lazy val sjsonnewVersion = "0.4.1"
|
||||
lazy val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion
|
||||
val launcherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0"
|
||||
val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-2cc8d2761242b072cedb0a04cb39435c4fa24f9a"
|
||||
val jsch = "com.jcraft" % "jsch" % "0.1.46" intransitive ()
|
||||
val scalaReflect = Def.setting { "org.scala-lang" % "scala-reflect" % scalaVersion.value }
|
||||
val scalaXml = scala211Module("scala-xml", "1.0.5")
|
||||
val sjsonnewVersion = "0.7.0"
|
||||
val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion
|
||||
|
||||
private def scala211Module(name: String, moduleVersion: String) =
|
||||
Def.setting {
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M3")
|
||||
|
|
@ -1 +0,0 @@
|
|||
addSbtPlugin("org.scala-sbt" % "sbt-datatype" % "0.2.8")
|
||||
Loading…
Reference in New Issue