2016-09-19 11:50:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-28 08:56:06 +08:00
|
|
|
#include "StatusParagraphs.h"
|
2017-04-04 07:00:17 +08:00
|
|
|
#include "VcpkgCmdArguments.h"
|
2017-04-04 07:29:11 +08:00
|
|
|
#include "VcpkgPaths.h"
|
2017-04-04 07:13:46 +08:00
|
|
|
#include "VersionT.h"
|
2017-04-28 08:56:06 +08:00
|
|
|
#include <array>
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-01-13 09:35:33 +08:00
|
|
|
namespace vcpkg::Commands
|
2016-09-19 11:50:08 +08:00
|
|
|
{
|
2017-04-28 08:56:06 +08:00
|
|
|
using CommandTypeA = void (*)(const VcpkgCmdArguments& args,
|
|
|
|
const VcpkgPaths& paths,
|
|
|
|
const Triplet& default_triplet);
|
|
|
|
using CommandTypeB = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
|
|
|
using CommandTypeC = void (*)(const VcpkgCmdArguments& args);
|
2017-01-13 09:35:33 +08:00
|
|
|
|
2017-04-30 19:09:05 +08:00
|
|
|
namespace BuildCommand
|
2017-01-13 14:03:57 +08:00
|
|
|
{
|
2017-04-28 08:56:06 +08:00
|
|
|
void perform_and_exit(const PackageSpec& spec,
|
|
|
|
const fs::path& port_dir,
|
|
|
|
const std::unordered_set<std::string>& options,
|
|
|
|
const VcpkgPaths& paths);
|
2017-04-23 16:30:43 +08:00
|
|
|
|
2017-04-11 04:00:33 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace BuildExternal
|
|
|
|
{
|
2017-04-11 04:00:33 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Install
|
2017-02-14 06:01:56 +08:00
|
|
|
{
|
2017-04-20 08:44:26 +08:00
|
|
|
struct InstallDir
|
2017-04-18 08:13:51 +08:00
|
|
|
{
|
2017-04-20 08:48:43 +08:00
|
|
|
static InstallDir from_destination_root(const fs::path& destination_root,
|
2017-04-20 08:44:26 +08:00
|
|
|
const std::string& destination_subdirectory,
|
|
|
|
const fs::path& listfile);
|
2017-04-18 09:57:00 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
fs::path m_destination;
|
|
|
|
std::string m_destination_subdirectory;
|
|
|
|
fs::path m_listfile;
|
|
|
|
|
|
|
|
public:
|
|
|
|
const fs::path& destination() const;
|
|
|
|
const std::string& destination_subdirectory() const;
|
|
|
|
const fs::path& listfile() const;
|
2017-04-18 08:13:51 +08:00
|
|
|
};
|
|
|
|
|
2017-04-28 08:56:06 +08:00
|
|
|
void install_files_and_write_listfile(Files::Filesystem& fs,
|
|
|
|
const fs::path& source_dir,
|
|
|
|
const InstallDir& dirs);
|
|
|
|
void install_package(const VcpkgPaths& paths,
|
|
|
|
const BinaryParagraph& binary_paragraph,
|
|
|
|
StatusParagraphs* status_db);
|
2017-04-11 04:00:33 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
|
2017-02-14 06:01:56 +08:00
|
|
|
}
|
|
|
|
|
2017-04-11 03:57:49 +08:00
|
|
|
namespace Export
|
|
|
|
{
|
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
|
|
|
|
}
|
|
|
|
|
2017-02-14 06:01:56 +08:00
|
|
|
namespace CI
|
2017-01-13 14:03:57 +08:00
|
|
|
{
|
2017-04-11 04:00:33 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Remove
|
|
|
|
{
|
2017-04-11 04:00:33 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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:29:11 +08:00
|
|
|
std::vector<OutdatedPackage> find_outdated_packages(const VcpkgPaths& paths, const StatusParagraphs& status_db);
|
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
2017-04-04 01:44:14 +08:00
|
|
|
namespace Env
|
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
|
2017-04-04 01:44:14 +08:00
|
|
|
}
|
|
|
|
|
2017-01-13 14:03:57 +08:00
|
|
|
namespace Create
|
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Edit
|
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
2017-04-06 05:20:49 +08:00
|
|
|
namespace DependInfo
|
|
|
|
{
|
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
|
|
|
}
|
|
|
|
|
2017-01-13 14:03:57 +08:00
|
|
|
namespace Search
|
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace List
|
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
2017-02-18 07:38:39 +08:00
|
|
|
namespace Owns
|
2017-01-13 14:03:57 +08:00
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
2017-02-18 07:38:39 +08:00
|
|
|
namespace Cache
|
2017-01-13 14:03:57 +08:00
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
2017-02-18 07:38:39 +08:00
|
|
|
namespace Import
|
2017-01-13 14:03:57 +08:00
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Integrate
|
|
|
|
{
|
2017-04-28 08:56:06 +08:00
|
|
|
extern const char* const INTEGRATE_COMMAND_HELPSTRING;
|
2017-01-13 14:03:57 +08:00
|
|
|
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace PortsDiff
|
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-01-13 14:03:57 +08:00
|
|
|
namespace Help
|
|
|
|
{
|
2017-04-04 07:29:11 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-04-04 07:29:11 +08:00
|
|
|
void help_topic_valid_triplet(const VcpkgPaths& paths);
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-01-13 14:03:57 +08:00
|
|
|
void print_usage();
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-01-13 14:03:57 +08:00
|
|
|
void print_example(const std::string& command_and_arguments);
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-01-13 14:03:57 +08:00
|
|
|
std::string create_example_string(const std::string& command_and_arguments);
|
|
|
|
}
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-01-13 14:03:57 +08:00
|
|
|
namespace Version
|
|
|
|
{
|
2017-02-18 12:08:29 +08:00
|
|
|
const std::string& version();
|
2017-04-04 07:00:17 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
2016-11-07 12:12:54 +08:00
|
|
|
|
2017-01-13 14:03:57 +08:00
|
|
|
namespace Contact
|
|
|
|
{
|
2017-02-18 12:13:36 +08:00
|
|
|
const std::string& email();
|
2017-04-04 07:00:17 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-01-13 14:03:57 +08:00
|
|
|
namespace Hash
|
|
|
|
{
|
2017-04-04 07:00:17 +08:00
|
|
|
void perform_and_exit(const VcpkgCmdArguments& args);
|
2017-01-13 14:03:57 +08:00
|
|
|
}
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-04-18 09:18:47 +08:00
|
|
|
template<class T>
|
2017-04-04 07:21:21 +08:00
|
|
|
struct PackageNameAndFunction
|
2016-09-19 11:50:08 +08:00
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
T function;
|
|
|
|
};
|
|
|
|
|
2017-04-04 07:21:21 +08:00
|
|
|
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
|
|
|
|
2017-04-18 09:18:47 +08:00
|
|
|
template<typename T>
|
2017-04-04 07:21:21 +08:00
|
|
|
T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands)
|
2016-09-19 11:50:08 +08:00
|
|
|
{
|
2017-04-04 07:21:21 +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;
|
|
|
|
}
|
|
|
|
}
|