keep on refactoring
This commit is contained in:
parent
d30e6ed759
commit
b07d017f86
6 changed files with 45 additions and 21 deletions
|
@ -15,7 +15,7 @@ constexpr std::array<std::string_view, Component::done + 1> stringStates {
|
|||
|
||||
Component::Component(
|
||||
const std::filesystem::path& path,
|
||||
const std::shared_ptr<Collection>& collection,
|
||||
const std::weak_ptr<Collection>& collection,
|
||||
const std::shared_ptr<Logger>& logger
|
||||
):
|
||||
Loggable(logger),
|
||||
|
@ -81,9 +81,10 @@ bool Component::readAsMason() {
|
|||
return errorScenario(masonScenarion.string() + " dependencies are not organized as an array");
|
||||
|
||||
for (const nlohmann::json& dep : deps) {
|
||||
std::shared_ptr<Collection> col = collection.lock();
|
||||
switch (dep.type()) {
|
||||
case nlohmann::json::value_t::string:
|
||||
collection->addSource(dep);
|
||||
col->addSource(dep);
|
||||
break;
|
||||
case nlohmann::json::value_t::object: {
|
||||
nlohmann::json::const_iterator ditr = dep.find("path");
|
||||
|
@ -94,7 +95,7 @@ bool Component::readAsMason() {
|
|||
if (!path.is_string())
|
||||
return errorScenario(masonScenarion.string() + " object of unexpected format in dependecies");
|
||||
|
||||
collection->addSource(path);
|
||||
col->addSource(path);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -104,6 +105,7 @@ bool Component::readAsMason() {
|
|||
}
|
||||
|
||||
type = mason;
|
||||
info(location.string() + " seems to be a mason project");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -122,6 +124,9 @@ void Component::build(const std::filesystem::path& destination, const std::strin
|
|||
throw WrongState(state, "build");
|
||||
|
||||
state = building;
|
||||
|
||||
info("Building " + location.string() + " to " + destination.string());
|
||||
state = done;
|
||||
}
|
||||
|
||||
Component::State Component::getState() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue