Merge branch 'refactor-includes'

This commit is contained in:
Robert Schumacher 2017-10-13 18:50:28 -07:00
commit 0d7381ba40
120 changed files with 1409 additions and 1313 deletions

View File

@ -1,52 +0,0 @@
#pragma once
#include <array>
#include <cstddef>
#include <initializer_list>
#include <vector>
template<class T>
struct Span
{
public:
using element_type = T;
using pointer = T*;
using reference = T&;
using iterator = T*;
constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
constexpr Span(std::nullptr_t) noexcept : Span() {}
constexpr Span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
constexpr Span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
constexpr Span(std::initializer_list<T> l) noexcept : m_ptr(l.begin()), m_count(l.size()) {}
template<size_t N>
constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
{
}
Span(std::vector<T>& v) noexcept : Span(v.data(), v.size()) {}
Span(const std::vector<std::remove_const_t<T>>& v) noexcept : Span(v.data(), v.size()) {}
constexpr iterator begin() const { return m_ptr; }
constexpr iterator end() const { return m_ptr + m_count; }
constexpr reference operator[](size_t i) const { return m_ptr[i]; }
constexpr size_t size() const { return m_count; }
private:
pointer m_ptr;
size_t m_count;
};
template<class T>
Span<T> make_span(std::vector<T>& v)
{
return {v.data(), v.size()};
}
template<class T>
Span<const T> make_span(const std::vector<T>& v)
{
return {v.data(), v.size()};
}

View File

@ -1,16 +0,0 @@
#pragma once
#include <filesystem>
namespace fs
{
namespace stdfs = std::experimental::filesystem;
using stdfs::path;
using stdfs::copy_options;
using stdfs::file_status;
inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); }
inline bool is_directory(file_status s) { return stdfs::is_directory(s); }
inline bool status_known(file_status s) { return stdfs::status_known(s); }
}

View File

@ -2,9 +2,13 @@
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#pragma warning(suppress : 4768)
#include <windows.h>
#pragma warning(suppress : 4768)
#include <Shlobj.h>
#include <algorithm>
#include <array>
#include <atomic>
@ -28,10 +32,6 @@
#include <regex>
#include <set>
#include <shellapi.h>
#pragma warning(push)
#pragma warning(disable : 4768)
#include <Shlobj.h>
#pragma warning(pop)
#include <stdexcept>
#include <string>
#include <sys/timeb.h>

View File

