exportReferencesGraph: Only export in JSON format when in structured mode

This prevents breaking compatibility with builders that read
"closure.*", since they would accidentally pick up the new JSON files.
This commit is contained in:
Eelco Dolstra 2017-02-02 12:20:28 +01:00
parent 7a65b2470e
commit 1351b0df87
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -2276,18 +2276,24 @@ void DerivationGoal::doExportReferencesGraph()
} }
} }
/* Write closure info to <fileName>. */ if (!drv->env.count("__json")) {
writeFile(tmpDir + "/" + fileName,
worker.store.makeValidityRegistration(paths, false, false)); /* Write closure info to <fileName>. */
writeFile(tmpDir + "/" + fileName,
worker.store.makeValidityRegistration(paths, false, false));
} else {
/* Write a more comprehensive JSON serialisation to
<fileName>. */
std::ostringstream str;
{
JSONPlaceholder jsonRoot(str, true);
worker.store.pathInfoToJSON(jsonRoot, paths, false, true);
}
writeFile(tmpDir + "/" + fileName, str.str());
/* Write a more comprehensive JSON serialisation to
<fileName>.json. */
std::ostringstream str;
{
JSONPlaceholder jsonRoot(str, true);
worker.store.pathInfoToJSON(jsonRoot, paths, false, true);
} }
writeFile(tmpDir + "/" + fileName + ".json", str.str());
} }
} }