Skip to content

Commit 8a80e24

Browse files
committed
Fix #196 remove separate introspection support lib
1 parent bd693e0 commit 8a80e24

26 files changed

+103
-233
lines changed

cmake/cppgraphqlgen-config.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ The following import targets are created:
1212
cppgraphqlgen::graphqlpeg
1313
cppgraphqlgen::graphqlresponse
1414
cppgraphqlgen::graphqlservice
15-
cppgraphqlgen::graphqlintrospection
1615
cppgraphqlgen::graphqljson
16+
cppgraphqlgen::graphqlclient
1717
cppgraphqlgen::schemagen
1818
cppgraphqlgen::clientgen
1919
@@ -23,7 +23,6 @@ The following functions are defined to help with code generation and build targe
2323
2424
update_graphql_schema_files
2525
add_graphql_schema_target
26-
add_graphql_schema_no_introspection_target
2726
update_graphql_client_files
2827
add_graphql_client_target
2928
#]=======================================================================]

cmake/cppgraphqlgen-functions.cmake

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,7 @@ function(add_graphql_schema_target SCHEMA_TARGET)
4747
add_library(${SCHEMA_TARGET}_schema STATIC ${SCHEMA_FILES})
4848
add_dependencies(${SCHEMA_TARGET}_schema ${SCHEMA_TARGET}_update_schema)
4949
target_include_directories(${SCHEMA_TARGET}_schema PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
50-
target_link_libraries(${SCHEMA_TARGET}_schema PUBLIC cppgraphqlgen::graphqlintrospection)
51-
endif()
52-
endfunction()
53-
54-
function(add_graphql_schema_no_introspection_target SCHEMA_NO_INTROSPECTION_TARGET)
55-
add_custom_target(${SCHEMA_NO_INTROSPECTION_TARGET}_update_schema ALL
56-
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NO_INTROSPECTION_TARGET}_schema_files)
57-
58-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NO_INTROSPECTION_TARGET}_schema_files)
59-
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NO_INTROSPECTION_TARGET}_schema_files SCHEMA_FILES)
60-
add_library(${SCHEMA_NO_INTROSPECTION_TARGET}_schema STATIC ${SCHEMA_FILES})
61-
add_dependencies(${SCHEMA_NO_INTROSPECTION_TARGET}_schema ${SCHEMA_NO_INTROSPECTION_TARGET}_update_schema)
62-
target_include_directories(${SCHEMA_NO_INTROSPECTION_TARGET}_schema PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
63-
target_link_libraries(${SCHEMA_NO_INTROSPECTION_TARGET}_schema PUBLIC cppgraphqlgen::graphqlservice)
50+
target_link_libraries(${SCHEMA_TARGET}_schema PUBLIC cppgraphqlgen::graphqlservice)
6451
endif()
6552
endfunction()
6653

include/graphqlservice/internal/Introspection.h

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ class EnumValue;
2222
class Schema
2323
{
2424
public:
25-
GRAPHQLINTROSPECTION_EXPORT explicit Schema(const std::shared_ptr<schema::Schema>& schema);
25+
GRAPHQLSERVICE_EXPORT explicit Schema(const std::shared_ptr<schema::Schema>& schema);
2626

2727
// Accessors
28-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getDescription() const;
29-
GRAPHQLINTROSPECTION_EXPORT std::vector<std::shared_ptr<object::Type>> getTypes() const;
30-
GRAPHQLINTROSPECTION_EXPORT std::shared_ptr<object::Type> getQueryType() const;
31-
GRAPHQLINTROSPECTION_EXPORT std::shared_ptr<object::Type> getMutationType() const;
32-
GRAPHQLINTROSPECTION_EXPORT std::shared_ptr<object::Type> getSubscriptionType() const;
33-
GRAPHQLINTROSPECTION_EXPORT std::vector<std::shared_ptr<object::Directive>> getDirectives()
28+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getDescription() const;
29+
GRAPHQLSERVICE_EXPORT std::vector<std::shared_ptr<object::Type>> getTypes() const;
30+
GRAPHQLSERVICE_EXPORT std::shared_ptr<object::Type> getQueryType() const;
31+
GRAPHQLSERVICE_EXPORT std::shared_ptr<object::Type> getMutationType() const;
32+
GRAPHQLSERVICE_EXPORT std::shared_ptr<object::Type> getSubscriptionType() const;
33+
GRAPHQLSERVICE_EXPORT std::vector<std::shared_ptr<object::Directive>> getDirectives()
3434
const;
3535

3636
private:
@@ -40,24 +40,24 @@ class Schema
4040
class Type
4141
{
4242
public:
43-
GRAPHQLINTROSPECTION_EXPORT explicit Type(const std::shared_ptr<const schema::BaseType>& type);
43+
GRAPHQLSERVICE_EXPORT explicit Type(const std::shared_ptr<const schema::BaseType>& type);
4444

4545
// Accessors
46-
GRAPHQLINTROSPECTION_EXPORT TypeKind getKind() const;
47-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getName() const;
48-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getDescription() const;
49-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::vector<std::shared_ptr<object::Field>>>
46+
GRAPHQLSERVICE_EXPORT TypeKind getKind() const;
47+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getName() const;
48+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getDescription() const;
49+
GRAPHQLSERVICE_EXPORT std::optional<std::vector<std::shared_ptr<object::Field>>>
5050
getFields(std::optional<bool>&& includeDeprecatedArg) const;
51-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::vector<std::shared_ptr<object::Type>>>
51+
GRAPHQLSERVICE_EXPORT std::optional<std::vector<std::shared_ptr<object::Type>>>
5252
getInterfaces() const;
53-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::vector<std::shared_ptr<object::Type>>>
53+
GRAPHQLSERVICE_EXPORT std::optional<std::vector<std::shared_ptr<object::Type>>>
5454
getPossibleTypes() const;
55-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::vector<std::shared_ptr<object::EnumValue>>>
55+
GRAPHQLSERVICE_EXPORT std::optional<std::vector<std::shared_ptr<object::EnumValue>>>
5656
getEnumValues(std::optional<bool>&& includeDeprecatedArg) const;
57-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::vector<std::shared_ptr<object::InputValue>>>
57+
GRAPHQLSERVICE_EXPORT std::optional<std::vector<std::shared_ptr<object::InputValue>>>
5858
getInputFields() const;
59-
GRAPHQLINTROSPECTION_EXPORT std::shared_ptr<object::Type> getOfType() const;
60-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getSpecifiedByURL() const;
59+
GRAPHQLSERVICE_EXPORT std::shared_ptr<object::Type> getOfType() const;
60+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getSpecifiedByURL() const;
6161

6262
private:
6363
const std::shared_ptr<const schema::BaseType> _type;
@@ -66,15 +66,15 @@ class Type
6666
class Field
6767
{
6868
public:
69-
GRAPHQLINTROSPECTION_EXPORT explicit Field(const std::shared_ptr<const schema::Field>& field);
69+
GRAPHQLSERVICE_EXPORT explicit Field(const std::shared_ptr<const schema::Field>& field);
7070

7171
// Accessors
72-
GRAPHQLINTROSPECTION_EXPORT std::string getName() const;
73-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getDescription() const;
74-
GRAPHQLINTROSPECTION_EXPORT std::vector<std::shared_ptr<object::InputValue>> getArgs() const;
75-
GRAPHQLINTROSPECTION_EXPORT std::shared_ptr<object::Type> getType() const;
76-
GRAPHQLINTROSPECTION_EXPORT bool getIsDeprecated() const;
77-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getDeprecationReason() const;
72+
GRAPHQLSERVICE_EXPORT std::string getName() const;
73+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getDescription() const;
74+
GRAPHQLSERVICE_EXPORT std::vector<std::shared_ptr<object::InputValue>> getArgs() const;
75+
GRAPHQLSERVICE_EXPORT std::shared_ptr<object::Type> getType() const;
76+
GRAPHQLSERVICE_EXPORT bool getIsDeprecated() const;
77+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getDeprecationReason() const;
7878

7979
private:
8080
const std::shared_ptr<const schema::Field> _field;
@@ -83,14 +83,14 @@ class Field
8383
class InputValue
8484
{
8585
public:
86-
GRAPHQLINTROSPECTION_EXPORT explicit InputValue(
86+
GRAPHQLSERVICE_EXPORT explicit InputValue(
8787
const std::shared_ptr<const schema::InputValue>& inputValue);
8888

8989
// Accessors
90-
GRAPHQLINTROSPECTION_EXPORT std::string getName() const;
91-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getDescription() const;
92-
GRAPHQLINTROSPECTION_EXPORT std::shared_ptr<object::Type> getType() const;
93-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getDefaultValue() const;
90+
GRAPHQLSERVICE_EXPORT std::string getName() const;
91+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getDescription() const;
92+
GRAPHQLSERVICE_EXPORT std::shared_ptr<object::Type> getType() const;
93+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getDefaultValue() const;
9494

9595
private:
9696
const std::shared_ptr<const schema::InputValue> _inputValue;
@@ -99,14 +99,14 @@ class InputValue
9999
class EnumValue
100100
{
101101
public:
102-
GRAPHQLINTROSPECTION_EXPORT explicit EnumValue(
102+
GRAPHQLSERVICE_EXPORT explicit EnumValue(
103103
const std::shared_ptr<const schema::EnumValue>& enumValue);
104104

105105
// Accessors
106-
GRAPHQLINTROSPECTION_EXPORT std::string getName() const;
107-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getDescription() const;
108-
GRAPHQLINTROSPECTION_EXPORT bool getIsDeprecated() const;
109-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getDeprecationReason() const;
106+
GRAPHQLSERVICE_EXPORT std::string getName() const;
107+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getDescription() const;
108+
GRAPHQLSERVICE_EXPORT bool getIsDeprecated() const;
109+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getDeprecationReason() const;
110110

111111
private:
112112
const std::shared_ptr<const schema::EnumValue> _enumValue;
@@ -115,15 +115,15 @@ class EnumValue
115115
class Directive
116116
{
117117
public:
118-
GRAPHQLINTROSPECTION_EXPORT explicit Directive(
118+
GRAPHQLSERVICE_EXPORT explicit Directive(
119119
const std::shared_ptr<const schema::Directive>& directive);
120120

121121
// Accessors
122-
GRAPHQLINTROSPECTION_EXPORT std::string getName() const;
123-
GRAPHQLINTROSPECTION_EXPORT std::optional<std::string> getDescription() const;
124-
GRAPHQLINTROSPECTION_EXPORT std::vector<DirectiveLocation> getLocations() const;
125-
GRAPHQLINTROSPECTION_EXPORT std::vector<std::shared_ptr<object::InputValue>> getArgs() const;
126-
GRAPHQLINTROSPECTION_EXPORT bool getIsRepeatable() const;
122+
GRAPHQLSERVICE_EXPORT std::string getName() const;
123+
GRAPHQLSERVICE_EXPORT std::optional<std::string> getDescription() const;
124+
GRAPHQLSERVICE_EXPORT std::vector<DirectiveLocation> getLocations() const;
125+
GRAPHQLSERVICE_EXPORT std::vector<std::shared_ptr<object::InputValue>> getArgs() const;
126+
GRAPHQLSERVICE_EXPORT bool getIsRepeatable() const;
127127

128128
private:
129129
const std::shared_ptr<const schema::Directive> _directive;

include/graphqlservice/introspection/DirectiveObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class Directive
7979
service::ResolverMap getResolvers() const noexcept;
8080

8181
public:
82-
GRAPHQLINTROSPECTION_EXPORT Directive(std::shared_ptr<introspection::Directive> pimpl) noexcept;
83-
GRAPHQLINTROSPECTION_EXPORT ~Directive();
82+
GRAPHQLSERVICE_EXPORT Directive(std::shared_ptr<introspection::Directive> pimpl) noexcept;
83+
GRAPHQLSERVICE_EXPORT ~Directive();
8484
};
8585

8686
} // namespace graphql::introspection::object

include/graphqlservice/introspection/EnumValueObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ class EnumValue
7272
service::ResolverMap getResolvers() const noexcept;
7373

7474
public:
75-
GRAPHQLINTROSPECTION_EXPORT EnumValue(std::shared_ptr<introspection::EnumValue> pimpl) noexcept;
76-
GRAPHQLINTROSPECTION_EXPORT ~EnumValue();
75+
GRAPHQLSERVICE_EXPORT EnumValue(std::shared_ptr<introspection::EnumValue> pimpl) noexcept;
76+
GRAPHQLSERVICE_EXPORT ~EnumValue();
7777
};
7878

7979
} // namespace graphql::introspection::object

include/graphqlservice/introspection/FieldObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class Field
8686
service::ResolverMap getResolvers() const noexcept;
8787

8888
public:
89-
GRAPHQLINTROSPECTION_EXPORT Field(std::shared_ptr<introspection::Field> pimpl) noexcept;
90-
GRAPHQLINTROSPECTION_EXPORT ~Field();
89+
GRAPHQLSERVICE_EXPORT Field(std::shared_ptr<introspection::Field> pimpl) noexcept;
90+
GRAPHQLSERVICE_EXPORT ~Field();
9191
};
9292

9393
} // namespace graphql::introspection::object

include/graphqlservice/introspection/InputValueObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ class InputValue
7272
service::ResolverMap getResolvers() const noexcept;
7373

7474
public:
75-
GRAPHQLINTROSPECTION_EXPORT InputValue(std::shared_ptr<introspection::InputValue> pimpl) noexcept;
76-
GRAPHQLINTROSPECTION_EXPORT ~InputValue();
75+
GRAPHQLSERVICE_EXPORT InputValue(std::shared_ptr<introspection::InputValue> pimpl) noexcept;
76+
GRAPHQLSERVICE_EXPORT ~InputValue();
7777
};
7878

7979
} // namespace graphql::introspection::object

include/graphqlservice/introspection/IntrospectionSchema.h

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@
1414
static_assert(graphql::internal::MajorVersion == 4, "regenerate with schemagen: major version mismatch");
1515
static_assert(graphql::internal::MinorVersion == 0, "regenerate with schemagen: minor version mismatch");
1616

17-
// clang-format off
18-
#ifdef GRAPHQL_DLLEXPORTS
19-
#ifdef IMPL_GRAPHQLINTROSPECTION_DLL
20-
#define GRAPHQLINTROSPECTION_EXPORT __declspec(dllexport)
21-
#else // !IMPL_GRAPHQLINTROSPECTION_DLL
22-
#define GRAPHQLINTROSPECTION_EXPORT __declspec(dllimport)
23-
#endif // !IMPL_GRAPHQLINTROSPECTION_DLL
24-
#else // !GRAPHQL_DLLEXPORTS
25-
#define GRAPHQLINTROSPECTION_EXPORT
26-
#endif // !GRAPHQL_DLLEXPORTS
27-
// clang-format on
28-
2917
#include <memory>
3018
#include <string>
3119
#include <vector>
@@ -93,7 +81,7 @@ void AddInputValueDetails(const std::shared_ptr<schema::ObjectType>& typeInputVa
9381
void AddEnumValueDetails(const std::shared_ptr<schema::ObjectType>& typeEnumValue, const std::shared_ptr<schema::Schema>& schema);
9482
void AddDirectiveDetails(const std::shared_ptr<schema::ObjectType>& typeDirective, const std::shared_ptr<schema::Schema>& schema);
9583

96-
GRAPHQLINTROSPECTION_EXPORT void AddTypesToSchema(const std::shared_ptr<schema::Schema>& schema);
84+
GRAPHQLSERVICE_EXPORT void AddTypesToSchema(const std::shared_ptr<schema::Schema>& schema);
9785

9886
} // namespace introspection
9987

@@ -102,22 +90,22 @@ namespace service {
10290
#ifdef GRAPHQL_DLLEXPORTS
10391
// Export all of the built-in converters
10492
template <>
105-
GRAPHQLINTROSPECTION_EXPORT introspection::TypeKind ModifiedArgument<introspection::TypeKind>::convert(
93+
GRAPHQLSERVICE_EXPORT introspection::TypeKind ModifiedArgument<introspection::TypeKind>::convert(
10694
const response::Value& value);
10795
template <>
108-
GRAPHQLINTROSPECTION_EXPORT AwaitableResolver ModifiedResult<introspection::TypeKind>::convert(
96+
GRAPHQLSERVICE_EXPORT AwaitableResolver ModifiedResult<introspection::TypeKind>::convert(
10997
AwaitableScalar<introspection::TypeKind> result, ResolverParams params);
11098
template <>
111-
GRAPHQLINTROSPECTION_EXPORT void ModifiedResult<introspection::TypeKind>::validateScalar(
99+
GRAPHQLSERVICE_EXPORT void ModifiedResult<introspection::TypeKind>::validateScalar(
112100
const response::Value& value);
113101
template <>
114-
GRAPHQLINTROSPECTION_EXPORT introspection::DirectiveLocation ModifiedArgument<introspection::DirectiveLocation>::convert(
102+
GRAPHQLSERVICE_EXPORT introspection::DirectiveLocation ModifiedArgument<introspection::DirectiveLocation>::convert(
115103
const response::Value& value);
116104
template <>
117-
GRAPHQLINTROSPECTION_EXPORT AwaitableResolver ModifiedResult<introspection::DirectiveLocation>::convert(
105+
GRAPHQLSERVICE_EXPORT AwaitableResolver ModifiedResult<introspection::DirectiveLocation>::convert(
118106
AwaitableScalar<introspection::DirectiveLocation> result, ResolverParams params);
119107
template <>
120-
GRAPHQLINTROSPECTION_EXPORT void ModifiedResult<introspection::DirectiveLocation>::validateScalar(
108+
GRAPHQLSERVICE_EXPORT void ModifiedResult<introspection::DirectiveLocation>::validateScalar(
121109
const response::Value& value);
122110
#endif // GRAPHQL_DLLEXPORTS
123111

include/graphqlservice/introspection/SchemaObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class Schema
8686
service::ResolverMap getResolvers() const noexcept;
8787

8888
public:
89-
GRAPHQLINTROSPECTION_EXPORT Schema(std::shared_ptr<introspection::Schema> pimpl) noexcept;
90-
GRAPHQLINTROSPECTION_EXPORT ~Schema();
89+
GRAPHQLSERVICE_EXPORT Schema(std::shared_ptr<introspection::Schema> pimpl) noexcept;
90+
GRAPHQLSERVICE_EXPORT ~Schema();
9191
};
9292

9393
} // namespace graphql::introspection::object

include/graphqlservice/introspection/TypeObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ class Type
114114
service::ResolverMap getResolvers() const noexcept;
115115

116116
public:
117-
GRAPHQLINTROSPECTION_EXPORT Type(std::shared_ptr<introspection::Type> pimpl) noexcept;
118-
GRAPHQLINTROSPECTION_EXPORT ~Type();
117+
GRAPHQLSERVICE_EXPORT Type(std::shared_ptr<introspection::Type> pimpl) noexcept;
118+
GRAPHQLSERVICE_EXPORT ~Type();
119119
};
120120

121121
} // namespace graphql::introspection::object

0 commit comments

Comments
 (0)