@ -1,7 +1,8 @@
#pragma once
#include "LineInfo.h"
#include "vcpkg_Strings.h"
#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/lineinfo.h>
#include <vcpkg/base/strings.h>
namespace vcpkg::Checks
{

View File

@ -3,7 +3,7 @@
#include <chrono>
#include <string>
namespace vcpkg
namespace vcpkg::Chrono
{
class ElapsedTime
{

View File

@ -1,6 +1,8 @@
#pragma once
#include "MachineType.h"
#include "filesystem_fs.h"
#include <vcpkg/base/files.h>
#include <vcpkg/base/machinetype.h>
#include <vector>
namespace vcpkg::CoffFileReader

View File

@ -1,4 +1,5 @@
#pragma once
#include <string>
namespace vcpkg

View File

@ -1,5 +1,7 @@
#pragma once
#include "LineInfo.h"
#include <vcpkg/base/lineinfo.h>
#include <string>
namespace vcpkg::Enums

View File

@ -1,6 +1,7 @@
#pragma once
#include "vcpkg_Checks.h"
#include <vcpkg/base/checks.h>
#include <system_error>
namespace vcpkg

View File

@ -1,7 +1,21 @@
#pragma once
#include "filesystem_fs.h"
#include "vcpkg_expected.h"
#include <vcpkg/base/expected.h>
#include <filesystem>
namespace fs
{
namespace stdfs = std::experimental::filesystem;
using stdfs::copy_options;
using stdfs::file_status;
using stdfs::path;
inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); }
inline bool is_directory(file_status s) { return stdfs::is_directory(s); }
inline bool status_known(file_status s) { return stdfs::status_known(s); }
}
namespace vcpkg::Files
{

View File

@ -3,6 +3,8 @@
#include <unordered_map>
#include <unordered_set>
#include <vcpkg/base/checks.h>
namespace vcpkg::Graphs
{
enum class ExplorationStatus

View File

@ -1,4 +1,5 @@
#pragma once
#include <cstdint>
namespace vcpkg

View File

@ -1,5 +1,6 @@
#pragma once
#include "vcpkg_Checks.h"
#include <vcpkg/base/checks.h>
namespace vcpkg
{

View File

@ -0,0 +1,60 @@
#pragma once
#include <array>
#include <cstddef>
#include <initializer_list>
#include <vector>
namespace vcpkg
{
template<class T>
struct Span
{
public:
using element_type = T;
using pointer = T*;
using reference = T&;
using iterator = T*;
constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
constexpr Span(std::nullptr_t) noexcept : Span() {}
constexpr Span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
constexpr Span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
constexpr Span(std::initializer_list<T> l) noexcept : m_ptr(l.begin()), m_count(l.size()) {}
template<size_t N>
constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
{
}
template<size_t N>
constexpr Span(const std::array<std::remove_const_t<T>, N>& arr) noexcept : Span(arr.data(), arr.size())
{
}
Span(std::vector<T>& v) noexcept : Span(v.data(), v.size()) {}
Span(const std::vector<std::remove_const_t<T>>& v) noexcept : Span(v.data(), v.size()) {}
constexpr iterator begin() const { return m_ptr; }
constexpr iterator end() const { return m_ptr + m_count; }
constexpr reference operator[](size_t i) const { return m_ptr[i]; }
constexpr size_t size() const { return m_count; }
private:
pointer m_ptr;
size_t m_count;
};
template<class T>
Span<T> make_span(std::vector<T>& v)
{
return {v.data(), v.size()};
}
template<class T>
Span<const T> make_span(const std::vector<T>& v)
{
return {v.data(), v.size()};
}
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "CStringView.h"
#include <vcpkg/base/cstringview.h>
#include <vector>
namespace vcpkg::Strings::details
@ -61,7 +62,7 @@ namespace vcpkg::Strings
bool case_insensitive_ascii_contains(const std::string& s, const std::string& pattern);
int case_insensitive_ascii_compare(const CStringView left, const CStringView right);
bool case_insensitive_ascii_compare(const CStringView left, const CStringView right);
std::string ascii_to_lowercase(const std::string& input);

View File

@ -1,8 +1,9 @@
#pragma once
#include "filesystem_fs.h"
#include "vcpkg_Strings.h"
#include "vcpkg_optional.h"
#include <vcpkg/base/files.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/strings.h>
#include <Windows.h>
namespace vcpkg::System

View File

@ -56,15 +56,19 @@ namespace vcpkg::Util
}
template<class Container, class V>
auto find(const Container& cont, V&& v)
auto find(Container&& cont, V&& v)
{
return std::find(cont.cbegin(), cont.cend(), v);
using std::begin;
using std::end;
return std::find(begin(cont), end(cont), v);
}
template<class Container, class Pred>
auto find_if(const Container& cont, Pred pred)
auto find_if(Container&& cont, Pred pred)
{
return std::find_if(cont.cbegin(), cont.cend(), pred);
using std::begin;
using std::end;
return std::find_if(begin(cont), end(cont), pred);
}
template<class Container>
@ -77,13 +81,15 @@ namespace vcpkg::Util
}
template<class Container, class Pred>
auto find_if_not(const Container& cont, Pred pred)
auto find_if_not(Container&& cont, Pred pred)
{
return std::find_if_not(cont.cbegin(), cont.cend(), pred);
using std::begin;
using std::end;
return std::find_if_not(begin(cont), end(cont), pred);
}
template<class K, class V, class Container, class Func>
void group_by(const Container& cont, std::map<K, std::vector<const V*>>* output, Func f)
void group_by(const Container& cont, _Inout_ std::map<K, std::vector<const V*>>* output, Func&& f)
{
for (const V& element : cont)
{
@ -92,6 +98,12 @@ namespace vcpkg::Util
}
}
template<class AssocContainer, class K = std::decay_t<decltype(begin(std::declval<AssocContainer>())->first)>>
std::vector<K> extract_keys(AssocContainer&& input_map)
{
return fmap(input_map, [](auto&& p) { return p.first; });
}
struct MoveOnlyBase
{
MoveOnlyBase() = default;

View File

@ -1,7 +1,8 @@
#pragma once
#include "PackageSpec.h"
#include "SourceParagraph.h"
#include <vcpkg/packagespec.h>
#include <vcpkg/sourceparagraph.h>
#include <unordered_map>
namespace vcpkg

View File

@ -1,11 +1,14 @@
#pragma once
#include "CStringView.h"
#include "PackageSpec.h"
#include "StatusParagraphs.h"
#include "VcpkgPaths.h"
#include "vcpkg_Files.h"
#include "vcpkg_optional.h"
#include <vcpkg/packagespec.h>
#include <vcpkg/statusparagraphs.h>
#include <vcpkg/triplet.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>
#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/optional.h>
#include <array>
#include <map>
@ -13,6 +16,16 @@
namespace vcpkg::Build
{
namespace Command
{
void perform_and_exit(const FullPackageSpec& full_spec,
const fs::path& port_dir,
const std::unordered_set<std::string>& options,
const VcpkgPaths& paths);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
enum class UseHeadVersion
{
NO = 0,

View File

@ -0,0 +1,134 @@
#pragma once
#include <vcpkg/build.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>
#include <array>
namespace vcpkg::Commands
{
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);
namespace BuildExternal
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace CI
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace Env
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace Create
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Edit
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace DependInfo
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Search
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace List
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Owns
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Cache
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Import
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Integrate
{
extern const char* const INTEGRATE_COMMAND_HELPSTRING;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace PortsDiff
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Autocomplete
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Version
{
const std::string& version();
void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths);
void perform_and_exit(const VcpkgCmdArguments& args);
}
namespace Contact
{
const std::string& email();
void perform_and_exit(const VcpkgCmdArguments& args);
}
namespace Hash
{
void perform_and_exit(const VcpkgCmdArguments& args);
}
template<class T>
struct PackageNameAndFunction
{
std::string name;
T function;
};
Span<const PackageNameAndFunction<CommandTypeA>> get_available_commands_type_a();
Span<const PackageNameAndFunction<CommandTypeB>> get_available_commands_type_b();
Span<const PackageNameAndFunction<CommandTypeC>> get_available_commands_type_c();
template<typename T>
T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands)
{
for (const PackageNameAndFunction<T>& cmd : available_commands)
{
if (cmd.name == command_name)
{
return cmd.function;
}
}
// not found
return nullptr;
}
}

View File

@ -1,10 +1,12 @@
#pragma once
#include "PackageSpec.h"
#include "StatusParagraphs.h"
#include "VcpkgPaths.h"
#include "vcpkg_Graphs.h"
#include "vcpkg_Util.h"
#include "vcpkg_optional.h"
#include <vcpkg/base/graphs.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/util.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkgpaths.h>
#include <vector>
namespace vcpkg::Dependencies

View File

@ -0,0 +1,10 @@
#pragma once
#include <vcpkg/vcpkgpaths.h>
namespace vcpkg::Export
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
void export_integration_files(const fs::path& raw_exported_dir_path, const VcpkgPaths& paths);
}

View File

@ -1,13 +1,14 @@
#pragma once
#include "VcpkgPaths.h"
#include "vcpkg_Dependencies.h"
#include "vcpkg_Files.h"
#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgpaths.h>
#include <vcpkg/base/files.h>
#include <string>
#include <vector>
namespace vcpkg::Commands::Export::IFW
namespace vcpkg::Export::IFW
{
struct Options
{

View File

@ -1,15 +1,15 @@
#pragma once
#include <atomic>
#include <vcpkg/base/chrono.h>
#include <vcpkg/base/util.h>
#include "vcpkg_Chrono.h"
#include "vcpkg_Util.h"
#include <atomic>
namespace vcpkg
{
struct GlobalState
{
static Util::LockGuarded<ElapsedTime> timer;
static Util::LockGuarded<Chrono::ElapsedTime> timer;
static std::atomic<bool> debugging;
static std::atomic<bool> feature_packages;

View File

@ -0,0 +1,19 @@
#pragma once
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>
#include <string>
namespace vcpkg::Help
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
void help_topic_valid_triplet(const VcpkgPaths& paths);
void print_usage();
void print_example(const std::string& command_and_arguments);
std::string create_example_string(const std::string& command_and_arguments);
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "PackageSpec.h"
#include <vcpkg/packagespec.h>
namespace vcpkg::Input
{

View File

@ -0,0 +1,69 @@
#pragma once
#include <vcpkg/build.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>
#include <vector>
namespace vcpkg::Install
{
enum class KeepGoing
{
NO = 0,
YES
};
inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; }
enum class PrintSummary
{
NO = 0,
YES
};
inline PrintSummary to_print_summary(const bool value) { return value ? PrintSummary::YES : PrintSummary::NO; }
struct InstallDir
{
static InstallDir from_destination_root(const fs::path& destination_root,
const std::string& destination_subdirectory,
const fs::path& listfile);
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;
};
Build::BuildResult perform_install_plan_action(const VcpkgPaths& paths,
const Dependencies::InstallPlanAction& action,
const Build::BuildPackageOptions& install_plan_options,
StatusParagraphs& status_db);
enum class InstallResult
{
FILE_CONFLICTS,
SUCCESS,
};
void install_files_and_write_listfile(Files::Filesystem& fs, const fs::path& source_dir, const InstallDir& dirs);
InstallResult install_package(const VcpkgPaths& paths,
const BinaryControlFile& binary_paragraph,
StatusParagraphs* status_db);
void perform_and_exit_ex(const std::vector<Dependencies::AnyAction>& action_plan,
const Build::BuildPackageOptions& install_plan_options,
const KeepGoing keep_going,
const PrintSummary print_summary,
const VcpkgPaths& paths,
StatusParagraphs& status_db);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}

View File

@ -1,8 +1,8 @@
#pragma once
#include <string>
#include <vcpkg/base/util.h>
#include "vcpkg_Util.h"
#include <string>
namespace vcpkg::Metrics
{

View File

@ -1,8 +1,8 @@
#pragma once
#include "PackageSpecParseResult.h"
#include "Triplet.h"
#include "vcpkg_expected.h"
#include <vcpkg/base/expected.h>
#include <vcpkg/packagespecparseresult.h>
#include <vcpkg/triplet.h>
namespace vcpkg
{

View File

@ -1,6 +1,7 @@
#pragma once
#include "vcpkg_expected.h"
#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/expected.h>
namespace vcpkg
{

View File

@ -1,4 +1,5 @@
#pragma once
#include <system_error>
namespace vcpkg

View File

@ -1,13 +1,13 @@
#pragma once
#include <map>
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/parse.h>
#include <vcpkg/vcpkgpaths.h>
#include <vcpkg/versiont.h>
#include "BinaryParagraph.h"
#include "VcpkgPaths.h"
#include "VersionT.h"
#include "filesystem_fs.h"
#include "vcpkg_Parse.h"
#include "vcpkg_expected.h"
#include <vcpkg/base/expected.h>
#include <map>
namespace vcpkg::Paragraphs
{

View File

@ -1,11 +1,11 @@
#pragma once
#include <vcpkg/base/expected.h>
#include <vcpkg/base/optional.h>
#include <memory>
#include <unordered_map>
#include "vcpkg_expected.h"
#include "vcpkg_optional.h"
namespace vcpkg::Parse
{
struct ParseControlErrorInfo

View File

@ -1,6 +1,8 @@
#pragma once
#include "CStringView.h"
#include "vcpkg_Build.h"
#include <vcpkg/base/cstringview.h>
#include <vcpkg/build.h>
#include <array>
#include <regex>

View File

@ -1,7 +1,8 @@
#pragma once
#include "PackageSpec.h"
#include "VcpkgPaths.h"
#include "vcpkg_Build.h"
#include <vcpkg/build.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/vcpkgpaths.h>
namespace vcpkg::PostBuildLint
{

View File

@ -0,0 +1,24 @@
#pragma once
#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>
namespace vcpkg::Remove
{
enum class Purge
{
NO = 0,
YES
};
inline Purge to_purge(const bool value) { return value ? Purge::YES : Purge::NO; }
void perform_remove_plan_action(const VcpkgPaths& paths,
const Dependencies::RemovePlanAction& action,
const Purge purge,
StatusParagraphs& status_db);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db);
}

View File

@ -1,10 +1,11 @@
#pragma once
#include "PackageSpec.h"
#include "Span.h"
#include "vcpkg_Parse.h"
#include "vcpkg_System.h"
#include "vcpkg_expected.h"
#include <vcpkg/packagespec.h>
#include <vcpkg/parse.h>
#include <vcpkg/base/Span.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/system.h>
#include <string>
#include <vector>

View File

@ -1,6 +1,7 @@
#pragma once
#include "BinaryParagraph.h"
#include <vcpkg/binaryparagraph.h>
#include <unordered_map>
namespace vcpkg

View File

@ -1,5 +1,6 @@
#pragma once
#include "StatusParagraph.h"
#include <vcpkg/statusparagraph.h>
#include <iterator>
#include <memory>

View File

@ -0,0 +1,21 @@
#pragma once
#include <vcpkg/packagespec.h>
#include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>
#include <vcpkg/versiont.h>
namespace vcpkg::Update
{
struct OutdatedPackage
{
static bool compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right);
PackageSpec spec;
VersionDiff version_diff;
};
std::vector<OutdatedPackage> find_outdated_packages(const VcpkgPaths& paths, const StatusParagraphs& status_db);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "vcpkg_optional.h"
#include <vcpkg/base/optional.h>
#include <memory>
#include <unordered_map>
#include <unordered_set>

View File

@ -1,8 +1,8 @@
#pragma once
#include "SortedVector.h"
#include "StatusParagraphs.h"
#include "VcpkgPaths.h"
#include <vcpkg/base/sortedvector.h>
#include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkgpaths.h>
namespace vcpkg
{

View File

@ -1,10 +1,11 @@
#pragma once
#include "BinaryParagraph.h"
#include "Lazy.h"
#include "PackageSpec.h"
#include "filesystem_fs.h"
#include "vcpkg_Files.h"
#include "vcpkg_expected.h"
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/base/Lazy.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/files.h>
namespace vcpkg
{

View File

@ -1,258 +0,0 @@
#pragma once
#include "StatusParagraphs.h"
#include "VcpkgCmdArguments.h"
#include "VcpkgPaths.h"
#include "VersionT.h"
#include "vcpkg_Build.h"
#include "vcpkg_Dependencies.h"
#include <array>
namespace vcpkg::Commands
{
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);
namespace BuildCommand
{
void perform_and_exit(const FullPackageSpec& full_spec,
const fs::path& port_dir,
const std::unordered_set<std::string>& options,
const VcpkgPaths& paths);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace BuildExternal
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace Install
{
enum class KeepGoing
{
NO = 0,
YES
};
inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; }
enum class PrintSummary
{
NO = 0,
YES
};
inline PrintSummary to_print_summary(const bool value) { return value ? PrintSummary::YES : PrintSummary::NO; }
struct InstallDir
{
static InstallDir from_destination_root(const fs::path& destination_root,
const std::string& destination_subdirectory,
const fs::path& listfile);
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;
};
Build::BuildResult perform_install_plan_action(const VcpkgPaths& paths,
const Dependencies::InstallPlanAction& action,
const Build::BuildPackageOptions& install_plan_options,
StatusParagraphs& status_db);
enum class InstallResult
{
FILE_CONFLICTS,
SUCCESS,
};
void install_files_and_write_listfile(Files::Filesystem& fs,
const fs::path& source_dir,
const InstallDir& dirs);
InstallResult install_package(const VcpkgPaths& paths,
const BinaryControlFile& binary_paragraph,
StatusParagraphs* status_db);
void perform_and_exit(const std::vector<Dependencies::AnyAction>& action_plan,
const Build::BuildPackageOptions& install_plan_options,
const KeepGoing keep_going,
const PrintSummary print_summary,
const VcpkgPaths& paths,
StatusParagraphs& status_db);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace Export
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace CI
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace Remove
{
enum class Purge
{
NO = 0,
YES
};
inline Purge to_purge(const bool value) { return value ? Purge::YES : Purge::NO; }
void perform_remove_plan_action(const VcpkgPaths& paths,
const Dependencies::RemovePlanAction& action,
const Purge purge,
StatusParagraphs& status_db);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db);
}
namespace Update
{
struct OutdatedPackage
{
static bool compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right);
PackageSpec spec;
VersionDiff version_diff;
};
std::vector<OutdatedPackage> find_outdated_packages(const VcpkgPaths& paths, const StatusParagraphs& status_db);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Env
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet);
}
namespace Create
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Edit
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace DependInfo
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Search
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace List
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Owns
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Cache
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Import
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Integrate
{
extern const char* const INTEGRATE_COMMAND_HELPSTRING;
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace PortsDiff
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Autocomplete
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
namespace Help
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
void help_topic_valid_triplet(const VcpkgPaths& paths);
void print_usage();
void print_example(const std::string& command_and_arguments);
std::string create_example_string(const std::string& command_and_arguments);
}
namespace Version
{
const std::string& version();
void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths);
void perform_and_exit(const VcpkgCmdArguments& args);
}
namespace Contact
{
const std::string& email();
void perform_and_exit(const VcpkgCmdArguments& args);
}
namespace Hash
{
void perform_and_exit(const VcpkgCmdArguments& args);
}
template<class T>
struct PackageNameAndFunction
{
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();
template<typename T>
T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands)
{
for (const PackageNameAndFunction<T>& cmd : available_commands)
{
if (cmd.name == command_name)
{
return cmd.function;
}
}
// not found
return nullptr;
}
}

View File

@ -1,8 +0,0 @@
#pragma once
#include "VcpkgPaths.h"
namespace vcpkg::Commands::Export
{
void export_integration_files(const fs::path& raw_exported_dir_path, const VcpkgPaths& paths);
}

View File

@ -1,30 +0,0 @@
#pragma once
#include <map>
#include <unordered_map>
#include <unordered_set>
namespace vcpkg::Maps
{
template<typename K, typename V>
std::vector<K> extract_keys(const std::unordered_map<K, V>& input_map)
{
std::vector<K> key_set;
for (auto const& element : input_map)
{
key_set.push_back(element.first);
}
return key_set;
}
template<typename K, typename V>
std::vector<K> extract_keys(const std::map<K, V>& input_map)
{
std::vector<K> key_set;
for (auto const& element : input_map)
{
key_set.push_back(element.first);
}
return key_set;
}
}

View File

@ -1,102 +0,0 @@
#include "pch.h"
#include "Paragraphs.h"
#include "PostBuildLint.h"
#include "StatusParagraphs.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Dependencies.h"
#include "vcpkg_Enums.h"
#include "vcpkg_Input.h"
#include "vcpkg_System.h"
#include "vcpkglib.h"
using vcpkg::Build::BuildResult;
using vcpkg::Parse::ParseControlErrorInfo;
using vcpkg::Parse::ParseExpected;
namespace vcpkg::Commands::BuildCommand
{
using Dependencies::InstallPlanAction;
using Dependencies::InstallPlanType;
static const std::string OPTION_CHECKS_ONLY = "--checks-only";
void perform_and_exit(const FullPackageSpec& full_spec,
const fs::path& port_dir,
const std::unordered_set<std::string>& options,
const VcpkgPaths& paths)
{
const PackageSpec& spec = full_spec.package_spec;
if (options.find(OPTION_CHECKS_ONLY) != options.end())
{
const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet());
const auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec));
const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info);
Checks::check_exit(VCPKG_LINE_INFO, error_count == 0);
Checks::exit_success(VCPKG_LINE_INFO);
}
const ParseExpected<SourceControlFile> source_control_file =
Paragraphs::try_load_port(paths.get_filesystem(), port_dir);
if (!source_control_file.has_value())
{
print_error_message(source_control_file.error());
Checks::exit_fail(VCPKG_LINE_INFO);
}
for (const std::string& str : full_spec.features)
{
System::println("%s \n", str);
}
const auto& scf = source_control_file.value_or_exit(VCPKG_LINE_INFO);
Checks::check_exit(VCPKG_LINE_INFO,
spec.name() == scf->core_paragraph->name,
"The Name: field inside the CONTROL does not match the port directory: '%s' != '%s'",
scf->core_paragraph->name,
spec.name());
const StatusParagraphs status_db = database_load_check(paths);
const Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO, Build::AllowDownloads::YES};
const Build::BuildPackageConfig build_config{
*scf->core_paragraph, spec.triplet(), paths.port_dir(spec), build_package_options};
const auto result = Build::build_package(paths, build_config, status_db);
if (result.code == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES)
{
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 auto& p : result.unmet_dependencies)
{
System::println(" %s", p);
}
System::println();
Checks::exit_fail(VCPKG_LINE_INFO);
}
if (result.code != BuildResult::SUCCEEDED)
{
System::println(System::Color::error, Build::create_error_message(result.code, spec));
System::println(Build::create_user_troubleshooting_message(spec));
Checks::exit_fail(VCPKG_LINE_INFO);
}
Checks::exit_success(VCPKG_LINE_INFO);
}
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string EXAMPLE = Commands::Help::create_example_string("build zlib:x64-windows");
// Build only takes a single package and all dependencies must already be installed
args.check_exact_arg_count(1, EXAMPLE);
const std::string command_argument = args.command_arguments.at(0);
const FullPackageSpec spec = Input::check_and_get_full_package_spec(command_argument, default_triplet, EXAMPLE);
Input::check_triplet(spec.package_spec.triplet(), paths);
const std::unordered_set<std::string> options =
args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY});
perform_and_exit(spec, paths.port_dir(spec.package_spec), options, paths);
}
}

View File

@ -1,5 +1,5 @@
#include "CppUnitTest.h"
#include "VcpkgCmdArguments.h"
#include <CppUnitTest.h>
#include <vcpkg/vcpkgcmdarguments.h>
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")

View File

@ -1,6 +1,6 @@
#include "CppUnitTest.h"
#include "SourceParagraph.h"
#include "Triplet.h"
#include <CppUnitTest.h>
#include <vcpkg/sourceparagraph.h>
#include <vcpkg/triplet.h>
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")

View File

@ -1,6 +1,7 @@
#include "CppUnitTest.h"
#include "vcpkg_Dependencies.h"
#include "vcpkg_Util.h"
#include <CppUnitTest.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/base/util.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;

View File

@ -1,7 +1,8 @@
#include "BinaryParagraph.h"
#include "CppUnitTest.h"
#include "Paragraphs.h"
#include "vcpkg_Strings.h"
#include <CppUnitTest.h>
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/base/strings.h>
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")

View File

@ -1,7 +1,8 @@
#include "BinaryParagraph.h"
#include "CppUnitTest.h"
#include "Paragraphs.h"
#include "vcpkg_Strings.h"
#include <CppUnitTest.h>
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/base/strings.h>
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")

View File

@ -1,16 +1,18 @@
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include "Paragraphs.h"
#include "metrics.h"
#include "vcpkg_Chrono.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Files.h"
#include "vcpkg_GlobalState.h"
#include "vcpkg_Input.h"
#include "vcpkg_Strings.h"
#include "vcpkg_System.h"
#include "vcpkglib.h"
#include <vcpkg/base/chrono.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/strings.h>
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>
#include <vcpkg/metrics.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/vcpkglib.h>
#pragma warning(push)
#pragma warning(disable : 4768)
#include <Shlobj.h>
@ -19,12 +21,15 @@
#include <fstream>
#include <memory>
#pragma comment(lib, "ole32")
#pragma comment(lib, "shell32")
using namespace vcpkg;
void invalid_command(const std::string& cmd)
{
System::println(System::Color::error, "invalid command: %s", cmd);
Commands::Help::print_usage();
Help::print_usage();
Checks::exit_fail(VCPKG_LINE_INFO);
}
@ -33,13 +38,26 @@ static void inner(const VcpkgCmdArguments& args)
Metrics::g_metrics.lock()->track_property("command", args.command);
if (args.command.empty())
{
Commands::Help::print_usage();
Help::print_usage();
Checks::exit_fail(VCPKG_LINE_INFO);
}
if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_c()))
static const auto find_command = [&](auto&& commands) {
auto it = Util::find_if(commands, [&](auto&& commandc) {
return Strings::case_insensitive_ascii_compare(commandc.name, args.command);
});
using std::end;
if (it != end(commands))
{
return command_function(args);
return &*it;
}
else
return static_cast<decltype(&*it)>(nullptr);
};
if (const auto command_function = find_command(Commands::get_available_commands_type_c()))
{
return command_function->function(args);
}
fs::path vcpkg_root_dir;
@ -74,9 +92,9 @@ static void inner(const VcpkgCmdArguments& args)
Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Changing the working dir failed");
Commands::Version::warn_if_vcpkg_version_mismatch(paths);
if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_b()))
if (const auto command_function = find_command(Commands::get_available_commands_type_b()))
{
return command_function(args, paths);
return command_function->function(args, paths);
}
Triplet default_triplet;
@ -100,9 +118,9 @@ static void inner(const VcpkgCmdArguments& args)
Input::check_triplet(default_triplet, paths);
if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_a()))
if (const auto command_function = find_command(Commands::get_available_commands_type_a()))
{
return command_function(args, paths, default_triplet);
return command_function->function(args, paths, default_triplet);
}
return invalid_command(args.command);
@ -202,7 +220,7 @@ int wmain(const int argc, const wchar_t* const* const argv)
SetConsoleCP(65001);
SetConsoleOutputCP(65001);
*GlobalState::timer.lock() = ElapsedTime::create_started();
*GlobalState::timer.lock() = Chrono::ElapsedTime::create_started();
const std::string trimmed_command_line = trim_path_from_command_line(Strings::to_utf8(GetCommandLineW()));

