diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-04-05 09:15:25 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-04-05 09:15:25 -0400 |
commit | 4fe41c6db390c0295d20f6365ebedaec8ec79e1d (patch) | |
tree | 115da2259ecbcf3d8fdc97f15ba8b74185467ebc /src | |
parent | 255d145ba7ac907d1cba8d088da556b591627756 (diff) |
No templates for `Buildable` and `BuildableReq`
Diffstat (limited to 'src')
-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; |