about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-02-02T11·20+0100
committerEelco Dolstra <edolstra@gmail.com>2017-02-02T11·20+0100
commit1351b0df87a0984914769c5dc76489618b3a3fec (patch)
tree69ecfd62a1c5ff04000e08335e7707eb673e53da /src/libstore/build.cc
parent7a65b2470eb53a320749d76746fbf65790183d9d (diff)
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.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 40927c063267..5d6fff4e349f 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2276,18 +2276,24 @@ void DerivationGoal::doExportReferencesGraph()
             }
         }
 
-        /* Write closure info to <fileName>. */
-        writeFile(tmpDir + "/" + fileName,
-            worker.store.makeValidityRegistration(paths, false, false));
+        if (!drv->env.count("__json")) {
+
+            /* 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());
     }
 }