forked from lix-project/lix
Add infra for InputSchemes
to be experimental
This commit is contained in:
parent
c816c67eed
commit
bfe1308d3f
|
@ -36,6 +36,7 @@ Input Input::fromURL(const ParsedURL & url, bool requireTree)
|
||||||
for (auto & inputScheme : *inputSchemes) {
|
for (auto & inputScheme : *inputSchemes) {
|
||||||
auto res = inputScheme->inputFromURL(url, requireTree);
|
auto res = inputScheme->inputFromURL(url, requireTree);
|
||||||
if (res) {
|
if (res) {
|
||||||
|
experimentalFeatureSettings.require(inputScheme->experimentalFeature());
|
||||||
res->scheme = inputScheme;
|
res->scheme = inputScheme;
|
||||||
fixupInput(*res);
|
fixupInput(*res);
|
||||||
return std::move(*res);
|
return std::move(*res);
|
||||||
|
@ -50,6 +51,7 @@ Input Input::fromAttrs(Attrs && attrs)
|
||||||
for (auto & inputScheme : *inputSchemes) {
|
for (auto & inputScheme : *inputSchemes) {
|
||||||
auto res = inputScheme->inputFromAttrs(attrs);
|
auto res = inputScheme->inputFromAttrs(attrs);
|
||||||
if (res) {
|
if (res) {
|
||||||
|
experimentalFeatureSettings.require(inputScheme->experimentalFeature());
|
||||||
res->scheme = inputScheme;
|
res->scheme = inputScheme;
|
||||||
fixupInput(*res);
|
fixupInput(*res);
|
||||||
return std::move(*res);
|
return std::move(*res);
|
||||||
|
@ -309,4 +311,9 @@ void InputScheme::clone(const Input & input, const Path & destDir) const
|
||||||
throw Error("do not know how to clone input '%s'", input.to_string());
|
throw Error("do not know how to clone input '%s'", input.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<ExperimentalFeature> InputScheme::experimentalFeature()
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,11 @@ struct InputScheme
|
||||||
virtual void markChangedFile(const Input & input, std::string_view file, std::optional<std::string> commitMsg);
|
virtual void markChangedFile(const Input & input, std::string_view file, std::optional<std::string> commitMsg);
|
||||||
|
|
||||||
virtual std::pair<StorePath, Input> fetch(ref<Store> store, const Input & input) = 0;
|
virtual std::pair<StorePath, Input> fetch(ref<Store> store, const Input & input) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this `InputScheme` part of an experimental feature?
|
||||||
|
*/
|
||||||
|
virtual std::optional<ExperimentalFeature> experimentalFeature();
|
||||||
};
|
};
|
||||||
|
|
||||||
void registerInputScheme(std::shared_ptr<InputScheme> && fetcher);
|
void registerInputScheme(std::shared_ptr<InputScheme> && fetcher);
|
||||||
|
|
|
@ -236,7 +236,7 @@ struct Command : virtual public Args
|
||||||
|
|
||||||
static constexpr Category catDefault = 0;
|
static constexpr Category catDefault = 0;
|
||||||
|
|
||||||
virtual std::optional<ExperimentalFeature> experimentalFeature ();
|
virtual std::optional<ExperimentalFeature> experimentalFeature();
|
||||||
|
|
||||||
virtual Category category() { return catDefault; }
|
virtual Category category() { return catDefault; }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue