1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Synchronize the writes to buildInfo.json.

This commit is contained in:
Cedric Beust 2016-08-03 08:46:16 -08:00
parent ca03c3612c
commit 26e647e9bd

View file

@ -55,7 +55,10 @@ class IncrementalManager @Inject constructor(val args: Args, @Assisted val fileN
private fun save(map: Map<String, TaskInfo>) {
val bi = BuildInfo(map.values.toList())
val json = GsonBuilder().setPrettyPrinting().create().toJson(bi)
Files.write(Paths.get(fileName), json.toByteArray(Charset.defaultCharset()))
synchronized(BUILD_INFO_FILE) {
Files.write(Paths.get(fileName), json.toByteArray(Charset.defaultCharset()))
}
}
private fun taskInfoFor(taskInfos: HashMap<String, TaskInfo>, taskName: String)