diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-11-22 14:41:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 14:41:15 +0100 |
commit | 05d0892443bbe92a6b6a1ee7b1d37ea05782d918 (patch) | |
tree | 8be26422991a1c2bbd2237fa7dffbd8981825718 /src/libstore | |
parent | 96a9511a9c424f0986d6c01bef63afff672fa986 (diff) | |
parent | f0baa5c1283359a413ca3a254527587c86b2f097 (diff) |
Merge pull request #7328 from edolstra/nix-build-stats
nix build --json: Include build statistics
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/derived-path.cc | 23 | ||||
-rw-r--r-- | src/libstore/derived-path.hh | 3 |
2 files changed, 4 insertions, 22 deletions
diff --git a/src/libstore/derived-path.cc b/src/libstore/derived-path.cc index 44587ae78..88b59f615 100644 --- a/src/libstore/derived-path.cc +++ b/src/libstore/derived-path.cc @@ -53,28 +53,13 @@ StorePathSet BuiltPath::outPaths() const ); } -template<typename T> -nlohmann::json stuffToJSON(const std::vector<T> & ts, ref<Store> store) { - auto res = nlohmann::json::array(); - for (const T & t : ts) { - std::visit([&res, store](const auto & t) { - res.push_back(t.toJSON(store)); - }, t.raw()); - } - return res; -} - -nlohmann::json derivedPathsWithHintsToJSON(const BuiltPaths & buildables, ref<Store> store) -{ return stuffToJSON<BuiltPath>(buildables, store); } -nlohmann::json derivedPathsToJSON(const DerivedPaths & paths, ref<Store> store) -{ return stuffToJSON<DerivedPath>(paths, store); } - - -std::string DerivedPath::Opaque::to_string(const Store & store) const { +std::string DerivedPath::Opaque::to_string(const Store & store) const +{ return store.printStorePath(path); } -std::string DerivedPath::Built::to_string(const Store & store) const { +std::string DerivedPath::Built::to_string(const Store & store) const +{ return store.printStorePath(drvPath) + "!" + (outputs.empty() ? std::string { "*" } : concatStringsSep(",", outputs)); diff --git a/src/libstore/derived-path.hh b/src/libstore/derived-path.hh index 24a0ae773..878696136 100644 --- a/src/libstore/derived-path.hh +++ b/src/libstore/derived-path.hh @@ -125,7 +125,4 @@ struct BuiltPath : _BuiltPathRaw { typedef std::vector<DerivedPath> DerivedPaths; typedef std::vector<BuiltPath> BuiltPaths; -nlohmann::json derivedPathsWithHintsToJSON(const BuiltPaths & buildables, ref<Store> store); -nlohmann::json derivedPathsToJSON(const DerivedPaths & , ref<Store> store); - } |