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)
This commit is contained in:
Eugene Yokota 2015-05-21 23:04:52 -04:00
parent ed0423ee59
commit e430139680
2 changed files with 28 additions and 2 deletions

View File

@ -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)

View File

@ -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() {