diff options
-rw-r--r-- | src/libstore/buildable.cc | 3 | ||||
-rw-r--r-- | src/libstore/buildable.hh | 30 |
2 files changed, 17 insertions, 16 deletions
diff --git a/src/libstore/buildable.cc b/src/libstore/buildable.cc index 63ca1779e..7892b94e4 100644 --- a/src/libstore/buildable.cc +++ b/src/libstore/buildable.cc @@ -11,7 +11,6 @@ nlohmann::json BuildableOpaque::toJSON(ref<Store> store) const { return res; } -template<> nlohmann::json BuildableFromDrv::toJSON(ref<Store> store) const { nlohmann::json res; res["drvPath"] = store->printStorePath(drvPath); @@ -36,7 +35,6 @@ std::string BuildableOpaque::to_string(const Store & store) const { return store.printStorePath(path); } -template<> std::string BuildableReqFromDrv::to_string(const Store & store) const { return store.printStorePath(drvPath) + "!" @@ -56,7 +54,6 @@ BuildableOpaque BuildableOpaque::parse(const Store & store, std::string_view s) return {store.parseStorePath(s)}; } -template<> BuildableReqFromDrv BuildableReqFromDrv::parse(const Store & store, std::string_view s) { size_t n = s.find("!"); diff --git a/src/libstore/buildable.hh b/src/libstore/buildable.hh index db78316bd..54e627271 100644 --- a/src/libstore/buildable.hh +++ b/src/libstore/buildable.hh @@ -20,31 +20,35 @@ struct BuildableOpaque { static BuildableOpaque parse(const Store & store, std::string_view); }; -template<typename Outputs> -struct BuildableForFromDrv { +struct BuildableReqFromDrv { StorePath drvPath; - Outputs outputs; + std::set<std::string> outputs; - nlohmann::json toJSON(ref<Store> store) const; std::string to_string(const Store & store) const; - static BuildableForFromDrv<Outputs> parse(const Store & store, std::string_view); + static BuildableReqFromDrv parse(const Store & store, std::string_view); }; -template <typename Outputs> -using BuildableFor = std::variant< +using BuildableReq = std::variant< BuildableOpaque, - BuildableForFromDrv<Outputs> + BuildableReqFromDrv >; -typedef BuildableForFromDrv<std::set<std::string>> BuildableReqFromDrv; -typedef BuildableFor<std::set<std::string>> BuildableReq; - std::string to_string(const Store & store, const BuildableReq &); BuildableReq parseBuildableReq(const Store & store, std::string_view); -typedef BuildableForFromDrv<std::map<std::string, std::optional<StorePath>>> BuildableFromDrv; -typedef BuildableFor<std::map<std::string, std::optional<StorePath>>> Buildable; +struct BuildableFromDrv { + StorePath drvPath; + std::map<std::string, std::optional<StorePath>> outputs; + + nlohmann::json toJSON(ref<Store> store) const; + static BuildableFromDrv parse(const Store & store, std::string_view); +}; + +using Buildable = std::variant< + BuildableOpaque, + BuildableFromDrv +>; typedef std::vector<Buildable> Buildables; |