From 2805dbde8f5354d50c9b83a6b54053cc234e351e Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Sun, 30 Oct 2011 18:38:37 -0400 Subject: [PATCH] track whether UpdateReport was cached or freshly generated --- ivy/IvyRetrieve.scala | 2 +- ivy/UpdateReport.scala | 5 +++-- main/actions/CacheIvy.scala | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ivy/IvyRetrieve.scala b/ivy/IvyRetrieve.scala index 7c96c63ff..cd619afaf 100644 --- a/ivy/IvyRetrieve.scala +++ b/ivy/IvyRetrieve.scala @@ -50,7 +50,7 @@ object IvyRetrieve def updateReport(report: ResolveReport, cachedDescriptor: File): UpdateReport = new UpdateReport(cachedDescriptor, reports(report) map configurationReport, updateStats(report)) def updateStats(report: ResolveReport): UpdateStats = - new UpdateStats(report.getResolveTime, report.getDownloadTime, report.getDownloadSize) + new UpdateStats(report.getResolveTime, report.getDownloadTime, report.getDownloadSize, false) def configurationReport(confReport: ConfigurationResolveReport): ConfigurationReport = new ConfigurationReport(confReport.getConfiguration, moduleReports(confReport), evicted(confReport)) } diff --git a/ivy/UpdateReport.scala b/ivy/UpdateReport.scala index 241ecded5..6f8485c9d 100644 --- a/ivy/UpdateReport.scala +++ b/ivy/UpdateReport.scala @@ -10,8 +10,9 @@ package sbt * This means that for a given configuration, there should only be one revision for a given organization and module name. * @param cachedDescriptor the location of the resolved module descriptor in the cache * @param configurations a sequence containing one report for each configuration resolved. +* @param stats information about the update that produced this report * @see sbt.RichUpdateReport - */ +*/ final class UpdateReport(val cachedDescriptor: File, val configurations: Seq[ConfigurationReport], val stats: UpdateStats) { override def toString = "Update report:\n\t" + stats + "\n" + configurations.mkString @@ -126,7 +127,7 @@ object UpdateReport } } } -final class UpdateStats(val resolveTime: Long, val downloadTime: Long, val downloadSize: Long) +final class UpdateStats(val resolveTime: Long, val downloadTime: Long, val downloadSize: Long, val cached: Boolean) { override def toString = Seq("Resolve time: " + resolveTime + " ms", "Download time: " + downloadTime + " ms", "Download size: " + downloadSize + " bytes").mkString(", ") } \ No newline at end of file diff --git a/main/actions/CacheIvy.scala b/main/actions/CacheIvy.scala index 2d89b3137..528bd7e1b 100644 --- a/main/actions/CacheIvy.scala +++ b/main/actions/CacheIvy.scala @@ -68,7 +68,7 @@ object CacheIvy wrap[UpdateReport, (File, Seq[ConfigurationReport], UpdateStats)](rep => (rep.cachedDescriptor, rep.configurations, rep.stats), { case (cd, cs, stats) => new UpdateReport(cd, cs, stats) }) } implicit def updateStatsFormat: Format[UpdateStats] = - wrap[UpdateStats, (Long,Long,Long)]( us => (us.resolveTime, us.downloadTime, us.downloadSize), { case (rt, dt, ds) => new UpdateStats(rt, dt, ds) }) + wrap[UpdateStats, (Long,Long,Long)]( us => (us.resolveTime, us.downloadTime, us.downloadSize), { case (rt, dt, ds) => new UpdateStats(rt, dt, ds, true) }) implicit def confReportFormat(implicit mf: Format[ModuleID], mr: Format[ModuleReport]): Format[ConfigurationReport] = wrap[ConfigurationReport, (String,Seq[ModuleReport],Seq[ModuleID])]( r => (r.configuration, r.modules, r.evicted), { case (c,m,v) => new ConfigurationReport(c,m,v) }) implicit def moduleReportFormat(implicit f: Format[Artifact], ff: Format[File], mid: Format[ModuleID]): Format[ModuleReport] =