vcpkg/toolsrc/include/vcpkg_Commands.h

182 lines
5.7 KiB
C
Raw Normal View History

2016-09-19 11:50:08 +08:00
#pragma once
#include "VcpkgCmdArguments.h"
2016-09-19 11:50:08 +08:00
#include "vcpkg_paths.h"
#include "StatusParagraphs.h"
#include <array>
2017-04-04 07:13:46 +08:00
#include "VersionT.h"
2016-09-19 11:50:08 +08:00
namespace vcpkg::Commands
2016-09-19 11:50:08 +08:00
{
2017-04-04 07:03:04 +08:00
using CommandTypeA = void(*)(const VcpkgCmdArguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet);
using CommandTypeB = void(*)(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
using CommandTypeC = void(*)(const VcpkgCmdArguments& args);
namespace Build
{
enum class BuildResult
{
NULLVALUE = 0,
SUCCEEDED,
BUILD_FAILED,
POST_BUILD_CHECKS_FAILED,
CASCADED_DUE_TO_MISSING_DEPENDENCIES
};
static constexpr std::array<BuildResult, 4> BuildResult_values = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES };
const std::string& to_string(const BuildResult build_result);
2017-04-04 05:45:00 +08:00
std::string create_error_message(const BuildResult build_result, const PackageSpec& spec);
std::string create_user_troubleshooting_message(const PackageSpec& spec);
2017-04-04 06:02:45 +08:00
std::wstring make_build_env_cmd(const Triplet& target_triplet, const toolset_t& toolset);
2017-04-04 05:45:00 +08:00
BuildResult build_package(const SourceParagraph& source_paragraph, const PackageSpec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db);
void perform_and_exit(const PackageSpec& spec, const fs::path& port_dir, const std::unordered_set<std::string>& options, const vcpkg_paths& paths);
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet);
}
namespace BuildExternal
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet);
}
namespace Install
{
void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db);
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet);
}
namespace CI
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet);
}
namespace Remove
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths, const Triplet& default_target_triplet);
}
namespace Update
{
2017-04-04 07:03:31 +08:00
struct OutdatedPackage
2017-03-30 09:14:48 +08:00
{
2017-04-04 07:03:31 +08:00
static bool compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right);
2017-03-30 09:14:48 +08:00
2017-04-04 05:45:00 +08:00
PackageSpec spec;
2017-04-04 07:18:21 +08:00
VersionDiff version_diff;
2017-03-30 09:14:48 +08:00
};
2017-04-04 07:03:31 +08:00
std::vector<OutdatedPackage> find_outdated_packages(const vcpkg_paths& paths, const StatusParagraphs& status_db);
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
namespace Env
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths, const Triplet& default_triplet);
}
namespace Create
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
namespace Edit
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
namespace Search
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
namespace List
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
2017-02-18 07:38:39 +08:00
namespace Owns
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
2017-02-18 07:38:39 +08:00
namespace Cache
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
2017-02-18 07:38:39 +08:00
namespace Import
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
namespace Integrate
{
extern const char*const INTEGRATE_COMMAND_HELPSTRING;
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
namespace PortsDiff
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
}
2016-09-19 11:50:08 +08:00
namespace Help
{
void perform_and_exit(const VcpkgCmdArguments& args, const vcpkg_paths& paths);
2016-09-19 11:50:08 +08:00
void help_topic_valid_triplet(const vcpkg_paths& paths);
2016-09-19 11:50:08 +08:00
void print_usage();
2016-09-19 11:50:08 +08:00
void print_example(const std::string& command_and_arguments);
2016-09-19 11:50:08 +08:00
std::string create_example_string(const std::string& command_and_arguments);
}
2016-09-19 11:50:08 +08:00
namespace Version
{
const std::string& version();
void perform_and_exit(const VcpkgCmdArguments& args);
}
2016-11-07 12:12:54 +08:00
namespace Contact
{
const std::string& email();
void perform_and_exit(const VcpkgCmdArguments& args);
}
2016-09-19 11:50:08 +08:00
namespace Hash
{
void perform_and_exit(const VcpkgCmdArguments& args);
}
2016-09-19 11:50:08 +08:00
template <class T>
struct PackageNameAndFunction
2016-09-19 11:50:08 +08:00
{
std::string name;
T function;
};
const std::vector<PackageNameAndFunction<CommandTypeA>>& get_available_commands_type_a();
const std::vector<PackageNameAndFunction<CommandTypeB>>& get_available_commands_type_b();
const std::vector<PackageNameAndFunction<CommandTypeC>>& get_available_commands_type_c();
2016-09-19 11:50:08 +08:00
template <typename T>
T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands)
2016-09-19 11:50:08 +08:00
{
for (const PackageNameAndFunction<T>& cmd : available_commands)
2016-09-19 11:50:08 +08:00
{
if (cmd.name == command_name)
{
return cmd.function;
}
}
// not found
return nullptr;
}
}