mirror of https://github.com/sbt/sbt.git
Change publicationDate to java.util.Calendar
This migrates to java.util.Calendar, which is better than java.util.Date and is supported by sjson-new out of the box.
This commit is contained in:
parent
71fddd5e3f
commit
4ca5b5ae0a
|
|
@ -296,7 +296,7 @@
|
|||
{ "name": "artifacts", "type": "scala.Tuple2[sbt.librarymanagement.Artifact, java.io.File]*" },
|
||||
{ "name": "missingArtifacts", "type": "sbt.librarymanagement.Artifact*" },
|
||||
{ "name": "status", "type": "Option[String]", "default": "None", "since": "0.0.1" },
|
||||
{ "name": "publicationDate", "type": "Option[java.util.Date]", "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" },
|
||||
|
|
|
|||
|
|
@ -92,9 +92,11 @@ object IvyRetrieve {
|
|||
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)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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 _)
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
|
@ -766,8 +767,9 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
|
|||
}
|
||||
|
||||
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})"""
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ object DatatypeConfig {
|
|||
|
||||
/** Codecs that were manually written. */
|
||||
val myCodecs: PartialFunction[String, Type => List[String]] = {
|
||||
case "java.util.Date" => { _ => "sbt.internal.librarymanagement.formats.DateFormat" :: Nil }
|
||||
|
||||
case "scala.xml.NodeSeq" => { _ => "sbt.internal.librarymanagement.formats.NodeSeqFormat" :: Nil }
|
||||
|
||||
case "org.apache.ivy.plugins.resolver.DependencyResolver" =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue