forked from lix-project/lix
No templates for Buildable
and BuildableReq
This commit is contained in:
parent
255d145ba7
commit
4fe41c6db3
|
@ -11,7 +11,6 @@ nlohmann::json BuildableOpaque::toJSON(ref<Store> store) const {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
nlohmann::json BuildableFromDrv::toJSON(ref<Store> store) const {
|
nlohmann::json BuildableFromDrv::toJSON(ref<Store> store) const {
|
||||||
nlohmann::json res;
|
nlohmann::json res;
|
||||||
res["drvPath"] = store->printStorePath(drvPath);
|
res["drvPath"] = store->printStorePath(drvPath);
|
||||||
|
@ -36,7 +35,6 @@ std::string BuildableOpaque::to_string(const Store & store) const {
|
||||||
return store.printStorePath(path);
|
return store.printStorePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
std::string BuildableReqFromDrv::to_string(const Store & store) const {
|
std::string BuildableReqFromDrv::to_string(const Store & store) const {
|
||||||
return store.printStorePath(drvPath)
|
return store.printStorePath(drvPath)
|
||||||
+ "!"
|
+ "!"
|
||||||
|
@ -56,7 +54,6 @@ BuildableOpaque BuildableOpaque::parse(const Store & store, std::string_view s)
|
||||||
return {store.parseStorePath(s)};
|
return {store.parseStorePath(s)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
BuildableReqFromDrv BuildableReqFromDrv::parse(const Store & store, std::string_view s)
|
BuildableReqFromDrv BuildableReqFromDrv::parse(const Store & store, std::string_view s)
|
||||||
{
|
{
|
||||||
size_t n = s.find("!");
|
size_t n = s.find("!");
|
||||||
|
|
|
@ -20,31 +20,35 @@ struct BuildableOpaque {
|
||||||
static BuildableOpaque parse(const Store & store, std::string_view);
|
static BuildableOpaque parse(const Store & store, std::string_view);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Outputs>
|
struct BuildableReqFromDrv {
|
||||||
struct BuildableForFromDrv {
|
|
||||||
StorePath drvPath;
|
StorePath drvPath;
|
||||||
Outputs outputs;
|
std::set<std::string> outputs;
|
||||||
|
|
||||||
nlohmann::json toJSON(ref<Store> store) const;
|
|
||||||
std::string to_string(const 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 BuildableReq = std::variant<
|
||||||
using BuildableFor = std::variant<
|
|
||||||
BuildableOpaque,
|
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 &);
|
std::string to_string(const Store & store, const BuildableReq &);
|
||||||
|
|
||||||
BuildableReq parseBuildableReq(const Store & store, std::string_view);
|
BuildableReq parseBuildableReq(const Store & store, std::string_view);
|
||||||
|
|
||||||
typedef BuildableForFromDrv<std::map<std::string, std::optional<StorePath>>> BuildableFromDrv;
|
struct BuildableFromDrv {
|
||||||
typedef BuildableFor<std::map<std::string, std::optional<StorePath>>> Buildable;
|
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;
|
typedef std::vector<Buildable> Buildables;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue