Skip to content

Commit

Permalink
Merge pull request #314 from wravery/next
Browse files Browse the repository at this point in the history
Additional cleanup from enabling C++20 modules
  • Loading branch information
wravery authored Sep 16, 2024
2 parents 37f2264 + 67b56d8 commit e1636d2
Show file tree
Hide file tree
Showing 40 changed files with 88 additions and 105 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: macOS
on: [push, pull_request]

jobs:
apple-clang:
xcode:
strategy:
fail-fast: false
matrix:
Expand All @@ -17,8 +17,6 @@ jobs:
submodules: true
fetch-depth: 0

- uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401

- name: Cache vcpkg
uses: actions/[email protected]
id: cache-vcpkg
Expand Down Expand Up @@ -52,8 +50,7 @@ jobs:
$cacheAccess = $(if ('${{ steps.cache-vcpkg.outputs.cache-hit }}' -eq 'true') { 'read' } else { 'write' })
$env:VCPKG_BINARY_SOURCES = "clear;files,$cachedBinaries,$cacheAccess"
$env:PATH = "${env:PATH}:${{ github.workspace }}/ninja-build"
cmake "-DCMAKE_TOOLCHAIN_FILE=$vcpkgToolchain" "-DCMAKE_BUILD_TYPE=$cmakeBuildType" "-DGRAPHQL_BUILD_MODULES=OFF" -G Ninja ${{ github.workspace }}
cmake "-DCMAKE_TOOLCHAIN_FILE=$vcpkgToolchain" "-DCMAKE_BUILD_TYPE=$cmakeBuildType" "-DGRAPHQL_BUILD_MODULES=OFF" ${{ github.workspace }}
- name: Build
working-directory: build/
Expand Down
2 changes: 2 additions & 0 deletions cmake/cppgraphqlgen-functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function(add_graphql_schema_target SCHEMA_TARGET)
target_sources(${SCHEMA_TARGET}_schema PUBLIC FILE_SET HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
FILES ${SCHEMA_HEADERS})
get_target_property(GRAPHQL_BUILD_MODULES cppgraphqlgen::graphqlservice GRAPHQL_BUILD_MODULES)
if(GRAPHQL_BUILD_MODULES)
file(GLOB SCHEMA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/*.ixx)
target_sources(${SCHEMA_TARGET}_schema PUBLIC FILE_SET CXX_MODULES
Expand Down Expand Up @@ -106,6 +107,7 @@ function(add_graphql_client_target CLIENT_TARGET)
target_sources(${CLIENT_TARGET}_client PUBLIC FILE_SET HEADERS
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
FILES ${CLIENT_HEADERS})
get_target_property(GRAPHQL_BUILD_MODULES cppgraphqlgen::graphqlclient GRAPHQL_BUILD_MODULES)
if(GRAPHQL_BUILD_MODULES)
file(GLOB CLIENT_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/*.ixx)
target_sources(${CLIENT_TARGET}_client PUBLIC FILE_SET CXX_MODULES
Expand Down
2 changes: 1 addition & 1 deletion cmake/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.5.8
5.0.0
4 changes: 4 additions & 0 deletions include/graphqlservice/GraphQLParse.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ struct [[nodiscard("unnecessary parse")]] ast
bool validated = false;
};

inline namespace constants {

// By default, we want to limit the depth of nested nodes. You can override this with
// another value for the depthLimit parameter in these parse functions.
constexpr std::size_t c_defaultDepthLimit = 25;

} // namespace constants

[[nodiscard("unnecessary parse")]] GRAPHQLPEG_EXPORT ast parseSchemaString(
std::string_view input, std::size_t depthLimit = c_defaultDepthLimit);
[[nodiscard("unnecessary parse")]] GRAPHQLPEG_EXPORT ast parseSchemaFile(
Expand Down
6 changes: 1 addition & 5 deletions include/graphqlservice/Parse.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ using peg::ast_node;
using peg::ast_input;
using peg::ast;

namespace constants {

constexpr std::size_t c_defaultDepthLimit = peg::c_defaultDepthLimit;

} // namespace constants
constexpr std::size_t c_defaultDepthLimit = constants::c_defaultDepthLimit;

using peg::parseSchemaString;
using peg::parseSchemaFile;
Expand Down
2 changes: 1 addition & 1 deletion include/graphqlservice/Response.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module;

export module GraphQL.Response;

namespace included = graphql::response;
export import GraphQL.Internal.Awaitable;

export namespace graphql::response {

Expand Down
3 changes: 3 additions & 0 deletions include/graphqlservice/Service.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export module GraphQL.Service;
export import GraphQL.Parse;
export import GraphQL.Response;

export import GraphQL.Internal.Awaitable;
export import GraphQL.Internal.SortedMap;

export namespace graphql {

namespace schema {
Expand Down
8 changes: 4 additions & 4 deletions include/graphqlservice/internal/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ namespace graphql::internal {

inline namespace version {

constexpr std::string_view FullVersion { "4.5.8" };
constexpr std::string_view FullVersion { "5.0.0" };

constexpr std::size_t MajorVersion = 4;
constexpr std::size_t MinorVersion = 5;
constexpr std::size_t PatchVersion = 8;
constexpr std::size_t MajorVersion = 5;
constexpr std::size_t MinorVersion = 0;
constexpr std::size_t PatchVersion = 0;

} // namespace version

Expand Down
6 changes: 3 additions & 3 deletions include/graphqlservice/introspection/IntrospectionSchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include <string>
#include <string_view>

// Check if the library version is compatible with schemagen 4.5.0
static_assert(graphql::internal::MajorVersion == 4, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 5, "regenerate with schemagen: minor version mismatch");
// Check if the library version is compatible with schemagen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql {
namespace introspection {
Expand Down
4 changes: 2 additions & 2 deletions res/ClientGen.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <winver.h>

#define GRAPHQL_RC_VERSION 4,5,8,0
#define GRAPHQL_RC_VERSION_STR "4.5.8"
#define GRAPHQL_RC_VERSION 5,0,0,0
#define GRAPHQL_RC_VERSION_STR "5.0.0"

#ifndef DEBUG
#define VER_DEBUG 0
Expand Down
4 changes: 2 additions & 2 deletions res/SchemaGen.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <winver.h>

#define GRAPHQL_RC_VERSION 4,5,8,0
#define GRAPHQL_RC_VERSION_STR "4.5.8"
#define GRAPHQL_RC_VERSION 5,0,0,0
#define GRAPHQL_RC_VERSION_STR "5.0.0"

#ifndef DEBUG
#define VER_DEBUG 0
Expand Down
4 changes: 2 additions & 2 deletions res/graphqlclient_version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <winver.h>

#define GRAPHQL_RC_VERSION 4,5,8,0
#define GRAPHQL_RC_VERSION_STR "4.5.8"
#define GRAPHQL_RC_VERSION 5,0,0,0
#define GRAPHQL_RC_VERSION_STR "5.0.0"

#ifndef DEBUG
#define VER_DEBUG 0
Expand Down
4 changes: 2 additions & 2 deletions res/graphqljson_version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <winver.h>

#define GRAPHQL_RC_VERSION 4,5,8,0
#define GRAPHQL_RC_VERSION_STR "4.5.8"
#define GRAPHQL_RC_VERSION 5,0,0,0
#define GRAPHQL_RC_VERSION_STR "5.0.0"

#ifndef DEBUG
#define VER_DEBUG 0
Expand Down
4 changes: 2 additions & 2 deletions res/graphqlpeg_version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <winver.h>

#define GRAPHQL_RC_VERSION 4,5,8,0
#define GRAPHQL_RC_VERSION_STR "4.5.8"
#define GRAPHQL_RC_VERSION 5,0,0,0
#define GRAPHQL_RC_VERSION_STR "5.0.0"

#ifndef DEBUG
#define VER_DEBUG 0
Expand Down
4 changes: 2 additions & 2 deletions res/graphqlresponse_version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <winver.h>

#define GRAPHQL_RC_VERSION 4,5,8,0
#define GRAPHQL_RC_VERSION_STR "4.5.8"
#define GRAPHQL_RC_VERSION 5,0,0,0
#define GRAPHQL_RC_VERSION_STR "5.0.0"

#ifndef DEBUG
#define VER_DEBUG 0
Expand Down
4 changes: 2 additions & 2 deletions res/graphqlservice_version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <winver.h>

#define GRAPHQL_RC_VERSION 4,5,8,0
#define GRAPHQL_RC_VERSION_STR "4.5.8"
#define GRAPHQL_RC_VERSION 5,0,0,0
#define GRAPHQL_RC_VERSION_STR "5.0.0"

#ifndef DEBUG
#define VER_DEBUG 0
Expand Down
20 changes: 5 additions & 15 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,12 @@ endif()

if(GRAPHQL_BUILD_HTTP_SAMPLE)
find_package(boost_beast CONFIG QUIET)
if(Boost_FOUND)
if(Boost_VERSION VERSION_GREATER_EQUAL "1.81.0")
try_compile(TEST_RESULT
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../cmake/test_boost_beast.cpp
CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=${Boost_INCLUDE_DIRS}
CXX_STANDARD 20)

if(TEST_RESULT)
message(STATUS "Using Boost.Beast ${Boost_VERSION}")
add_subdirectory(proxy)
else()
message(WARNING "GRAPHQL_BUILD_HTTP_SAMPLE requires the Boost.Beast header-only library and a toolchain that supports co_await in Boost.Asio.")
endif()
if(boost_beast_FOUND)
if(boost_beast_VERSION VERSION_GREATER_EQUAL "1.81.0")
message(STATUS "Using Boost.Beast ${boost_beast_VERSION}")
add_subdirectory(proxy)
else()
message(WARNING "GRAPHQL_BUILD_HTTP_SAMPLE requires the Boost.Beast header-only library >= 1.81.0, but only ${Boost_VERSION} was found in ${Boost_INCLUDE_DIR}.")
message(WARNING "GRAPHQL_BUILD_HTTP_SAMPLE requires the Boost.Beast header-only library >= 1.81.0, but only ${boost_beast_VERSION} was found.")
endif()
endif()
endif()
6 changes: 3 additions & 3 deletions samples/client/benchmark/BenchmarkClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <string>
#include <vector>

// Check if the library version is compatible with clientgen 4.5.0
static_assert(graphql::internal::MajorVersion == 4, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 5, "regenerate with clientgen: minor version mismatch");
// Check if the library version is compatible with clientgen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");

namespace graphql::client {

Expand Down
1 change: 0 additions & 1 deletion samples/client/benchmark/BenchmarkClient.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export module GraphQL.Benchmark.BenchmarkClient;

export namespace graphql::client {


namespace benchmark {

using benchmark::GetRequestText;
Expand Down
6 changes: 3 additions & 3 deletions samples/client/multiple/MultipleQueriesClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <string>
#include <vector>

// Check if the library version is compatible with clientgen 4.5.0
static_assert(graphql::internal::MajorVersion == 4, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 5, "regenerate with clientgen: minor version mismatch");
// Check if the library version is compatible with clientgen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");

namespace graphql::client {

Expand Down
1 change: 0 additions & 1 deletion samples/client/multiple/MultipleQueriesClient.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export module GraphQL.MultipleQueries.MultipleQueriesClient;

export namespace graphql::client {


namespace multiple {

using multiple::GetRequestText;
Expand Down
6 changes: 3 additions & 3 deletions samples/client/mutate/MutateClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <string>
#include <vector>

// Check if the library version is compatible with clientgen 4.5.0
static_assert(graphql::internal::MajorVersion == 4, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 5, "regenerate with clientgen: minor version mismatch");
// Check if the library version is compatible with clientgen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");

namespace graphql::client {

Expand Down
1 change: 0 additions & 1 deletion samples/client/mutate/MutateClient.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export module GraphQL.Mutate.MutateClient;

export namespace graphql::client {


namespace mutate {

using mutate::GetRequestText;
Expand Down
6 changes: 3 additions & 3 deletions samples/client/nestedinput/NestedInputClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <string>
#include <vector>

// Check if the library version is compatible with clientgen 4.5.0
static_assert(graphql::internal::MajorVersion == 4, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 5, "regenerate with clientgen: minor version mismatch");
// Check if the library version is compatible with clientgen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");

namespace graphql::client {

Expand Down
1 change: 0 additions & 1 deletion samples/client/nestedinput/NestedInputClient.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export module GraphQL.NestedInput.NestedInputClient;

export namespace graphql::client {


namespace nestedinput {

using nestedinput::GetRequestText;
Expand Down
6 changes: 3 additions & 3 deletions samples/client/query/QueryClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <string>
#include <vector>

// Check if the library version is compatible with clientgen 4.5.0
static_assert(graphql::internal::MajorVersion == 4, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 5, "regenerate with clientgen: minor version mismatch");
// Check if the library version is compatible with clientgen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");

namespace graphql::client {

Expand Down
1 change: 0 additions & 1 deletion samples/client/query/QueryClient.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export module GraphQL.Query.QueryClient;

export namespace graphql::client {


namespace query {

using query::GetRequestText;
Expand Down
6 changes: 3 additions & 3 deletions samples/client/subscribe/SubscribeClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <string>
#include <vector>

// Check if the library version is compatible with clientgen 4.5.0
static_assert(graphql::internal::MajorVersion == 4, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 5, "regenerate with clientgen: minor version mismatch");
// Check if the library version is compatible with clientgen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");

namespace graphql::client {

Expand Down
1 change: 0 additions & 1 deletion samples/client/subscribe/SubscribeClient.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export module GraphQL.Subscribe.SubscribeClient;

export namespace graphql::client {


namespace subscribe {

using subscribe::GetRequestText;
Expand Down
6 changes: 3 additions & 3 deletions samples/learn/schema/StarWarsSchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include <string>
#include <string_view>

// Check if the library version is compatible with schemagen 4.5.0
static_assert(graphql::internal::MajorVersion == 4, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 5, "regenerate with schemagen: minor version mismatch");
// Check if the library version is compatible with schemagen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with schemagen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");

namespace graphql {
namespace learn {
Expand Down
6 changes: 3 additions & 3 deletions samples/proxy/query/ProxyClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <string>
#include <vector>

// Check if the library version is compatible with clientgen 4.5.0
static_assert(graphql::internal::MajorVersion == 4, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 5, "regenerate with clientgen: minor version mismatch");
// Check if the library version is compatible with clientgen 5.0.0
static_assert(graphql::internal::MajorVersion == 5, "regenerate with clientgen: major version mismatch");
static_assert(graphql::internal::MinorVersion == 0, "regenerate with clientgen: minor version mismatch");

namespace graphql::client {

Expand Down
1 change: 0 additions & 1 deletion samples/proxy/query/ProxyClient.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export module GraphQL.Proxy.ProxyClient;

export namespace graphql::client {


namespace proxy {

using proxy::GetRequestText;
Expand Down
Loading

0 comments on commit e1636d2

Please sign in to comment.