Skip to content

Commit bf54cd3

Browse files
committed
Make transcoding buildable
1 parent 6960ceb commit bf54cd3

31 files changed

+453
-75
lines changed

BUILD

Lines changed: 377 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,377 @@
1+
# Copyright (C) Extensible Service Proxy Authors
2+
# All rights reserved.
3+
#
4+
# Redistribution and use in source and binary forms, with or without
5+
# modification, are permitted provided that the following conditions
6+
# are met:
7+
# 1. Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
# 2. Redistributions in binary form must reproduce the above copyright
10+
# notice, this list of conditions and the following disclaimer in the
11+
# documentation and/or other materials provided with the distribution.
12+
#
13+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19+
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20+
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22+
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23+
# SUCH DAMAGE.
24+
#
25+
################################################################################
26+
#
27+
package(default_visibility = ["//visibility:private"])
28+
29+
load("@protobuf_git//:protobuf.bzl", "cc_proto_library")
30+
31+
cc_library(
32+
name = "prefix_writer",
33+
srcs = [
34+
"prefix_writer.cc",
35+
],
36+
hdrs = [
37+
"prefix_writer.h",
38+
],
39+
deps = [
40+
"//external:protobuf",
41+
],
42+
)
43+
44+
cc_library(
45+
name = "request_weaver",
46+
srcs = [
47+
"request_weaver.cc",
48+
],
49+
hdrs = [
50+
"request_weaver.h",
51+
],
52+
deps = [
53+
"//external:protobuf",
54+
],
55+
)
56+
57+
cc_library(
58+
name = "type_helper",
59+
srcs = [
60+
"type_helper.cc",
61+
],
62+
hdrs = [
63+
"type_helper.h",
64+
],
65+
deps = [
66+
"//external:protobuf",
67+
"//contrib/endpoints/include:headers_only",
68+
],
69+
)
70+
71+
cc_library(
72+
name = "message_stream",
73+
srcs = [
74+
"message_stream.cc",
75+
],
76+
hdrs = [
77+
"message_stream.h",
78+
],
79+
deps = [
80+
"//external:protobuf",
81+
],
82+
)
83+
84+
cc_library(
85+
name = "request_message_translator",
86+
srcs = [
87+
"request_message_translator.cc",
88+
],
89+
hdrs = [
90+
"request_message_translator.h",
91+
],
92+
deps = [
93+
":message_stream",
94+
":prefix_writer",
95+
":request_weaver",
96+
"//external:protobuf",
97+
],
98+
)
99+
100+
cc_library(
101+
name = "request_stream_translator",
102+
srcs = [
103+
"request_stream_translator.cc",
104+
],
105+
hdrs = [
106+
"request_stream_translator.h",
107+
],
108+
deps = [
109+
":request_message_translator",
110+
"//external:protobuf",
111+
],
112+
)
113+
114+
cc_library(
115+
name = "json_request_translator",
116+
srcs = [
117+
"json_request_translator.cc",
118+
],
119+
hdrs = [
120+
"json_request_translator.h",
121+
],
122+
deps = [
123+
":request_message_translator",
124+
":request_stream_translator",
125+
"//external:protobuf",
126+
],
127+
)
128+
129+
cc_library(
130+
name = "message_reader",
131+
srcs = [
132+
"message_reader.cc",
133+
],
134+
hdrs = [
135+
"message_reader.h",
136+
],
137+
deps = [
138+
"//external:protobuf",
139+
],
140+
)
141+
142+
cc_library(
143+
name = "response_to_json_translator",
144+
srcs = [
145+
"response_to_json_translator.cc",
146+
],
147+
hdrs = [
148+
"response_to_json_translator.h",
149+
],
150+
deps = [
151+
":message_reader",
152+
":message_stream",
153+
"//external:protobuf",
154+
],
155+
)
156+
157+
cc_library(
158+
name = "transcoding",
159+
srcs = [
160+
"transcoder_factory.cc",
161+
],
162+
hdrs = [
163+
"transcoder_factory.h",
164+
"transcoder.h",
165+
],
166+
visibility = ["//visibility:public"],
167+
deps = [
168+
":json_request_translator",
169+
":message_stream",
170+
":response_to_json_translator",
171+
":type_helper",
172+
"//external:protobuf",
173+
"//contrib/endpoints/include:headers_only",
174+
"//external:service_config",
175+
],
176+
)
177+
178+
cc_test(
179+
name = "prefix_writer_test",
180+
size = "small",
181+
srcs = [
182+
"prefix_writer_test.cc",
183+
],
184+
deps = [
185+
":prefix_writer",
186+
"//external:googletest_main",
187+
],
188+
)
189+
190+
cc_test(
191+
name = "request_weaver_test",
192+
size = "small",
193+
srcs = [
194+
"request_weaver_test.cc",
195+
],
196+
deps = [
197+
":request_weaver",
198+
"//external:googletest_main",
199+
],
200+
)
201+
202+
cc_test(
203+
name = "type_helper_test",
204+
size = "small",
205+
srcs = [
206+
"type_helper_test.cc",
207+
],
208+
data = [
209+
"testdata/bookstore_service.pb.txt",
210+
],
211+
deps = [
212+
":test_common",
213+
":type_helper",
214+
"//external:googletest_main",
215+
"//external:service_config",
216+
],
217+
)
218+
219+
cc_proto_library(
220+
name = "bookstore_test_proto",
221+
testonly = 1,
222+
srcs = ["bookstore.proto"],
223+
default_runtime = "//external:protobuf",
224+
protoc = "//external:protoc",
225+
deps = [
226+
"//external:cc_wkt_protos",
227+
],
228+
)
229+
230+
cc_library(
231+
name = "test_common",
232+
testonly = 1,
233+
srcs = ["test_common.cc"],
234+
hdrs = ["test_common.h"],
235+
deps = [
236+
"//external:googletest",
237+
"//external:protobuf",
238+
"//external:service_config",
239+
],
240+
)
241+
242+
cc_library(
243+
name = "request_translator_test_base",
244+
testonly = 1,
245+
srcs = [
246+
"proto_stream_tester.cc",
247+
"proto_stream_tester.h",
248+
"request_translator_test_base.cc",
249+
],
250+
hdrs = [
251+
"request_translator_test_base.h",
252+
],
253+
deps = [
254+
":bookstore_test_proto",
255+
":request_message_translator",
256+
":test_common",
257+
":type_helper",
258+
"//external:googletest",
259+
"//external:protobuf",
260+
"//external:service_config",
261+
],
262+
)
263+
264+
cc_test(
265+
name = "request_message_translator_test",
266+
size = "small",
267+
srcs = [
268+
"request_message_translator_test.cc",
269+
],
270+
data = [
271+
"testdata/bookstore_service.pb.txt",
272+
],
273+
deps = [
274+
":bookstore_test_proto",
275+
":request_message_translator",
276+
":request_translator_test_base",
277+
":test_common",
278+
"//external:googletest_main",
279+
],
280+
)
281+
282+
cc_test(
283+
name = "request_stream_translator_test",
284+
size = "small",
285+
srcs = [
286+
"request_stream_translator_test.cc",
287+
],
288+
data = [
289+
"testdata/bookstore_service.pb.txt",
290+
],
291+
deps = [
292+
":bookstore_test_proto",
293+
":request_stream_translator",
294+
":request_translator_test_base",
295+
"//external:googletest_main",
296+
],
297+
)
298+
299+
cc_test(
300+
name = "json_request_translator_test",
301+
size = "small",
302+
srcs = [
303+
"json_request_translator_test.cc",
304+
],
305+
data = [
306+
"testdata/bookstore_service.pb.txt",
307+
],
308+
deps = [
309+
":bookstore_test_proto",
310+
":json_request_translator",
311+
":request_translator_test_base",
312+
":test_common",
313+
"//external:googletest_main",
314+
],
315+
)
316+
317+
cc_test(
318+
name = "message_reader_test",
319+
size = "small",
320+
srcs = [
321+
"message_reader_test.cc",
322+
],
323+
deps = [
324+
":message_reader",
325+
":test_common",
326+
"//external:googletest_main",
327+
],
328+
)
329+
330+
cc_test(
331+
name = "response_to_json_translator_test",
332+
size = "small",
333+
srcs = [
334+
"response_to_json_translator_test.cc",
335+
],
336+
data = [
337+
"testdata/bookstore_service.pb.txt",
338+
],
339+
deps = [
340+
":bookstore_test_proto",
341+
":message_reader",
342+
":response_to_json_translator",
343+
":test_common",
344+
":type_helper",
345+
"//external:googletest_main",
346+
],
347+
)
348+
349+
cc_test(
350+
name = "message_stream_test",
351+
size = "small",
352+
srcs = [
353+
"message_stream_test.cc",
354+
],
355+
deps = [
356+
":message_stream",
357+
":test_common",
358+
"//external:googletest_main",
359+
],
360+
)
361+
362+
cc_test(
363+
name = "transcoder_test",
364+
size = "small",
365+
srcs = [
366+
"transcoder_test.cc",
367+
],
368+
data = [
369+
"testdata/bookstore_service.pb.txt",
370+
],
371+
deps = [
372+
":bookstore_test_proto",
373+
":test_common",
374+
":transcoding",
375+
"//external:googletest_main",
376+
],
377+
)

json_request_translator.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
//
1515
////////////////////////////////////////////////////////////////////////////////
1616
//
17-
#include "src/grpc/transcoding/json_request_translator.h"
17+
#include "contrib/endpoints/src/grpc/transcoding/json_request_translator.h"
1818

1919
#include <string>
2020

21+
#include "contrib/endpoints/src/grpc/transcoding/message_stream.h"
22+
#include "contrib/endpoints/src/grpc/transcoding/request_message_translator.h"
23+
#include "contrib/endpoints/src/grpc/transcoding/request_stream_translator.h"
2124
#include "google/protobuf/io/zero_copy_stream.h"
2225
#include "google/protobuf/stubs/status.h"
2326
#include "google/protobuf/util/internal/json_stream_parser.h"
2427
#include "google/protobuf/util/internal/object_writer.h"
25-
#include "src/grpc/transcoding/message_stream.h"
26-
#include "src/grpc/transcoding/request_message_translator.h"
27-
#include "src/grpc/transcoding/request_stream_translator.h"
2828

2929
namespace google {
3030
namespace api_manager {

0 commit comments

Comments
 (0)