2016-09-18 20:50:08 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "vcpkg_cmd_arguments.h"
|
|
|
|
#include "vcpkg_paths.h"
|
2017-02-10 17:00:46 -08:00
|
|
|
#include "StatusParagraphs.h"
|
2017-02-15 14:34:03 -08:00
|
|
|
#include <array>
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-01-12 17:35:33 -08:00
|
|
|
namespace vcpkg::Commands
|
2016-09-18 20:50:08 -07:00
|
|
|
{
|
2017-01-12 17:35:33 -08:00
|
|
|
using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
|
|
|
|
using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
using command_type_c = void(*)(const vcpkg_cmd_arguments& args);
|
|
|
|
|
2017-01-12 22:03:57 -08:00
|
|
|
namespace Build
|
|
|
|
{
|
2017-02-03 18:10:29 -08:00
|
|
|
enum class BuildResult
|
|
|
|
{
|
2017-02-15 14:34:03 -08:00
|
|
|
NULLVALUE = 0,
|
2017-02-13 14:01:27 -08:00
|
|
|
SUCCEEDED,
|
2017-02-03 18:10:29 -08:00
|
|
|
BUILD_FAILED,
|
|
|
|
POST_BUILD_CHECKS_FAILED,
|
2017-02-13 14:01:27 -08:00
|
|
|
CASCADED_DUE_TO_MISSING_DEPENDENCIES
|
2017-02-03 18:10:29 -08:00
|
|
|
};
|
|
|
|
|
2017-02-15 14:34:03 -08:00
|
|
|
static constexpr std::array<BuildResult, 4> BuildResult_values = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES };
|
|
|
|
|
2017-02-13 14:01:27 -08:00
|
|
|
const std::string& to_string(const BuildResult build_result);
|
2017-02-13 16:23:21 -08:00
|
|
|
std::string create_error_message(const BuildResult build_result, const package_spec& spec);
|
2017-02-13 16:22:02 -08:00
|
|
|
std::string create_user_troubleshooting_message(const package_spec& spec);
|
2017-02-13 14:01:27 -08:00
|
|
|
|
|
|
|
BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db);
|
2017-02-17 14:55:37 -08:00
|
|
|
void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths);
|
2017-01-12 22:03:57 -08:00
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace BuildExternal
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Install
|
2017-02-13 14:01:56 -08:00
|
|
|
{
|
|
|
|
void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db);
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace CI
|
2017-01-12 22:03:57 -08:00
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Remove
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Update
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Create
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Edit
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Search
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace List
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
|
|
|
|
2017-02-17 15:38:39 -08:00
|
|
|
namespace Owns
|
2017-01-12 22:03:57 -08:00
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
|
|
|
|
2017-02-17 15:38:39 -08:00
|
|
|
namespace Cache
|
2017-01-12 22:03:57 -08:00
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
|
|
|
|
2017-02-17 15:38:39 -08:00
|
|
|
namespace Import
|
2017-01-12 22:03:57 -08:00
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Integrate
|
|
|
|
{
|
|
|
|
extern const char*const INTEGRATE_COMMAND_HELPSTRING;
|
|
|
|
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace PortsDiff
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
|
|
|
}
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-01-12 22:03:57 -08:00
|
|
|
namespace Help
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-01-12 22:03:57 -08:00
|
|
|
void help_topic_valid_triplet(const vcpkg_paths& paths);
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-01-12 22:03:57 -08:00
|
|
|
void print_usage();
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-01-12 22:03:57 -08:00
|
|
|
void print_example(const std::string& command_and_arguments);
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-01-12 22:03:57 -08:00
|
|
|
std::string create_example_string(const std::string& command_and_arguments);
|
|
|
|
}
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-01-12 22:03:57 -08:00
|
|
|
namespace Version
|
|
|
|
{
|
2017-02-17 20:08:29 -08:00
|
|
|
const std::string& version();
|
2017-01-12 22:03:57 -08:00
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args);
|
|
|
|
}
|
2016-11-06 20:12:54 -08:00
|
|
|
|
2017-01-12 22:03:57 -08:00
|
|
|
namespace Contact
|
|
|
|
{
|
2017-02-17 20:13:36 -08:00
|
|
|
const std::string& email();
|
2017-01-12 22:03:57 -08:00
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args);
|
|
|
|
}
|
2016-09-18 20:50:08 -07:00
|
|
|
|
2017-01-12 22:03:57 -08:00
|
|
|
namespace Hash
|
|
|
|
{
|
|
|
|
void perform_and_exit(const vcpkg_cmd_arguments& args);
|
|
|
|
}
|
2016-09-18 20:50:08 -07:00
|
|
|
|
|
|
|
template <class T>
|
|
|
|
struct package_name_and_function
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
T function;
|
|
|
|
};
|
|
|
|
|
|
|
|
const std::vector<package_name_and_function<command_type_a>>& get_available_commands_type_a();
|
|
|
|
const std::vector<package_name_and_function<command_type_b>>& get_available_commands_type_b();
|
|
|
|
const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c();
|
|
|
|
|
|
|
|
template <typename T>
|
2017-01-12 17:35:33 -08:00
|
|
|
T find(const std::string& command_name, const std::vector<package_name_and_function<T>> available_commands)
|
2016-09-18 20:50:08 -07:00
|
|
|
{
|
|
|
|
for (const package_name_and_function<T>& cmd : available_commands)
|
|
|
|
{
|
|
|
|
if (cmd.name == command_name)
|
|
|
|
{
|
|
|
|
return cmd.function;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// not found
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|