Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg] Registries MVP #13038

Merged
merged 20 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions toolsrc/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ IncludeCategories:
Priority: -1
- Regex: '^<catch2/catch\.hpp>$'
Priority: 1
- Regex: '^<vcpkg/fwd/.*\.h>$'
- Regex: '^<vcpkg/base/fwd/.*\.h>$'
Priority: 2
- Regex: '^<vcpkg/base/.*\.h>$'
- Regex: '^<vcpkg/fwd/.*\.h>$'
Priority: 3
- Regex: '^<vcpkg/.*\.h>$'
- Regex: '^<vcpkg/base/.*\.h>$'
Priority: 4
- Regex: '^<[a-z0-9_]*\.h>$'
- Regex: '^<vcpkg/.*\.h>$'
Priority: 5
- Regex: '^<[a-z0-9_]*>$' # C++ standard library
- Regex: '^<[a-z0-9_]*\.h>$'
Priority: 6
- Regex: '^<[a-z0-9_]*>$' # C++ standard library
Priority: 7
35 changes: 18 additions & 17 deletions toolsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ endif()

file(GLOB VCPKGLIB_SOURCES CONFIGURE_DEPENDS src/vcpkg/*.cpp)
file(GLOB VCPKGLIB_BASE_SOURCES CONFIGURE_DEPENDS src/vcpkg/base/*.cpp)
file(GLOB VCPKGLIB_INCLUDES CONFIGURE_DEPENDS include/vcpkg/*.h)
file(GLOB VCPKGLIB_BASE_INCLUDES CONFIGURE_DEPENDS include/vcpkg/base/*.h)
file(GLOB VCPKGLIB_INCLUDES CONFIGURE_DEPENDS include/vcpkg/*.h include/vcpkg/fwd/*.h)
file(GLOB VCPKGLIB_BASE_INCLUDES CONFIGURE_DEPENDS include/vcpkg/base/*.h include/vcpkg/base/fwd/*.h)

set(VCPKG_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg.cpp)

Expand Down Expand Up @@ -154,19 +154,20 @@ endif()

find_program(CLANG_FORMAT clang-format)
if(CLANG_FORMAT)
add_custom_target(format COMMAND ${CLANG_FORMAT} -i -verbose
${CMAKE_CURRENT_SOURCE_DIR}/src/pch.cpp
${VCPKGLIB_BASE_SOURCES}
${VCPKGLIB_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/include/pch.h
${VCPKGLIB_BASE_INCLUDES}
${VCPKGLIB_INCLUDES}

${VCPKG_SOURCES}
${VCPKGMETRICSUPLOADER_SOURCES}

${VCPKG_TEST_SOURCES}
${VCPKG_TEST_INCLUDES}

${VCPKG_FUZZ_SOURCES})
# doing all of these formats in one line has a tendency to overflow the command line length
add_custom_target(format
COMMAND ${CLANG_FORMAT} -i -verbose ${CMAKE_CURRENT_SOURCE_DIR}/src/pch.cpp
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKGLIB_BASE_SOURCES}
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKGLIB_SOURCES}
COMMAND ${CLANG_FORMAT} -i -verbose ${CMAKE_CURRENT_SOURCE_DIR}/include/pch.h
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKGLIB_BASE_INCLUDES}
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKGLIB_INCLUDES}

COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKG_SOURCES}
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKGMETRICSUPLOADER_SOURCES}

COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKG_TEST_SOURCES}
COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKG_TEST_INCLUDES}

COMMAND ${CLANG_FORMAT} -i -verbose ${VCPKG_FUZZ_SOURCES})
endif()
2 changes: 1 addition & 1 deletion toolsrc/include/vcpkg/base/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ namespace vcpkg::Files
/// <summary>Read text lines from a file</summary>
/// <remarks>Lines will have up to one trailing carriage-return character stripped (CRLF)</remarks>
virtual Expected<std::vector<std::string>> read_lines(const fs::path& file_path) const = 0;
virtual fs::path find_file_recursively_up(const fs::path& starting_dir, const std::string& filename) const = 0;
virtual fs::path find_file_recursively_up(const fs::path& starting_dir, const fs::path& filename) const = 0;
virtual std::vector<fs::path> get_files_recursive(const fs::path& dir) const = 0;
virtual std::vector<fs::path> get_files_non_recursive(const fs::path& dir) const = 0;
void write_lines(const fs::path& file_path, const std::vector<std::string>& lines, LineInfo linfo);
Expand Down
44 changes: 44 additions & 0 deletions toolsrc/include/vcpkg/base/fwd/json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#pragma once

#include <vcpkg/base/fwd/optional.h>
#include <vcpkg/base/fwd/span.h>
#include <vcpkg/base/fwd/stringview.h>

namespace vcpkg::Json
{
struct JsonStyle;
enum class ValueKind : int;
struct Value;
struct Object;
struct Array;

struct ReaderError;
struct BasicReaderError;
struct Reader;

// This is written all the way out so that one can include a subclass in a header
template<class Type>
struct IDeserializer
{
using type = Type;
virtual StringView type_name() const = 0;

virtual Span<const StringView> valid_fields() const;

virtual Optional<Type> visit_null(Reader&, StringView);
virtual Optional<Type> visit_boolean(Reader&, StringView, bool);
virtual Optional<Type> visit_integer(Reader& r, StringView field_name, int64_t i);
virtual Optional<Type> visit_number(Reader&, StringView, double);
virtual Optional<Type> visit_string(Reader&, StringView, StringView);
virtual Optional<Type> visit_array(Reader&, StringView, const Array&);
virtual Optional<Type> visit_object(Reader&, StringView, const Object&);

protected:
IDeserializer() = default;
IDeserializer(const IDeserializer&) = default;
IDeserializer& operator=(const IDeserializer&) = default;
IDeserializer(IDeserializer&&) = default;
IDeserializer& operator=(IDeserializer&&) = default;
virtual ~IDeserializer() = default;
};
}
7 changes: 7 additions & 0 deletions toolsrc/include/vcpkg/base/fwd/optional.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

namespace vcpkg
{
template<class T>
struct Optional;
}
7 changes: 7 additions & 0 deletions toolsrc/include/vcpkg/base/fwd/span.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

namespace vcpkg
{
template<class T>
struct Span;
}
6 changes: 6 additions & 0 deletions toolsrc/include/vcpkg/base/fwd/stringview.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

namespace vcpkg
{
struct StringView;
}
Loading