View File

@ -1,10 +1,10 @@
#include "pch.h"
#include "metrics.h"
#include "vcpkg_Checks.h"
#include "vcpkg_GlobalState.h"
#include "vcpkg_System.h"
#include "vcpkglib.h"
#include <vcpkg/globalstate.h>
#include <vcpkg/metrics.h>
#include <vcpkg/base/checks.h>
#include <vcpkg/base/system.h>
namespace vcpkg::Checks
{

View File

@ -1,9 +1,9 @@
#include "pch.h"
#include "vcpkg_Checks.h"
#include "vcpkg_Chrono.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/base/chrono.h>
namespace vcpkg
namespace vcpkg::Chrono
{
static std::string format_time_userfriendly(const std::chrono::nanoseconds& nanos)
{

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "coff_file_reader.h"
#include "vcpkg_Checks.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/base/cofffilereader.h>
using namespace std;

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "vcpkg_Checks.h"
#include "vcpkg_Enums.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/base/enums.h>
namespace vcpkg::Enums
{

View File

@ -1,9 +1,8 @@
#include "pch.h"
#include "vcpkg_Files.h"
#include "vcpkg_System.h"
#include "vcpkg_Util.h"
#include <thread>
#include <vcpkg/base/files.h>
#include <vcpkg/base/system.h>
#include <vcpkg/base/util.h>
namespace vcpkg::Files
{

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "LineInfo.h"
#include "vcpkg_Strings.h"
#include <vcpkg/base/lineinfo.h>
#include <vcpkg/base/strings.h>
namespace vcpkg
{

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "MachineType.h"
#include "vcpkg_Checks.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/base/machinetype.h>
namespace vcpkg
{

View File

@ -1,8 +1,8 @@
#include "pch.h"
#include "vcpkg_Checks.h"
#include "vcpkg_Strings.h"
#include "vcpkg_Util.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/base/strings.h>
#include <vcpkg/base/util.h>
namespace vcpkg::Strings::details
{
@ -104,9 +104,9 @@ namespace vcpkg::Strings
return case_insensitive_ascii_find(s, pattern) != s.end();
}
int case_insensitive_ascii_compare(const CStringView left, const CStringView right)
bool case_insensitive_ascii_compare(const CStringView left, const CStringView right)
{
return _stricmp(left.c_str(), right.c_str());
return _stricmp(left.c_str(), right.c_str()) == 0;
}
std::string ascii_to_lowercase(const std::string& input)

View File

@ -1,9 +1,10 @@
#include "pch.h"
#include "vcpkg_Checks.h"
#include "vcpkg_GlobalState.h"
#include "vcpkg_System.h"
#include "vcpkglib.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/base/system.h>
#include <vcpkg/globalstate.h>
#pragma comment(lib, "Advapi32")
namespace vcpkg::System
{
@ -26,11 +27,11 @@ namespace vcpkg::System
Optional<CPUArchitecture> to_cpu_architecture(CStringView arch)
{
if (Strings::case_insensitive_ascii_compare(arch, "x86") == 0) return CPUArchitecture::X86;
if (Strings::case_insensitive_ascii_compare(arch, "x64") == 0) return CPUArchitecture::X64;
if (Strings::case_insensitive_ascii_compare(arch, "amd64") == 0) return CPUArchitecture::X64;
if (Strings::case_insensitive_ascii_compare(arch, "arm") == 0) return CPUArchitecture::ARM;
if (Strings::case_insensitive_ascii_compare(arch, "arm64") == 0) return CPUArchitecture::ARM64;
if (Strings::case_insensitive_ascii_compare(arch, "x86")) return CPUArchitecture::X86;
if (Strings::case_insensitive_ascii_compare(arch, "x64")) return CPUArchitecture::X64;
if (Strings::case_insensitive_ascii_compare(arch, "amd64")) return CPUArchitecture::X64;
if (Strings::case_insensitive_ascii_compare(arch, "arm")) return CPUArchitecture::ARM;
if (Strings::case_insensitive_ascii_compare(arch, "arm64")) return CPUArchitecture::ARM64;
return nullopt;
}

View File

@ -1,8 +1,8 @@
#include "pch.h"
#include "BinaryParagraph.h"
#include "vcpkg_Checks.h"
#include "vcpkg_Parse.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/parse.h>
namespace vcpkg
{

View File

@ -1,20 +1,147 @@
#include "pch.h"
#include "Paragraphs.h"
#include "PostBuildLint.h"
#include "metrics.h"
#include "vcpkg_Build.h"
#include "vcpkg_Checks.h"
#include "vcpkg_Chrono.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Enums.h"
#include "vcpkg_GlobalState.h"
#include "vcpkg_System.h"
#include "vcpkg_optional.h"
#include "vcpkglib.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/base/chrono.h>
#include <vcpkg/base/enums.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/system.h>
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>
#include <vcpkg/metrics.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/postbuildlint.h>
#include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkglib.h>
using vcpkg::Build::BuildResult;
using vcpkg::Parse::ParseControlErrorInfo;
using vcpkg::Parse::ParseExpected;
namespace vcpkg::Build::Command
{
using Dependencies::InstallPlanAction;
using Dependencies::InstallPlanType;
static const std::string OPTION_CHECKS_ONLY = "--checks-only";
void perform_and_exit(const FullPackageSpec& full_spec,
const fs::path& port_dir,
const std::unordered_set<std::string>& options,
const VcpkgPaths& paths)
{
const PackageSpec& spec = full_spec.package_spec;
if (options.find(OPTION_CHECKS_ONLY) != options.end())
{
const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet());
const auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec));
const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info);
Checks::check_exit(VCPKG_LINE_INFO, error_count == 0);
Checks::exit_success(VCPKG_LINE_INFO);
}
const ParseExpected<SourceControlFile> source_control_file =
Paragraphs::try_load_port(paths.get_filesystem(), port_dir);
if (!source_control_file.has_value())
{
print_error_message(source_control_file.error());
Checks::exit_fail(VCPKG_LINE_INFO);
}
for (const std::string& str : full_spec.features)
{
System::println("%s \n", str);
}
const auto& scf = source_control_file.value_or_exit(VCPKG_LINE_INFO);
Checks::check_exit(VCPKG_LINE_INFO,
spec.name() == scf->core_paragraph->name,
"The Name: field inside the CONTROL does not match the port directory: '%s' != '%s'",
scf->core_paragraph->name,
spec.name());
const StatusParagraphs status_db = database_load_check(paths);
const Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO, Build::AllowDownloads::YES};
const Build::BuildPackageConfig build_config{
*scf->core_paragraph, spec.triplet(), paths.port_dir(spec), build_package_options};
const auto result = Build::build_package(paths, build_config, status_db);
if (result.code == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES)
{
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 auto& p : result.unmet_dependencies)
{
System::println(" %s", p);
}
System::println();
Checks::exit_fail(VCPKG_LINE_INFO);
}
if (result.code != BuildResult::SUCCEEDED)
{
System::println(System::Color::error, Build::create_error_message(result.code, spec));
System::println(Build::create_user_troubleshooting_message(spec));
Checks::exit_fail(VCPKG_LINE_INFO);
}
Checks::exit_success(VCPKG_LINE_INFO);
}
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string EXAMPLE = Help::create_example_string("build zlib:x64-windows");
// Build only takes a single package and all dependencies must already be installed
args.check_exact_arg_count(1, EXAMPLE);
const std::string command_argument = args.command_arguments.at(0);
const FullPackageSpec spec = Input::check_and_get_full_package_spec(command_argument, default_triplet, EXAMPLE);
Input::check_triplet(spec.package_spec.triplet(), paths);
const std::unordered_set<std::string> options =
args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY});
perform_and_exit(spec, paths.port_dir(spec.package_spec), options, paths);
}
}
namespace vcpkg::Build
{
static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage";
static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs";
static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT";
static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder";
static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt";
const std::string& to_string(BuildPolicy policy)
{
switch (policy)
{
case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE;
case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS;
case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT;
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER;
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT;
default: Checks::unreachable(VCPKG_LINE_INFO);
}
}
CStringView to_cmake_variable(BuildPolicy policy)
{
switch (policy)
{
case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE";
case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS";
case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT";
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER";
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT";
default: Checks::unreachable(VCPKG_LINE_INFO);
}
}
Optional<LinkageType> to_linkage_type(const std::string& str)
{
if (str == "dynamic") return LinkageType::DYNAMIC;
@ -174,7 +301,7 @@ namespace vcpkg::Build
const std::wstring command = Strings::wformat(LR"(%s && %s)", cmd_set_environment, cmd_launch_cmake);
const ElapsedTime timer = ElapsedTime::create_started();
const auto timer = Chrono::ElapsedTime::create_started();
const int return_code = System::cmd_execute_clean(command);
const auto buildtimeus = timer.microseconds();

View File

@ -1,11 +1,10 @@
#include "pch.h"
#include "Paragraphs.h"
#include "metrics.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkglib.h"
#include <regex>
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
#include <vcpkg/metrics.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/vcpkglib.h>
namespace vcpkg::Commands::Autocomplete
{

View File

@ -1,14 +1,16 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Input.h"
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>
namespace vcpkg::Commands::BuildExternal
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string EXAMPLE =
Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)");
Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)");
args.check_exact_arg_count(2, EXAMPLE);
const FullPackageSpec spec =
Input::check_and_get_full_package_spec(args.command_arguments.at(0), default_triplet, EXAMPLE);
@ -16,6 +18,6 @@ namespace vcpkg::Commands::BuildExternal
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({});
const fs::path port_dir = args.command_arguments.at(1);
BuildCommand::perform_and_exit(spec, port_dir, options, paths);
Build::Command::perform_and_exit(spec, port_dir, options, paths);
}
}

