aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_installation.cpp
diff options
context:
space:
mode:
authorAlbert Ziegenhagel <albert.ziegenhagel@outlook.com>2016-09-23 09:58:33 +0200
committerAlbert Ziegenhagel <albert.ziegenhagel@outlook.com>2016-09-23 09:58:33 +0200
commit430f53af7d2d8b9a2bda1986bd6ecb8eb7630b5d (patch)
treeb7618c81d8844c387b78861ee96af91109a633fe /toolsrc/src/commands_installation.cpp
parent31935aa0fd142cbb4e0db1a62ba1483294b740f8 (diff)
parent5b89712df01c96242ced20c38f0fa27631c3f4e3 (diff)
downloadvcpkg-430f53af7d2d8b9a2bda1986bd6ecb8eb7630b5d.tar.gz
vcpkg-430f53af7d2d8b9a2bda1986bd6ecb8eb7630b5d.zip
Merge branch 'master' into default_triplet
# Conflicts: # toolsrc/include/vcpkg_cmd_arguments.h # toolsrc/src/commands_installation.cpp # toolsrc/src/vcpkg_cmd_arguments.cpp
Diffstat (limited to 'toolsrc/src/commands_installation.cpp')
-rw-r--r--toolsrc/src/commands_installation.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp
index 0ca754dfc..0977dcf37 100644
--- a/toolsrc/src/commands_installation.cpp
+++ b/toolsrc/src/commands_installation.cpp
@@ -6,6 +6,7 @@
#include "vcpkg_Files.h"
#include "post_build_lint.h"
#include "vcpkg_System.h"
+#include "vcpkg_Dependencies.h"
namespace vcpkg
{
@@ -59,18 +60,19 @@ namespace vcpkg
{
StatusParagraphs status_db = database_load_check(paths);
- std::vector<package_spec> specs = args.extract_package_specs_with_unmet_dependencies(paths, default_target_triplet, status_db);
- Checks::check_exit(!specs.empty(), "Specs cannot be empty");
- std::string specs_string = to_string(specs[0]);
- for (size_t i = 1; i < specs.size(); ++i)
+ std::vector<package_spec> specs = args.parse_all_arguments_as_package_specs(default_target_triplet);
+ std::vector<package_spec> install_plan = Dependencies::create_dependency_ordered_install_plan(paths, specs, status_db);
+ Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty");
+ std::string specs_string = to_string(install_plan[0]);
+ for (size_t i = 1; i < install_plan.size(); ++i)
{
specs_string.push_back(',');
- specs_string.append(to_string(specs[i]));
+ specs_string.append(to_string(install_plan[i]));
}
TrackProperty("installplan", specs_string);
Environment::ensure_utilities_on_path(paths);
- for (const package_spec& spec : specs)
+ for (const package_spec& spec : install_plan)
{
if (status_db.find_installed(spec.name, spec.target_triplet) != status_db.end())
{
@@ -111,7 +113,27 @@ namespace vcpkg
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.
+ // Allowing only 1 package for now.
+ args.check_max_args(1);
+
+ StatusParagraphs status_db = database_load_check(paths);
+
std::vector<package_spec> specs = args.parse_all_arguments_as_package_specs(paths, default_target_triplet);
+ std::unordered_set<package_spec> unmet_dependencies = Dependencies::find_unmet_dependencies(paths, specs, status_db);
+ if (!unmet_dependencies.empty())
+ {
+ System::println(System::color::error, "The build command requires all dependencies to be already installed.");
+ System::println("The following dependencies are missing:");
+ System::println("");
+ for (const package_spec& p : unmet_dependencies)
+ {
+ System::println(" %s", p.name);
+ }
+ System::println("");
+ exit(EXIT_FAILURE);
+ }
+
Environment::ensure_utilities_on_path(paths);
for (const package_spec& spec : specs)
{