find_unment_dependencies() now works for a single package
This commit is contained in:
Родитель
a479c70b14
Коммит
b1398f09b4
|
@ -9,5 +9,5 @@ namespace vcpkg {namespace Dependencies
|
||||||
{
|
{
|
||||||
std::vector<package_spec> create_dependency_ordered_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
|
std::vector<package_spec> create_dependency_ordered_install_plan(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
|
||||||
|
|
||||||
std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db);
|
std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db);
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -113,14 +113,14 @@ namespace vcpkg
|
||||||
|
|
||||||
void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
|
void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
|
||||||
{
|
{
|
||||||
// Currently the code won't work for multiple packages if one of them depends on another.
|
// Installing multiple packages leads to unintuitive behavior if one of them depends on another.
|
||||||
// Allowing only 1 package for now.
|
// Allowing only 1 package for now.
|
||||||
args.check_max_args(1);
|
args.check_max_args(1);
|
||||||
|
|
||||||
StatusParagraphs status_db = database_load_check(paths);
|
StatusParagraphs status_db = database_load_check(paths);
|
||||||
|
|
||||||
std::vector<package_spec> specs = args.parse_all_arguments_as_package_specs(default_target_triplet);
|
const package_spec spec = args.parse_all_arguments_as_package_specs(default_target_triplet).at(0);
|
||||||
std::unordered_set<package_spec> unmet_dependencies = Dependencies::find_unmet_dependencies(paths, specs, status_db);
|
std::unordered_set<package_spec> unmet_dependencies = Dependencies::find_unmet_dependencies(paths, spec, status_db);
|
||||||
if (!unmet_dependencies.empty())
|
if (!unmet_dependencies.empty())
|
||||||
{
|
{
|
||||||
System::println(System::color::error, "The build command requires all dependencies to be already installed.");
|
System::println(System::color::error, "The build command requires all dependencies to be already installed.");
|
||||||
|
@ -135,10 +135,7 @@ namespace vcpkg
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment::ensure_utilities_on_path(paths);
|
Environment::ensure_utilities_on_path(paths);
|
||||||
for (const package_spec& spec : specs)
|
build_internal(spec, paths);
|
||||||
{
|
|
||||||
build_internal(spec, paths);
|
|
||||||
}
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,12 +57,11 @@ namespace vcpkg { namespace Dependencies
|
||||||
return build_dependency_graph(paths, specs, status_db).find_topological_sort();
|
return build_dependency_graph(paths, specs, status_db).find_topological_sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const std::vector<package_spec>& specs, const StatusParagraphs& status_db)
|
std::unordered_set<package_spec> find_unmet_dependencies(const vcpkg_paths& paths, const package_spec& spec, const StatusParagraphs& status_db)
|
||||||
{
|
{
|
||||||
const Graphs::Graph<package_spec> dependency_graph = build_dependency_graph(paths, specs, status_db);
|
const Graphs::Graph<package_spec> dependency_graph = build_dependency_graph(paths, {spec}, status_db);
|
||||||
std::unordered_set<package_spec> key_set = Maps::extract_key_set(dependency_graph.adjacency_list());
|
std::unordered_set<package_spec> key_set = Maps::extract_key_set(dependency_graph.adjacency_list());
|
||||||
Sets::remove_all(&key_set, specs);
|
key_set.erase(spec);
|
||||||
|
|
||||||
return key_set;
|
return key_set;
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче