diff --git a/lix/libcmd/built-path.cc b/lix/libcmd/built-path.cc index 77f4f98a1..0c4d481b7 100644 --- a/lix/libcmd/built-path.cc +++ b/lix/libcmd/built-path.cc @@ -23,10 +23,6 @@ namespace nix { CMP_ONE(CHILD_TYPE, MY_TYPE, FIELD, !=) \ CMP_ONE(CHILD_TYPE, MY_TYPE, FIELD, <) -#define FIELD_TYPE std::pair -CMP(SingleBuiltPath, SingleBuiltPathBuilt, output) -#undef FIELD_TYPE - #define FIELD_TYPE std::map CMP(SingleBuiltPath, BuiltPathBuilt, outputs) #undef FIELD_TYPE @@ -61,36 +57,6 @@ try { co_return result::current_exception(); } -kj::Promise> SingleBuiltPath::Built::toJSON(const Store & store) const -try { - JSON res; - res["drvPath"] = TRY_AWAIT(drvPath->toJSON(store)); - auto & [outputName, outputPath] = output; - res["output"] = outputName; - res["outputPath"] = store.printStorePath(outputPath); - co_return res; -} catch (...) { - co_return result::current_exception(); -} - -kj::Promise> SingleBuiltPath::toJSON(const Store & store) const -try { - co_return TRY_AWAIT(std::visit([&](const auto & buildable) { - return buildable.toJSON(store); - }, raw())); -} catch (...) { - co_return result::current_exception(); -} - - -kj::Promise> BuiltPath::toJSON(const Store & store) const -try { - co_return TRY_AWAIT(std::visit([&](const auto & buildable) { - return buildable.toJSON(store); - }, raw())); -} catch (...) { - co_return result::current_exception(); -} kj::Promise> BuiltPath::toRealisedPaths(Store & store) const try { diff --git a/lix/libcmd/built-path.hh b/lix/libcmd/built-path.hh index c9077e490..cfc8673d8 100644 --- a/lix/libcmd/built-path.hh +++ b/lix/libcmd/built-path.hh @@ -7,46 +7,6 @@ namespace nix { -struct SingleBuiltPath; - -struct SingleBuiltPathBuilt { - ref drvPath; - std::pair output; - - std::string to_string(const Store & store) const; - static SingleBuiltPathBuilt parse(const Store & store, std::string_view, std::string_view); - kj::Promise> toJSON(const Store & store) const; - - DECLARE_CMP(SingleBuiltPathBuilt); -}; - -namespace built_path::detail { -using SingleBuiltPathRaw = std::variant< - DerivedPathOpaque, - SingleBuiltPathBuilt ->; -} - -struct SingleBuiltPath : built_path::detail::SingleBuiltPathRaw { - using Raw = built_path::detail::SingleBuiltPathRaw; - using Raw::Raw; - - using Opaque = DerivedPathOpaque; - using Built = SingleBuiltPathBuilt; - - inline const Raw & raw() const { - return static_cast(*this); - } - - static SingleBuiltPath parse(const Store & store, std::string_view); - kj::Promise> toJSON(const Store & store) const; -}; - -static inline ref staticDrv(StorePath drvPath) -{ - return make_ref(SingleBuiltPath::Opaque { drvPath }); -} - /** * A built derived path with hints in the form of optional concrete output paths. * @@ -56,8 +16,6 @@ struct BuiltPathBuilt { DerivedPathOpaque drvPath; std::map outputs; - std::string to_string(const Store & store) const; - static BuiltPathBuilt parse(const Store & store, std::string_view, std::string_view); kj::Promise> toJSON(const Store & store) const; DECLARE_CMP(BuiltPathBuilt); @@ -87,8 +45,6 @@ struct BuiltPath : built_path::detail::BuiltPathRaw { StorePathSet outPaths() const; kj::Promise> toRealisedPaths(Store & store) const; - - kj::Promise> toJSON(const Store & store) const; }; typedef std::vector BuiltPaths;