From d2620cf02bf01bb3cd6873aa2ba7687644019ed0 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Tue, 14 Jul 2020 08:50:19 -0700 Subject: [vcpkg formatting] Turn off DeriveLineEnding (#12368) * [vcpkg formatting] Turn off DeriveLineEnding * format * Add newlines to the end of files Since we're reformatting anyways --- toolsrc/include/vcpkg-test/mockcmakevarprovider.h | 76 +++++------ toolsrc/include/vcpkg/base/cache.h | 42 +++--- toolsrc/include/vcpkg/base/ignore_errors.h | 20 +-- toolsrc/include/vcpkg/base/span.h | 114 ++++++++--------- toolsrc/include/vcpkg/base/view.h | 18 +-- toolsrc/include/vcpkg/binarycaching.h | 106 ++++++++-------- toolsrc/include/vcpkg/binarycaching.private.h | 120 +++++++++--------- toolsrc/include/vcpkg/buildenvironment.h | 26 ++-- toolsrc/include/vcpkg/export.chocolatey.h | 38 +++--- toolsrc/include/vcpkg/platform-expression.h | 148 +++++++++++----------- toolsrc/include/vcpkg/textrowcol.h | 34 ++--- toolsrc/include/vcpkg/visualstudio.h | 28 ++-- 12 files changed, 385 insertions(+), 385 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg-test/mockcmakevarprovider.h b/toolsrc/include/vcpkg-test/mockcmakevarprovider.h index 21207c856..482f9ea40 100644 --- a/toolsrc/include/vcpkg-test/mockcmakevarprovider.h +++ b/toolsrc/include/vcpkg-test/mockcmakevarprovider.h @@ -1,38 +1,38 @@ -#pragma once - -#include - -namespace vcpkg::Test -{ - struct MockCMakeVarProvider : CMakeVars::CMakeVarProvider - { - void load_generic_triplet_vars(Triplet triplet) const override { generic_triplet_vars[triplet] = {}; } - - void load_dep_info_vars(Span specs) const override - { - for (auto&& spec : specs) - dep_info_vars[spec] = {}; - } - - void load_tag_vars(Span specs, - const PortFileProvider::PortFileProvider& port_provider) const override - { - for (auto&& spec : specs) - tag_vars[spec.package_spec] = {}; - Util::unused(port_provider); - } - - Optional&> get_generic_triplet_vars( - Triplet triplet) const override; - - Optional&> get_dep_info_vars( - const PackageSpec& spec) const override; - - Optional&> get_tag_vars( - const PackageSpec& spec) const override; - - mutable std::unordered_map> dep_info_vars; - mutable std::unordered_map> tag_vars; - mutable std::unordered_map> generic_triplet_vars; - }; -} +#pragma once + +#include + +namespace vcpkg::Test +{ + struct MockCMakeVarProvider : CMakeVars::CMakeVarProvider + { + void load_generic_triplet_vars(Triplet triplet) const override { generic_triplet_vars[triplet] = {}; } + + void load_dep_info_vars(Span specs) const override + { + for (auto&& spec : specs) + dep_info_vars[spec] = {}; + } + + void load_tag_vars(Span specs, + const PortFileProvider::PortFileProvider& port_provider) const override + { + for (auto&& spec : specs) + tag_vars[spec.package_spec] = {}; + Util::unused(port_provider); + } + + Optional&> get_generic_triplet_vars( + Triplet triplet) const override; + + Optional&> get_dep_info_vars( + const PackageSpec& spec) const override; + + Optional&> get_tag_vars( + const PackageSpec& spec) const override; + + mutable std::unordered_map> dep_info_vars; + mutable std::unordered_map> tag_vars; + mutable std::unordered_map> generic_triplet_vars; + }; +} diff --git a/toolsrc/include/vcpkg/base/cache.h b/toolsrc/include/vcpkg/base/cache.h index dfc7565b8..1996f2587 100644 --- a/toolsrc/include/vcpkg/base/cache.h +++ b/toolsrc/include/vcpkg/base/cache.h @@ -1,21 +1,21 @@ -#pragma once - -#include - -namespace vcpkg -{ - template - struct Cache - { - template - Value const& get_lazy(const Key& k, const F& f) const - { - auto it = m_cache.find(k); - if (it != m_cache.end()) return it->second; - return m_cache.emplace(k, f()).first->second; - } - - private: - mutable std::map m_cache; - }; -} +#pragma once + +#include + +namespace vcpkg +{ + template + struct Cache + { + template + Value const& get_lazy(const Key& k, const F& f) const + { + auto it = m_cache.find(k); + if (it != m_cache.end()) return it->second; + return m_cache.emplace(k, f()).first->second; + } + + private: + mutable std::map m_cache; + }; +} diff --git a/toolsrc/include/vcpkg/base/ignore_errors.h b/toolsrc/include/vcpkg/base/ignore_errors.h index 44077059a..ed8b38c56 100644 --- a/toolsrc/include/vcpkg/base/ignore_errors.h +++ b/toolsrc/include/vcpkg/base/ignore_errors.h @@ -1,10 +1,10 @@ -#pragma once - -namespace vcpkg -{ - struct ignore_errors_t - { - }; - - constexpr ignore_errors_t ignore_errors; -} +#pragma once + +namespace vcpkg +{ + struct ignore_errors_t + { + }; + + constexpr ignore_errors_t ignore_errors; +} diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h index 482fe1b00..221cccc8c 100644 --- a/toolsrc/include/vcpkg/base/span.h +++ b/toolsrc/include/vcpkg/base/span.h @@ -1,57 +1,57 @@ -#pragma once - -#include -#include -#include -#include - -namespace vcpkg -{ - template - struct Span - { - public: - static_assert(std::is_object::value, "Span is illegal"); - - using value_type = std::decay_t; - using element_type = T; - using pointer = std::add_pointer_t; - using reference = std::add_lvalue_reference_t; - using iterator = pointer; - - constexpr Span() noexcept : m_ptr(nullptr), m_count(0) { } - constexpr Span(std::nullptr_t) noexcept : m_ptr(nullptr), m_count(0) { } - constexpr Span(pointer ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) { } - constexpr Span(pointer ptr_begin, pointer ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) { } - - template - constexpr Span(T (&arr)[N]) noexcept : m_ptr(arr), m_count(N) - { - } - - template>> - constexpr Span(std::remove_const_t (&arr)[N]) noexcept : m_ptr(arr), m_count(N) - { - } - - template().data()), - class = std::enable_if_t, Span>::value>> - constexpr Span(Range&& v) noexcept : Span(v.data(), v.size()) - { - static_assert(std::is_same::value_type, value_type>::value, - "Cannot convert incompatible ranges"); - } - - 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 pointer data() const { return m_ptr; } - constexpr size_t size() const { return m_count; } - - private: - pointer m_ptr; - size_t m_count; - }; -} +#pragma once + +#include +#include +#include +#include + +namespace vcpkg +{ + template + struct Span + { + public: + static_assert(std::is_object::value, "Span is illegal"); + + using value_type = std::decay_t; + using element_type = T; + using pointer = std::add_pointer_t; + using reference = std::add_lvalue_reference_t; + using iterator = pointer; + + constexpr Span() noexcept : m_ptr(nullptr), m_count(0) { } + constexpr Span(std::nullptr_t) noexcept : m_ptr(nullptr), m_count(0) { } + constexpr Span(pointer ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) { } + constexpr Span(pointer ptr_begin, pointer ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) { } + + template + constexpr Span(T (&arr)[N]) noexcept : m_ptr(arr), m_count(N) + { + } + + template>> + constexpr Span(std::remove_const_t (&arr)[N]) noexcept : m_ptr(arr), m_count(N) + { + } + + template().data()), + class = std::enable_if_t, Span>::value>> + constexpr Span(Range&& v) noexcept : Span(v.data(), v.size()) + { + static_assert(std::is_same::value_type, value_type>::value, + "Cannot convert incompatible ranges"); + } + + 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 pointer data() const { return m_ptr; } + constexpr size_t size() const { return m_count; } + + private: + pointer m_ptr; + size_t m_count; + }; +} diff --git a/toolsrc/include/vcpkg/base/view.h b/toolsrc/include/vcpkg/base/view.h index 8a9c40994..491e8351b 100644 --- a/toolsrc/include/vcpkg/base/view.h +++ b/toolsrc/include/vcpkg/base/view.h @@ -1,9 +1,9 @@ -#pragma once - -#include - -namespace vcpkg -{ - template - using View = Span; -} +#pragma once + +#include + +namespace vcpkg +{ + template + using View = Span; +} diff --git a/toolsrc/include/vcpkg/binarycaching.h b/toolsrc/include/vcpkg/binarycaching.h index 44c223084..be52d1e49 100644 --- a/toolsrc/include/vcpkg/binarycaching.h +++ b/toolsrc/include/vcpkg/binarycaching.h @@ -1,53 +1,53 @@ -#pragma once - -#include -#include - -#include -#include - -namespace vcpkg::Dependencies -{ - struct InstallPlanAction; - struct ActionPlan; -} -namespace vcpkg::Build -{ - struct AbiTagAndFile; - struct BuildPackageOptions; -} - -namespace vcpkg -{ - enum class RestoreResult - { - missing, - success, - build_failed, - }; - - struct IBinaryProvider - { - virtual ~IBinaryProvider() = default; - /// Gives the BinaryProvider an opportunity to batch any downloading or server communication for executing - /// `plan`. - virtual void prefetch(const VcpkgPaths& paths, const Dependencies::ActionPlan& plan) = 0; - /// Attempts to restore the package referenced by `action` into the packages directory. - virtual RestoreResult try_restore(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0; - /// Called upon a successful build of `action` - virtual void push_success(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0; - /// Requests the result of `try_restore()` without actually downloading the package. Used by CI to determine - /// missing packages. - virtual RestoreResult precheck(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0; - }; - - IBinaryProvider& null_binary_provider(); - - ExpectedS> create_binary_provider_from_configs(View args); - ExpectedS> create_binary_provider_from_configs_pure(const std::string& env_string, - View args); - - std::string generate_nuget_packages_config(const Dependencies::ActionPlan& action); - - void help_topic_binary_caching(const VcpkgPaths& paths); -} +#pragma once + +#include +#include + +#include +#include + +namespace vcpkg::Dependencies +{ + struct InstallPlanAction; + struct ActionPlan; +} +namespace vcpkg::Build +{ + struct AbiTagAndFile; + struct BuildPackageOptions; +} + +namespace vcpkg +{ + enum class RestoreResult + { + missing, + success, + build_failed, + }; + + struct IBinaryProvider + { + virtual ~IBinaryProvider() = default; + /// Gives the BinaryProvider an opportunity to batch any downloading or server communication for executing + /// `plan`. + virtual void prefetch(const VcpkgPaths& paths, const Dependencies::ActionPlan& plan) = 0; + /// Attempts to restore the package referenced by `action` into the packages directory. + virtual RestoreResult try_restore(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0; + /// Called upon a successful build of `action` + virtual void push_success(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0; + /// Requests the result of `try_restore()` without actually downloading the package. Used by CI to determine + /// missing packages. + virtual RestoreResult precheck(const VcpkgPaths& paths, const Dependencies::InstallPlanAction& action) = 0; + }; + + IBinaryProvider& null_binary_provider(); + + ExpectedS> create_binary_provider_from_configs(View args); + ExpectedS> create_binary_provider_from_configs_pure(const std::string& env_string, + View args); + + std::string generate_nuget_packages_config(const Dependencies::ActionPlan& action); + + void help_topic_binary_caching(const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg/binarycaching.private.h b/toolsrc/include/vcpkg/binarycaching.private.h index 040b34597..1b5d587de 100644 --- a/toolsrc/include/vcpkg/binarycaching.private.h +++ b/toolsrc/include/vcpkg/binarycaching.private.h @@ -1,60 +1,60 @@ -#pragma once - -#include -#include -#include - -#include - -namespace vcpkg -{ - std::string reformat_version(const std::string& version, const std::string& abi_tag); - - struct NugetReference - { - explicit NugetReference(const Dependencies::InstallPlanAction& action) - : NugetReference(action.spec, - action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO) - .source_control_file->core_paragraph->version, - action.abi_info.value_or_exit(VCPKG_LINE_INFO).package_abi) - { - } - - NugetReference(const PackageSpec& spec, const std::string& raw_version, const std::string& abi_tag) - : id(spec.dir()), version(reformat_version(raw_version, abi_tag)) - { - } - - std::string id; - std::string version; - - std::string nupkg_filename() const { return Strings::concat(id, '.', version, ".nupkg"); } - }; - - std::string generate_nuspec(const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action, - const NugetReference& ref); - - struct XmlSerializer - { - XmlSerializer& emit_declaration(); - XmlSerializer& open_tag(StringLiteral sl); - XmlSerializer& start_complex_open_tag(StringLiteral sl); - XmlSerializer& text_attr(StringLiteral name, StringView content); - XmlSerializer& finish_complex_open_tag(); - XmlSerializer& finish_self_closing_complex_tag(); - XmlSerializer& close_tag(StringLiteral sl); - XmlSerializer& text(StringView sv); - XmlSerializer& simple_tag(StringLiteral tag, StringView content); - XmlSerializer& line_break(); - - std::string buf; - - private: - XmlSerializer& emit_pending_indent(); - - int m_indent = 0; - bool m_pending_indent = false; - }; - -} \ No newline at end of file +#pragma once + +#include +#include +#include + +#include + +namespace vcpkg +{ + std::string reformat_version(const std::string& version, const std::string& abi_tag); + + struct NugetReference + { + explicit NugetReference(const Dependencies::InstallPlanAction& action) + : NugetReference(action.spec, + action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO) + .source_control_file->core_paragraph->version, + action.abi_info.value_or_exit(VCPKG_LINE_INFO).package_abi) + { + } + + NugetReference(const PackageSpec& spec, const std::string& raw_version, const std::string& abi_tag) + : id(spec.dir()), version(reformat_version(raw_version, abi_tag)) + { + } + + std::string id; + std::string version; + + std::string nupkg_filename() const { return Strings::concat(id, '.', version, ".nupkg"); } + }; + + std::string generate_nuspec(const VcpkgPaths& paths, + const Dependencies::InstallPlanAction& action, + const NugetReference& ref); + + struct XmlSerializer + { + XmlSerializer& emit_declaration(); + XmlSerializer& open_tag(StringLiteral sl); + XmlSerializer& start_complex_open_tag(StringLiteral sl); + XmlSerializer& text_attr(StringLiteral name, StringView content); + XmlSerializer& finish_complex_open_tag(); + XmlSerializer& finish_self_closing_complex_tag(); + XmlSerializer& close_tag(StringLiteral sl); + XmlSerializer& text(StringView sv); + XmlSerializer& simple_tag(StringLiteral tag, StringView content); + XmlSerializer& line_break(); + + std::string buf; + + private: + XmlSerializer& emit_pending_indent(); + + int m_indent = 0; + bool m_pending_indent = false; + }; + +} diff --git a/toolsrc/include/vcpkg/buildenvironment.h b/toolsrc/include/vcpkg/buildenvironment.h index 921fb419d..1216caa2a 100644 --- a/toolsrc/include/vcpkg/buildenvironment.h +++ b/toolsrc/include/vcpkg/buildenvironment.h @@ -1,13 +1,13 @@ -#include - -#include - -#include -#include - -namespace vcpkg -{ - std::string make_cmake_cmd(const VcpkgPaths& paths, - const fs::path& cmake_script, - std::vector&& pass_variables); -} +#include + +#include + +#include +#include + +namespace vcpkg +{ + std::string make_cmake_cmd(const VcpkgPaths& paths, + const fs::path& cmake_script, + std::vector&& pass_variables); +} diff --git a/toolsrc/include/vcpkg/export.chocolatey.h b/toolsrc/include/vcpkg/export.chocolatey.h index 7804108fd..1e6f9a12b 100644 --- a/toolsrc/include/vcpkg/export.chocolatey.h +++ b/toolsrc/include/vcpkg/export.chocolatey.h @@ -1,19 +1,19 @@ -#pragma once - -#include -#include - -#include - -namespace vcpkg::Export::Chocolatey -{ - struct Options - { - Optional maybe_maintainer; - Optional maybe_version_suffix; - }; - - void do_export(const std::vector& export_plan, - const VcpkgPaths& paths, - const Options& chocolatey_options); -} +#pragma once + +#include +#include + +#include + +namespace vcpkg::Export::Chocolatey +{ + struct Options + { + Optional maybe_maintainer; + Optional maybe_version_suffix; + }; + + void do_export(const std::vector& export_plan, + const VcpkgPaths& paths, + const Options& chocolatey_options); +} diff --git a/toolsrc/include/vcpkg/platform-expression.h b/toolsrc/include/vcpkg/platform-expression.h index b9a6f6a88..fd2bb8589 100644 --- a/toolsrc/include/vcpkg/platform-expression.h +++ b/toolsrc/include/vcpkg/platform-expression.h @@ -1,74 +1,74 @@ -#pragma once - -#include -#include - -#include -#include - -namespace vcpkg::PlatformExpression -{ - // map of cmake variables and their values. - using Context = std::unordered_map; - - namespace detail - { - struct ExprImpl; - } - struct Expr - { - static Expr Identifier(StringView id); - static Expr Not(Expr&& e); - static Expr And(std::vector&& exprs); - static Expr Or(std::vector&& exprs); - - // The empty expression is always true - static Expr Empty() { return Expr(); } - - // since ExprImpl is not yet defined, we need to define the ctor and dtor in the C++ file - Expr(); - Expr(const Expr&); - Expr(Expr&&); - Expr& operator=(const Expr& e); - Expr& operator=(Expr&&); - - explicit Expr(std::unique_ptr&& e); - ~Expr(); - - bool evaluate(const Context& context) const; - bool is_empty() const { return !static_cast(underlying_); } - - private: - std::unique_ptr underlying_; - }; - - // Note: for backwards compatibility, in CONTROL files, - // multiple binary operators are allowed to be next to one another; i.e. - // (windows & arm) = (windows && arm) = (windows &&& arm), etc. - enum class MultipleBinaryOperators - { - Deny, - Allow, - }; - - // platform expression parses the following : - // : - // - // - // - // : - // ( ) - // - // : - // A lowercase alpha-numeric string - // : - // - // ! - // - // - // & - // - // - // | - ExpectedS parse_platform_expression(StringView expression, MultipleBinaryOperators multiple_binary_operators); -} +#pragma once + +#include +#include + +#include +#include + +namespace vcpkg::PlatformExpression +{ + // map of cmake variables and their values. + using Context = std::unordered_map; + + namespace detail + { + struct ExprImpl; + } + struct Expr + { + static Expr Identifier(StringView id); + static Expr Not(Expr&& e); + static Expr And(std::vector&& exprs); + static Expr Or(std::vector&& exprs); + + // The empty expression is always true + static Expr Empty() { return Expr(); } + + // since ExprImpl is not yet defined, we need to define the ctor and dtor in the C++ file + Expr(); + Expr(const Expr&); + Expr(Expr&&); + Expr& operator=(const Expr& e); + Expr& operator=(Expr&&); + + explicit Expr(std::unique_ptr&& e); + ~Expr(); + + bool evaluate(const Context& context) const; + bool is_empty() const { return !static_cast(underlying_); } + + private: + std::unique_ptr underlying_; + }; + + // Note: for backwards compatibility, in CONTROL files, + // multiple binary operators are allowed to be next to one another; i.e. + // (windows & arm) = (windows && arm) = (windows &&& arm), etc. + enum class MultipleBinaryOperators + { + Deny, + Allow, + }; + + // platform expression parses the following : + // : + // + // + // + // : + // ( ) + // + // : + // A lowercase alpha-numeric string + // : + // + // ! + // + // + // & + // + // + // | + ExpectedS parse_platform_expression(StringView expression, MultipleBinaryOperators multiple_binary_operators); +} diff --git a/toolsrc/include/vcpkg/textrowcol.h b/toolsrc/include/vcpkg/textrowcol.h index bf6f31d7c..b8269f697 100644 --- a/toolsrc/include/vcpkg/textrowcol.h +++ b/toolsrc/include/vcpkg/textrowcol.h @@ -1,17 +1,17 @@ -#pragma once - -namespace vcpkg::Parse -{ - struct TextRowCol - { - constexpr TextRowCol() noexcept = default; - constexpr TextRowCol(int row, int column) noexcept : row(row), column(column) { } - /// '0' indicates uninitialized; '1' is the first row. - int row = 0; - /// '0' indicates uninitialized; '1' is the first column. - int column = 0; - - constexpr int row_or(int def) const noexcept { return row ? row : def; } - constexpr int column_or(int def) const noexcept { return column ? column : def; } - }; -} +#pragma once + +namespace vcpkg::Parse +{ + struct TextRowCol + { + constexpr TextRowCol() noexcept = default; + constexpr TextRowCol(int row, int column) noexcept : row(row), column(column) { } + /// '0' indicates uninitialized; '1' is the first row. + int row = 0; + /// '0' indicates uninitialized; '1' is the first column. + int column = 0; + + constexpr int row_or(int def) const noexcept { return row ? row : def; } + constexpr int column_or(int def) const noexcept { return column ? column : def; } + }; +} diff --git a/toolsrc/include/vcpkg/visualstudio.h b/toolsrc/include/vcpkg/visualstudio.h index cd99db352..da6652b3e 100644 --- a/toolsrc/include/vcpkg/visualstudio.h +++ b/toolsrc/include/vcpkg/visualstudio.h @@ -1,14 +1,14 @@ -#pragma once - -#if defined(_WIN32) - -#include - -namespace vcpkg::VisualStudio -{ - std::vector get_visual_studio_instances(const VcpkgPaths& paths); - - std::vector find_toolset_instances_preferred_first(const VcpkgPaths& paths); -} - -#endif +#pragma once + +#if defined(_WIN32) + +#include + +namespace vcpkg::VisualStudio +{ + std::vector get_visual_studio_instances(const VcpkgPaths& paths); + + std::vector find_toolset_instances_preferred_first(const VcpkgPaths& paths); +} + +#endif -- cgit v1.2.3