Skip to content

Commit 22dad2c

Browse files
committed
Move the client and server samples to the same directory
1 parent 562ef79 commit 22dad2c

16 files changed

+40
-48
lines changed

samples/learn/CMakeLists.txt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,13 @@ add_library(star_wars STATIC
1414
StarWarsData.cpp)
1515
target_link_libraries(star_wars PUBLIC learn_schema)
1616
target_include_directories(star_wars PUBLIC star_wars)
17+
target_include_directories(star_wars INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
1718

1819
add_executable(learn_star_wars sample.cpp)
1920
target_link_libraries(learn_star_wars PRIVATE
2021
star_wars
2122
graphqljson)
2223

23-
if(GRAPHQL_BUILD_HTTP_SAMPLE)
24-
find_package(Boost)
25-
if(Boost_FOUND)
26-
add_executable(server server.cpp)
27-
target_link_libraries(server PRIVATE
28-
star_wars
29-
graphqljson)
30-
endif()
31-
endif()
32-
3324
if(WIN32 AND BUILD_SHARED_LIBS)
3425
add_custom_command(OUTPUT copied_sample_dlls
3526
COMMAND ${CMAKE_COMMAND} -E copy_if_different
@@ -48,8 +39,4 @@ if(WIN32 AND BUILD_SHARED_LIBS)
4839
add_custom_target(copy_learn_sample_dlls DEPENDS copied_sample_dlls)
4940

5041
add_dependencies(learn_star_wars copy_learn_sample_dlls)
51-
52-
if(GRAPHQL_BUILD_HTTP_SAMPLE AND Boost_FOUND)
53-
add_dependencies(server copy_learn_sample_dlls)
54-
endif()
5542
endif()

samples/proxy/CMakeLists.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@
33

44
cmake_minimum_required(VERSION 3.15)
55

6+
add_subdirectory(query)
67
add_subdirectory(schema)
7-
add_subdirectory(client)
88

9-
add_executable(proxy proxy.cpp)
10-
target_link_libraries(proxy PRIVATE
9+
add_executable(client client.cpp)
10+
target_link_libraries(client PRIVATE
1111
proxy_schema
12-
proxyrelay_client
12+
proxy_client
13+
graphqljson)
14+
target_include_directories(client PRIVATE
15+
proxy_schema
16+
proxy_client)
17+
18+
add_executable(server server.cpp)
19+
target_link_libraries(server PRIVATE
20+
star_wars
1321
graphqljson)
14-
target_include_directories(proxy PRIVATE
15-
client
16-
schema)
1722

1823
if(WIN32 AND BUILD_SHARED_LIBS)
1924
add_custom_command(OUTPUT copied_sample_dlls
@@ -34,5 +39,6 @@ if(WIN32 AND BUILD_SHARED_LIBS)
3439

3540
add_custom_target(copy_proxy_sample_dlls DEPENDS copied_sample_dlls)
3641

37-
add_dependencies(proxy copy_proxy_sample_dlls)
42+
add_dependencies(client copy_proxy_sample_dlls)
43+
add_dependencies(server copy_proxy_sample_dlls)
3844
endif()
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
#include "HttpProxySchema.h"
5-
#include "QueryObject.h"
4+
#include "query/ProxyClient.h"
65

7-
#include "ProxyRelayClient.h"
6+
#include "schema/ProxySchema.h"
7+
#include "schema/QueryObject.h"
88

99
#include "graphqlservice/JSONResponse.h"
1010

@@ -178,7 +178,6 @@ int main(int argc, char** argv)
178178
auto query = GetRequestObject();
179179
auto variables = serializeVariables(
180180
{ input, ((argc > 1) ? std::make_optional(argv[1]) : std::nullopt) });
181-
182181
auto launch = service::await_async { std::make_shared<service::await_worker_queue>() };
183182
auto serviceResponse = client::parseServiceResponse(
184183
service->resolve({ query, GetOperationName(), std::move(variables), launch }).get());

samples/proxy/client/proxyrelay_client_files

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.15)
77
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/cppgraphqlgen-functions.cmake)
88

99
if(GRAPHQL_UPDATE_SAMPLES AND GRAPHQL_BUILD_CLIENTGEN)
10-
update_graphql_client_files(proxyrelay ../schema/schema.proxy.graphql query.relay.graphql ProxyRelay proxyrelay)
10+
update_graphql_client_files(proxy ../schema/schema.graphql query.graphql Proxy proxy)
1111
endif()
1212

13-
add_graphql_client_target(proxyrelay)
13+
add_graphql_client_target(proxy)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// WARNING! Do not edit this file manually, your changes will be overwritten.
55

6-
#include "ProxyRelayClient.h"
6+
#include "ProxyClient.h"
77

88
#include "graphqlservice/internal/SortedMap.h"
99

@@ -17,7 +17,7 @@
1717
using namespace std::literals;
1818

1919
namespace graphql::client {
20-
namespace proxyrelay {
20+
namespace proxy {
2121

2222
const std::string& GetRequestText() noexcept
2323
{
@@ -47,9 +47,9 @@ const peg::ast& GetRequestObject() noexcept
4747
return s_request;
4848
}
4949

50-
} // namespace proxyrelay
50+
} // namespace proxy
5151

52-
using namespace proxyrelay;
52+
using namespace proxy;
5353

5454
namespace query::relayQuery {
5555

@@ -94,12 +94,12 @@ Response parseResponse(response::Value&& response)
9494

9595
[[nodiscard]] const std::string& Traits::GetRequestText() noexcept
9696
{
97-
return proxyrelay::GetRequestText();
97+
return proxy::GetRequestText();
9898
}
9999

100100
[[nodiscard]] const peg::ast& Traits::GetRequestObject() noexcept
101101
{
102-
return proxyrelay::GetRequestObject();
102+
return proxy::GetRequestObject();
103103
}
104104

105105
[[nodiscard]] const std::string& Traits::GetOperationName() noexcept
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
#pragma once
77

8-
#ifndef PROXYRELAYCLIENT_H
9-
#define PROXYRELAYCLIENT_H
8+
#ifndef PROXYCLIENT_H
9+
#define PROXYCLIENT_H
1010

1111
#include "graphqlservice/GraphQLClient.h"
1212
#include "graphqlservice/GraphQLParse.h"
@@ -35,20 +35,20 @@ namespace graphql::client {
3535
/// relay(query: $query, operationName: $operationName, variables: $variables)
3636
/// }
3737
/// </code>
38-
namespace proxyrelay {
38+
namespace proxy {
3939

4040
// Return the original text of the request document.
4141
[[nodiscard]] const std::string& GetRequestText() noexcept;
4242

4343
// Return a pre-parsed, pre-validated request object.
4444
[[nodiscard]] const peg::ast& GetRequestObject() noexcept;
4545

46-
} // namespace proxyrelay
46+
} // namespace proxy
4747

4848
namespace query::relayQuery {
4949

50-
using proxyrelay::GetRequestText;
51-
using proxyrelay::GetRequestObject;
50+
using proxy::GetRequestText;
51+
using proxy::GetRequestObject;
5252

5353
// Return the name of this operation in the shared request document.
5454
[[nodiscard]] const std::string& GetOperationName() noexcept;
@@ -87,4 +87,4 @@ struct Traits
8787
} // namespace query::relayQuery
8888
} // namespace graphql::client
8989

90-
#endif // PROXYRELAYCLIENT_H
90+
#endif // PROXYCLIENT_H
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ProxyClient.cpp

samples/proxy/schema/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.15)
77
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/cppgraphqlgen-functions.cmake)
88

99
if(GRAPHQL_UPDATE_SAMPLES)
10-
update_graphql_schema_files(proxy schema.proxy.graphql HttpProxy proxy)
10+
update_graphql_schema_files(proxy schema.graphql Proxy proxy)
1111
endif()
1212

1313
add_graphql_schema_target(proxy)

0 commit comments

Comments
 (0)