From e430139680d6b91bf00ec3e15d4dea55c0a87fad Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 21 May 2015 23:04:52 -0400 Subject: [PATCH] Fixes #1721/#1763. Cached resolution: summarize callers in graph.json - On some of the builds graph.json is reaching 250MB+ - JSON parsing alone takes hours - 97% of the content are caller info - This change summarizes all callers into one (zero caller would have correctness issues) --- ivy/src/main/scala/sbt/JsonUtil.scala | 28 ++++++++++++++++++- .../CachedResolutionResolveEngine.scala | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ivy/src/main/scala/sbt/JsonUtil.scala b/ivy/src/main/scala/sbt/JsonUtil.scala index 88d7e1e90..156c9aa44 100644 --- a/ivy/src/main/scala/sbt/JsonUtil.scala +++ b/ivy/src/main/scala/sbt/JsonUtil.scala @@ -25,8 +25,34 @@ private[sbt] object JsonUtil { } def toLite(ur: UpdateReport): UpdateReportLite = UpdateReportLite(ur.configurations map { cr => - ConfigurationReportLite(cr.configuration, cr.details) + ConfigurationReportLite(cr.configuration, cr.details map { oar => + new OrganizationArtifactReport(oar.organization, oar.name, oar.modules map { mr => + new ModuleReport( + mr.module, mr.artifacts, mr.missingArtifacts, mr.status, + mr.publicationDate, mr.resolver, mr.artifactResolver, + mr.evicted, mr.evictedData, mr.evictedReason, + mr.problem, mr.homepage, mr.extraAttributes, + mr.isDefault, mr.branch, mr.configurations, mr.licenses, + summarizeCallers(mr.callers)) + }) + }) }) + // #1763/#2030. Caller takes up 97% of space, so we need to shrink it down, + // but there are semantics associated with some of them. + def summarizeCallers(callers: Seq[Caller]): Seq[Caller] = + if (callers.isEmpty) callers + else { + // Use the first element to represent all callers + val head = callers.head + val caller = new Caller( + head.caller, head.callerConfigurations, head.callerExtraAttributes, + callers exists { _.isForceDependency }, + callers exists { _.isChangingDependency }, + callers exists { _.isTransitiveDependency }, + callers exists { _.isDirectlyForceDependency }) + Seq(caller) + } + def fromLite(lite: UpdateReportLite, cachedDescriptor: File): UpdateReport = { val stats = new UpdateStats(0L, 0L, 0L, false) diff --git a/ivy/src/main/scala/sbt/ivyint/CachedResolutionResolveEngine.scala b/ivy/src/main/scala/sbt/ivyint/CachedResolutionResolveEngine.scala index 14d7af22a..5b0418abf 100644 --- a/ivy/src/main/scala/sbt/ivyint/CachedResolutionResolveEngine.scala +++ b/ivy/src/main/scala/sbt/ivyint/CachedResolutionResolveEngine.scala @@ -25,7 +25,7 @@ private[sbt] object CachedResolutionResolveCache { def createID(organization: String, name: String, revision: String) = ModuleRevisionId.newInstance(organization, name, revision) def sbtOrgTemp = "org.scala-sbt.temp" - def graphVersion = "0.13.8" + def graphVersion = "0.13.9" } private[sbt] class CachedResolutionResolveCache() {