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()
} }
} }
if (!drv->env.count("__json")) {
/* Write closure info to <fileName>. */ /* Write closure info to <fileName>. */
writeFile(tmpDir + "/" + fileName, writeFile(tmpDir + "/" + fileName,
worker.store.makeValidityRegistration(paths, false, false)); worker.store.makeValidityRegistration(paths, false, false));
} else {
/* Write a more comprehensive JSON serialisation to /* Write a more comprehensive JSON serialisation to
<fileName>.json. */ <fileName>. */
std::ostringstream str; std::ostringstream str;
{ {
JSONPlaceholder jsonRoot(str, true); JSONPlaceholder jsonRoot(str, true);
worker.store.pathInfoToJSON(jsonRoot, paths, false, true); worker.store.pathInfoToJSON(jsonRoot, paths, false, true);
} }
writeFile(tmpDir + "/" + fileName + ".json", str.str()); writeFile(tmpDir + "/" + fileName, str.str());
}
} }
} }