View File

@ -1,10 +1,11 @@
#include "pch.h"
#include "BinaryParagraph.h"
#include "Paragraphs.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Files.h"
#include "vcpkg_System.h"
#include <vcpkg/base/files.h>
#include <vcpkg/base/system.h>
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
namespace vcpkg::Commands::Cache
{
@ -29,7 +30,7 @@ namespace vcpkg::Commands::Cache
{
static const std::string EXAMPLE = Strings::format(
"The argument should be a substring to search for, or no argument to display all cached libraries.\n%s",
Commands::Help::create_example_string("cache png"));
Help::create_example_string("cache png"));
args.check_max_arg_count(1, EXAMPLE);
args.check_and_get_optional_command_arguments({});

View File

@ -1,15 +1,17 @@
#include "pch.h"
#include "Paragraphs.h"
#include "vcpkg_Build.h"
#include "vcpkg_Chrono.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Dependencies.h"
#include "vcpkg_Files.h"
#include "vcpkg_Input.h"
#include "vcpkg_System.h"
#include "vcpkg_Util.h"
#include "vcpkglib.h"
#include <vcpkg/base/chrono.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/system.h>
#include <vcpkg/base/util.h>
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>
#include <vcpkg/install.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/vcpkglib.h>
namespace vcpkg::Commands::CI
{
@ -30,7 +32,7 @@ namespace vcpkg::Commands::CI
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string EXAMPLE = Commands::Help::create_example_string("ci x64-windows");
static const std::string EXAMPLE = Help::create_example_string("ci x64-windows");
args.check_max_arg_count(1, EXAMPLE);
const Triplet triplet = args.command_arguments.size() == 1
? Triplet::from_canonical_name(args.command_arguments.at(0))
@ -52,7 +54,7 @@ namespace vcpkg::Commands::CI
return Dependencies::AnyAction(std::move(install_action));
});
Install::perform_and_exit(
Install::perform_and_exit_ex(
action_plan, install_plan_options, Install::KeepGoing::YES, Install::PrintSummary::YES, paths, status_db);
Checks::exit_success(VCPKG_LINE_INFO);

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
namespace vcpkg::Commands::Contact
{

View File

@ -1,16 +1,22 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
#include <vcpkg/export.h>
#include <vcpkg/help.h>
#include <vcpkg/install.h>
#include <vcpkg/remove.h>
#include <vcpkg/update.h>
namespace vcpkg::Commands
{
const std::vector<PackageNameAndFunction<CommandTypeA>>& get_available_commands_type_a()
Span<const PackageNameAndFunction<CommandTypeA>> get_available_commands_type_a()
{
static std::vector<PackageNameAndFunction<CommandTypeA>> t = {
{"install", &Install::perform_and_exit},
{"ci", &CI::perform_and_exit},
{"remove", &Remove::perform_and_exit},
{"build", &BuildCommand::perform_and_exit},
{"build", &Build::Command::perform_and_exit},
{"env", &Env::perform_and_exit},
{"build-external", &BuildExternal::perform_and_exit},
{"export", &Export::perform_and_exit},
@ -18,7 +24,7 @@ namespace vcpkg::Commands
return t;
}
const std::vector<PackageNameAndFunction<CommandTypeB>>& get_available_commands_type_b()
Span<const PackageNameAndFunction<CommandTypeB>> get_available_commands_type_b()
{
static std::vector<PackageNameAndFunction<CommandTypeB>> t = {
{"/?", &Help::perform_and_exit},
@ -38,7 +44,7 @@ namespace vcpkg::Commands
return t;
}
const std::vector<PackageNameAndFunction<CommandTypeC>>& get_available_commands_type_c()
Span<const PackageNameAndFunction<CommandTypeC>> get_available_commands_type_c()
{
static std::vector<PackageNameAndFunction<CommandTypeC>> t = {
{"version", &Version::perform_and_exit},

View File

@ -1,15 +1,16 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Files.h"
#include "vcpkg_System.h"
#include "vcpkglib.h"
#include <vcpkg/base/files.h>
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/vcpkglib.h>
namespace vcpkg::Commands::Create
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string EXAMPLE = Commands::Help::create_example_string(
static const std::string EXAMPLE = Help::create_example_string(
R"###(create zlib2 http://zlib.net/zlib1211.zip "zlib1211-2.zip")###");
args.check_max_arg_count(3, EXAMPLE);
args.check_min_arg_count(2, EXAMPLE);

View File

@ -1,16 +1,17 @@
#include "pch.h"
#include "Paragraphs.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Strings.h"
#include "vcpkg_System.h"
#include "vcpkg_Util.h"
#include <vcpkg/base/strings.h>
#include <vcpkg/base/system.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
namespace vcpkg::Commands::DependInfo
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string EXAMPLE = Commands::Help::create_example_string(R"###(depend-info [pat])###");
static const std::string EXAMPLE = Help::create_example_string(R"###(depend-info [pat])###");
args.check_max_arg_count(1, EXAMPLE);
args.check_and_get_optional_command_arguments({});

View File

@ -1,8 +1,9 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Input.h"
#include "vcpkg_System.h"
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>
namespace vcpkg::Commands::Edit
{
@ -38,7 +39,7 @@ namespace vcpkg::Commands::Edit
auto& fs = paths.get_filesystem();
static const std::string EXAMPLE = Commands::Help::create_example_string("edit zlib");
static const std::string EXAMPLE = Help::create_example_string("edit zlib");
args.check_exact_arg_count(1, EXAMPLE);
const std::unordered_set<std::string> options =
args.check_and_get_optional_command_arguments({OPTION_BUILDTREES});

View File

@ -1,14 +1,15 @@
#include "pch.h"
#include "vcpkg_Build.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include <vcpkg/base/system.h>
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
namespace vcpkg::Commands::Env
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet)
{
static const std::string EXAMPLE = Commands::Help::create_example_string(R"(env --Triplet x64-windows)");
static const std::string EXAMPLE = Help::create_example_string(R"(env --triplet x64-windows)");
args.check_exact_arg_count(0, EXAMPLE);
args.check_and_get_optional_command_arguments({});

View File

@ -1,10 +1,11 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Commands_Export.h"
#include "vcpkg_Commands_Export_IFW.h"
#include <vcpkg/commands.h>
#include <vcpkg/export.h>
#include <vcpkg/export.ifw.h>
#include <vcpkg/install.h>
namespace vcpkg::Commands::Export::IFW
namespace vcpkg::Export::IFW
{
using Dependencies::ExportPlanAction;
using Dependencies::ExportPlanType;

View File

@ -1,8 +1,9 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkg_Util.h"
#include <vcpkg/base/system.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
namespace vcpkg::Commands::Hash
{
@ -34,9 +35,8 @@ namespace vcpkg::Commands::Hash
void perform_and_exit(const VcpkgCmdArguments& args)
{
static const std::string EXAMPLE =
Strings::format("The argument should be a file path\n%s",
Commands::Help::create_example_string("hash boost_1_62_0.tar.bz2"));
static const std::string EXAMPLE = Strings::format("The argument should be a file path\n%s",
Help::create_example_string("hash boost_1_62_0.tar.bz2"));
args.check_min_arg_count(1, EXAMPLE);
args.check_max_arg_count(2, EXAMPLE);
args.check_and_get_optional_command_arguments({});

View File

@ -1,9 +1,10 @@
#include "pch.h"
#include "Paragraphs.h"
#include "StatusParagraph.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Files.h"
#include <vcpkg/base/files.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/statusparagraph.h>
namespace vcpkg::Commands::Import
{
@ -93,7 +94,7 @@ namespace vcpkg::Commands::Import
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string EXAMPLE = Commands::Help::create_example_string(
static const std::string EXAMPLE = Help::create_example_string(
R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)");
args.check_exact_arg_count(3, EXAMPLE);
args.check_and_get_optional_command_arguments({});

View File

@ -1,10 +1,10 @@
#include "pch.h"
#include "vcpkg_Checks.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Files.h"
#include "vcpkg_System.h"
#include "vcpkg_Util.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/system.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
namespace vcpkg::Commands::Integrate
{

View File

@ -1,8 +1,9 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkglib.h"
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/vcpkglib.h>
namespace vcpkg::Commands::List
{
@ -27,7 +28,7 @@ namespace vcpkg::Commands::List
{
static const std::string EXAMPLE = Strings::format(
"The argument should be a substring to search for, or no argument to display all installed libraries.\n%s",
Commands::Help::create_example_string("list png"));
Help::create_example_string("list png"));
args.check_max_arg_count(1, EXAMPLE);
const std::unordered_set<std::string> options =
args.check_and_get_optional_command_arguments({OPTION_FULLDESC});

View File

@ -1,8 +1,9 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkglib.h"
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/vcpkglib.h>
namespace vcpkg::Commands::Owns
{
@ -26,7 +27,7 @@ namespace vcpkg::Commands::Owns
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string EXAMPLE = Strings::format("The argument should be a pattern to search for. %s",
Commands::Help::create_example_string("owns zlib.dll"));
Help::create_example_string("owns zlib.dll"));
args.check_exact_arg_count(1, EXAMPLE);
args.check_and_get_optional_command_arguments({});

View File

@ -1,10 +1,12 @@
#include "pch.h"
#include "Paragraphs.h"
#include "SortedVector.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Maps.h"
#include "vcpkg_System.h"
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/base/sortedvector.h>
#include <vcpkg/base/system.h>
#include <vcpkg/base/util.h>
namespace vcpkg::Commands::PortsDiff
{
@ -116,9 +118,8 @@ namespace vcpkg::Commands::PortsDiff
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string EXAMPLE =
Strings::format("The argument should be a branch/tag/hash to checkout.\n%s",
Commands::Help::create_example_string("portsdiff mybranchname"));
static const std::string EXAMPLE = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s",
Help::create_example_string("portsdiff mybranchname"));
args.check_min_arg_count(1, EXAMPLE);
args.check_max_arg_count(2, EXAMPLE);
args.check_and_get_optional_command_arguments({});
@ -138,8 +139,8 @@ namespace vcpkg::Commands::PortsDiff
read_ports_from_commit(paths, git_commit_id_for_previous_snapshot);
// Already sorted, so set_difference can work on std::vector too
const std::vector<std::string> current_ports = Maps::extract_keys(current_names_and_versions);
const std::vector<std::string> previous_ports = Maps::extract_keys(previous_names_and_versions);
const std::vector<std::string> current_ports = Util::extract_keys(current_names_and_versions);
const std::vector<std::string> previous_ports = Util::extract_keys(previous_names_and_versions);
const SetElementPresence<std::string> setp =
SetElementPresence<std::string>::create(current_ports, previous_ports);

View File

@ -1,11 +1,12 @@
#include "pch.h"
#include "Paragraphs.h"
#include "SourceParagraph.h"
#include "vcpkg_Commands.h"
#include "vcpkg_GlobalState.h"
#include "vcpkg_System.h"
#include "vcpkglib.h"
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/sourceparagraph.h>
#include <vcpkg/vcpkglib.h>
namespace vcpkg::Commands::Search
{
@ -82,7 +83,7 @@ namespace vcpkg::Commands::Search
{
static const std::string EXAMPLE = Strings::format(
"The argument should be a substring to search for, or no argument to display all libraries.\n%s",
Commands::Help::create_example_string("search png"));
Help::create_example_string("search png"));
args.check_max_arg_count(1, EXAMPLE);
const std::unordered_set<std::string> options =
args.check_and_get_optional_command_arguments({OPTION_GRAPH, OPTION_FULLDESC});

View File

@ -1,8 +1,8 @@
#include "pch.h"
#include "metrics.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
#include <vcpkg/metrics.h>
#define STRINGIFY(...) #__VA_ARGS__
#define MACRO_TO_STRING(X) STRINGIFY(X)

View File

@ -1,15 +1,15 @@
#include "pch.h"
#include "PackageSpec.h"
#include "Paragraphs.h"
#include "StatusParagraphs.h"
#include "VcpkgPaths.h"
#include "vcpkg_Dependencies.h"
#include "vcpkg_Files.h"
#include "vcpkg_Graphs.h"
#include "vcpkg_Strings.h"
#include "vcpkg_Util.h"
#include "vcpkglib.h"
#include <vcpkg/base/files.h>
#include <vcpkg/base/graphs.h>
#include <vcpkg/base/strings.h>
#include <vcpkg/base/util.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkglib.h>
#include <vcpkg/vcpkgpaths.h>
namespace vcpkg::Dependencies
{

View File

@ -1,16 +1,19 @@
#include "pch.h"
#include "Paragraphs.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Commands_Export_IFW.h"
#include "vcpkg_Dependencies.h"
#include "vcpkg_Input.h"
#include "vcpkg_System.h"
#include "vcpkg_Util.h"
#include "vcpkglib.h"
#include <vcpkg/base/system.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/export.ifw.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>
#include <vcpkg/install.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/vcpkglib.h>
#include <regex>
namespace vcpkg::Commands::Export
namespace vcpkg::Export
{
using Dependencies::ExportPlanAction;
using Dependencies::ExportPlanType;
@ -273,8 +276,7 @@ namespace vcpkg::Commands::Export
static const std::string OPTION_IFW_INSTALLER_FILE_PATH = "--ifw-installer-file-path";
// input sanitization
static const std::string EXAMPLE =
Commands::Help::create_example_string("export zlib zlib:x64-windows boost --nuget");
static const std::string EXAMPLE = Help::create_example_string("export zlib zlib:x64-windows boost --nuget");
args.check_min_arg_count(1, EXAMPLE);
ret.specs = Util::fmap(args.command_arguments, [&](auto&& arg) {

View File

@ -1,10 +1,10 @@
#include "pch.h"
#include "vcpkg_GlobalState.h"
#include <vcpkg/globalstate.h>
namespace vcpkg
{
Util::LockGuarded<ElapsedTime> GlobalState::timer;
Util::LockGuarded<Chrono::ElapsedTime> GlobalState::timer;
std::atomic<bool> GlobalState::debugging = false;
std::atomic<bool> GlobalState::feature_packages = false;

View File

@ -1,9 +1,9 @@
#include "pch.h"
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
namespace vcpkg::Commands::Help
namespace vcpkg::Help
{
void help_topics()
{
@ -75,7 +75,7 @@ namespace vcpkg::Commands::Help
" (default: %%VCPKG_ROOT%%)\n"
"\n"
"For more help (including examples) see the accompanying README.md.",
Integrate::INTEGRATE_COMMAND_HELPSTRING);
Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING);
}
std::string create_example_string(const std::string& command_and_arguments)
@ -114,7 +114,7 @@ namespace vcpkg::Commands::Help
{
System::print("Commands:\n"
"%s",
Integrate::INTEGRATE_COMMAND_HELPSTRING);
Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING);
}
else if (topic == "topics")
{

View File

@ -1,9 +1,10 @@
#include "pch.h"
#include "metrics.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Input.h"
#include "vcpkg_System.h"
#include <vcpkg/base/system.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>
#include <vcpkg/metrics.h>
namespace vcpkg::Input
{
@ -30,7 +31,7 @@ namespace vcpkg::Input
{
System::println(System::Color::error, "Error: invalid triplet: %s", t);
Metrics::g_metrics.lock()->track_property("error", "invalid triplet: " + t.to_string());
Commands::Help::help_topic_valid_triplet(paths);
Help::help_topic_valid_triplet(paths);
Checks::exit_fail(VCPKG_LINE_INFO);
}
}

View File

@ -1,18 +1,21 @@
#include "pch.h"
#include "Paragraphs.h"
#include "metrics.h"
#include "vcpkg_Build.h"
#include "vcpkg_Commands.h"
#include "vcpkg_Dependencies.h"
#include "vcpkg_Files.h"
#include "vcpkg_GlobalState.h"
#include "vcpkg_Input.h"
#include "vcpkg_System.h"
#include "vcpkg_Util.h"
#include "vcpkglib.h"
#include <vcpkg/base/files.h>
#include <vcpkg/base/system.h>
#include <vcpkg/base/util.h>
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/help.h>
#include <vcpkg/input.h>
#include <vcpkg/install.h>
#include <vcpkg/metrics.h>
#include <vcpkg/paragraphs.h>
#include <vcpkg/remove.h>
#include <vcpkg/vcpkglib.h>
namespace vcpkg::Commands::Install
namespace vcpkg::Install
{
using namespace Dependencies;
@ -68,8 +71,8 @@ namespace vcpkg::Commands::Install
const std::string filename = file.filename().generic_string();
if (fs::is_regular_file(status) &&
(Strings::case_insensitive_ascii_compare(filename.c_str(), "CONTROL") == 0 ||
Strings::case_insensitive_ascii_compare(filename.c_str(), "BUILD_INFO") == 0))
(Strings::case_insensitive_ascii_compare(filename.c_str(), "CONTROL") ||
Strings::case_insensitive_ascii_compare(filename.c_str(), "BUILD_INFO")))
{
// Do not copy the control file
continue;
@ -442,7 +445,7 @@ namespace vcpkg::Commands::Install
}
}
void perform_and_exit(const std::vector<AnyAction>& action_plan,
void perform_and_exit_ex(const std::vector<AnyAction>& action_plan,
const Build::BuildPackageOptions& install_plan_options,
const KeepGoing keep_going,
const PrintSummary print_summary,
@ -451,13 +454,13 @@ namespace vcpkg::Commands::Install
{
std::vector<BuildResult> results;
std::vector<std::string> timing;
const ElapsedTime timer = ElapsedTime::create_started();
const auto timer = Chrono::ElapsedTime::create_started();
size_t counter = 0;
const size_t package_count = action_plan.size();
for (const auto& action : action_plan)
{
const ElapsedTime build_timer = ElapsedTime::create_started();
const auto build_timer = Chrono::ElapsedTime::create_started();
counter++;
const std::string display_name = action.spec().to_string();
@ -531,8 +534,7 @@ namespace vcpkg::Commands::Install
static const std::string OPTION_KEEP_GOING = "--keep-going";
// input sanitization
static const std::string EXAMPLE =
Commands::Help::create_example_string("install zlib zlib:x64-windows curl boost");
static const std::string EXAMPLE = Help::create_example_string("install zlib zlib:x64-windows curl boost");
args.check_min_arg_count(1, EXAMPLE);
const std::vector<FullPackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) {
@ -607,7 +609,7 @@ namespace vcpkg::Commands::Install
Checks::exit_success(VCPKG_LINE_INFO);
}
perform_and_exit(action_plan, install_plan_options, keep_going, print_summary, paths, status_db);
perform_and_exit_ex(action_plan, install_plan_options, keep_going, print_summary, paths, status_db);
Checks::exit_success(VCPKG_LINE_INFO);
}

View File

@ -1,10 +1,13 @@
#include "pch.h"
#include "filesystem_fs.h"
#include "metrics.h"
#include "vcpkg_Files.h"
#include "vcpkg_Strings.h"
#include "vcpkg_System.h"
#include <vcpkg/metrics.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/strings.h>
#include <vcpkg/base/system.h>
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
namespace vcpkg::Metrics
{

View File

@ -1,8 +1,8 @@
#include "pch.h"
#include "PackageSpec.h"
#include "vcpkg_Parse.h"
#include "vcpkg_Util.h"
#include <vcpkg/base/util.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/parse.h>
using vcpkg::Parse::parse_comma_list;

View File

@ -1,7 +1,8 @@
#include "pch.h"
#include "PackageSpecParseResult.h"
#include "vcpkg_Checks.h"
#include <vcpkg/packagespecparseresult.h>
#include <vcpkg/base/checks.h>
namespace vcpkg
{

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "ParagraphParseResult.h"
#include "vcpkg_Checks.h"
#include <vcpkg/base/checks.h>
#include <vcpkg/paragraphparseresult.h>
namespace vcpkg
{

View File

@ -1,10 +1,10 @@
#include "pch.h"
#include "ParagraphParseResult.h"
#include "Paragraphs.h"
#include "vcpkg_Files.h"
#include "vcpkg_GlobalState.h"
#include "vcpkg_Util.h"
#include <vcpkg/base/files.h>
#include <vcpkg/base/util.h>
#include <vcpkg/globalstate.h>
#include <vcpkg/paragraphparseresult.h>
#include <vcpkg/paragraphs.h>
using namespace vcpkg::Parse;

View File

@ -1,8 +1,9 @@
#include "pch.h"
#include "vcpkg_Checks.h"
#include "vcpkg_Maps.h"
#include "vcpkg_Parse.h"
#include <vcpkg/parse.h>
#include <vcpkg/base/checks.h>
#include <vcpkg/base/util.h>
namespace vcpkg::Parse
{
@ -38,7 +39,7 @@ namespace vcpkg::Parse
{
auto err = std::make_unique<ParseControlErrorInfo>();
err->name = name;
err->extra_fields = Maps::extract_keys(fields);
err->extra_fields = Util::extract_keys(fields);
err->missing_fields = std::move(missing_fields);
return err;
}

Some files were not shown because too many files have changed in this diff Show More