mirror of https://github.com/sbt/sbt.git
Write JSON to file without String. #1763
This commit is contained in:
parent
936c804c41
commit
8a0e8ef74e
|
|
@ -10,8 +10,7 @@ private[sbt] object JsonUtil {
|
||||||
def parseUpdateReport(md: ModuleDescriptor, path: File, cachedDescriptor: File, log: Logger): UpdateReport =
|
def parseUpdateReport(md: ModuleDescriptor, path: File, cachedDescriptor: File, log: Logger): UpdateReport =
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
val s = IO.read(path, IO.utf8)
|
val lite = fromJsonFile[UpdateReportLite](path).get
|
||||||
val lite = fromJsonString[UpdateReportLite](s).get
|
|
||||||
fromLite(lite, cachedDescriptor)
|
fromLite(lite, cachedDescriptor)
|
||||||
} catch {
|
} catch {
|
||||||
case e: Throwable =>
|
case e: Throwable =>
|
||||||
|
|
@ -21,8 +20,8 @@ private[sbt] object JsonUtil {
|
||||||
}
|
}
|
||||||
def writeUpdateReport(ur: UpdateReport, graphPath: File): Unit =
|
def writeUpdateReport(ur: UpdateReport, graphPath: File): Unit =
|
||||||
{
|
{
|
||||||
val str = toJsonString(toLite(ur))
|
IO.createDirectory(graphPath.getParentFile)
|
||||||
IO.write(graphPath, str, IO.utf8)
|
toJsonFile(toLite(ur), graphPath)
|
||||||
}
|
}
|
||||||
def toLite(ur: UpdateReport): UpdateReportLite =
|
def toLite(ur: UpdateReport): UpdateReportLite =
|
||||||
UpdateReportLite(ur.configurations map { cr =>
|
UpdateReportLite(ur.configurations map { cr =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue