Skip to content

Commit a06297b

Browse files
committed
separate grpc transcoding
1 parent f7ff48b commit a06297b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+304
-1719
lines changed

BUILD

Lines changed: 0 additions & 196 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,6 @@ cc_library(
4444
],
4545
)
4646

47-
cc_library(
48-
name = "type_helper",
49-
srcs = [
50-
"type_helper.cc",
51-
],
52-
hdrs = [
53-
"type_helper.h",
54-
],
55-
deps = [
56-
"//external:protobuf",
57-
"//contrib/endpoints/include:headers_only",
58-
],
59-
)
60-
6147
cc_library(
6248
name = "message_stream",
6349
srcs = [
@@ -167,25 +153,10 @@ cc_library(
167153
":json_request_translator",
168154
":message_stream",
169155
":response_to_json_translator",
170-
":type_helper",
171156
"//external:protobuf",
172157
],
173158
)
174159

175-
cc_library(
176-
name = "transcoding_endpoints",
177-
srcs = [
178-
"transcoder_factory.cc",
179-
"transcoder_factory.h",
180-
],
181-
visibility = ["//visibility:public"],
182-
deps = [
183-
":transcoding",
184-
"//contrib/endpoints/include:headers_only",
185-
"//external:service_config",
186-
],
187-
)
188-
189160
cc_test(
190161
name = "prefix_writer_test",
191162
size = "small",
@@ -210,23 +181,6 @@ cc_test(
210181
],
211182
)
212183

213-
cc_test(
214-
name = "type_helper_test",
215-
size = "small",
216-
srcs = [
217-
"type_helper_test.cc",
218-
],
219-
data = [
220-
"testdata/bookstore_service.pb.txt",
221-
],
222-
deps = [
223-
":test_common",
224-
":type_helper",
225-
"//external:googletest_main",
226-
"//external:service_config",
227-
],
228-
)
229-
230184
cc_proto_library(
231185
name = "bookstore_test_proto",
232186
testonly = 1,
@@ -237,153 +191,3 @@ cc_proto_library(
237191
"//external:cc_wkt_protos",
238192
],
239193
)
240-
241-
cc_library(
242-
name = "test_common",
243-
testonly = 1,
244-
srcs = ["test_common.cc"],
245-
hdrs = ["test_common.h"],
246-
deps = [
247-
":transcoder_input_stream",
248-
"//external:googletest",
249-
"//external:protobuf",
250-
"//external:service_config",
251-
],
252-
)
253-
254-
cc_library(
255-
name = "request_translator_test_base",
256-
testonly = 1,
257-
srcs = [
258-
"proto_stream_tester.cc",
259-
"proto_stream_tester.h",
260-
"request_translator_test_base.cc",
261-
],
262-
hdrs = [
263-
"request_translator_test_base.h",
264-
],
265-
deps = [
266-
":bookstore_test_proto",
267-
":request_message_translator",
268-
":test_common",
269-
":type_helper",
270-
"//external:googletest",
271-
"//external:protobuf",
272-
"//external:service_config",
273-
],
274-
)
275-
276-
cc_test(
277-
name = "request_message_translator_test",
278-
size = "small",
279-
srcs = [
280-
"request_message_translator_test.cc",
281-
],
282-
data = [
283-
"testdata/bookstore_service.pb.txt",
284-
],
285-
deps = [
286-
":bookstore_test_proto",
287-
":request_message_translator",
288-
":request_translator_test_base",
289-
":test_common",
290-
"//external:googletest_main",
291-
],
292-
)
293-
294-
cc_test(
295-
name = "request_stream_translator_test",
296-
size = "small",
297-
srcs = [
298-
"request_stream_translator_test.cc",
299-
],
300-
data = [
301-
"testdata/bookstore_service.pb.txt",
302-
],
303-
deps = [
304-
":bookstore_test_proto",
305-
":request_stream_translator",
306-
":request_translator_test_base",
307-
"//external:googletest_main",
308-
],
309-
)
310-
311-
cc_test(
312-
name = "json_request_translator_test",
313-
size = "small",
314-
srcs = [
315-
"json_request_translator_test.cc",
316-
],
317-
data = [
318-
"testdata/bookstore_service.pb.txt",
319-
],
320-
deps = [
321-
":bookstore_test_proto",
322-
":json_request_translator",
323-
":request_translator_test_base",
324-
":test_common",
325-
"//external:googletest_main",
326-
],
327-
)
328-
329-
cc_test(
330-
name = "message_reader_test",
331-
size = "small",
332-
srcs = [
333-
"message_reader_test.cc",
334-
],
335-
deps = [
336-
":message_reader",
337-
":test_common",
338-
"//external:googletest_main",
339-
],
340-
)
341-
342-
cc_test(
343-
name = "response_to_json_translator_test",
344-
size = "small",
345-
srcs = [
346-
"response_to_json_translator_test.cc",
347-
],
348-
data = [
349-
"testdata/bookstore_service.pb.txt",
350-
],
351-
deps = [
352-
":bookstore_test_proto",
353-
":message_reader",
354-
":response_to_json_translator",
355-
":test_common",
356-
":type_helper",
357-
"//external:googletest_main",
358-
],
359-
)
360-
361-
cc_test(
362-
name = "message_stream_test",
363-
size = "small",
364-
srcs = [
365-
"message_stream_test.cc",
366-
],
367-
deps = [
368-
":message_stream",
369-
":test_common",
370-
"//external:googletest_main",
371-
],
372-
)
373-
374-
cc_test(
375-
name = "transcoder_test",
376-
size = "small",
377-
srcs = [
378-
"transcoder_test.cc",
379-
],
380-
data = [
381-
"testdata/bookstore_service.pb.txt",
382-
],
383-
deps = [
384-
":bookstore_test_proto",
385-
":test_common",
386-
":transcoding_endpoints",
387-
"//external:googletest_main",
388-
],
389-
)

WORKSPACE

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2016 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
################################################################################
16+
#
17+
18+
load(
19+
"//:repositories.bzl",
20+
"protobuf_repositories",
21+
"googletest_repositories",
22+
)
23+
24+
25+
protobuf_repositories()
26+
27+
googletest_repositories()
28+
29+
30+
# Workaround for Bazel > 0.4.0 since it needs newer protobuf.bzl from:
31+
# https://github.com/google/protobuf/pull/2246
32+
# Do not use this git_repository for anything else than protobuf.bzl
33+
new_git_repository(
34+
name = "protobuf_bzl",
35+
# Injecting an empty BUILD file to prevent using any build target
36+
build_file_content = "",
37+
commit = "05090726144b6e632c50f47720ff51049bfcbef6",
38+
remote = "https://github.com/google/protobuf.git",
39+
)
40+

bookstore.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// bookstore.proto
1818
// Test proto for transcoding
1919
syntax = "proto3";
20-
package google.api_manager.transcoding;
20+
package google.grpc.transcoding;
2121
message Biography {
2222
int64 year_born = 1;
2323
int64 year_died = 2;

json_request_translator.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414
//
1515
////////////////////////////////////////////////////////////////////////////////
1616
//
17-
#include "contrib/endpoints/src/grpc/transcoding/json_request_translator.h"
17+
#include "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"
21+
#include "message_stream.h"
22+
#include "request_message_translator.h"
23+
#include "request_stream_translator.h"
2424
#include "google/protobuf/io/zero_copy_stream.h"
2525
#include "google/protobuf/stubs/status.h"
2626
#include "google/protobuf/util/internal/json_stream_parser.h"
2727
#include "google/protobuf/util/internal/object_writer.h"
2828

2929
namespace google {
30-
namespace api_manager {
30+
namespace grpc {
3131

3232
namespace transcoding {
3333
namespace {
@@ -160,5 +160,5 @@ JsonRequestTranslator::JsonRequestTranslator(
160160

161161
} // namespace transcoding
162162

163-
} // namespace api_manager
163+
} // namespace grpc
164164
} // namespace google

json_request_translator.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717

1818
#include <memory>
1919

20-
#include "contrib/endpoints/src/grpc/transcoding/message_stream.h"
21-
#include "contrib/endpoints/src/grpc/transcoding/request_message_translator.h"
22-
#include "contrib/endpoints/src/grpc/transcoding/request_stream_translator.h"
20+
#include "message_stream.h"
21+
#include "request_message_translator.h"
22+
#include "request_stream_translator.h"
2323
#include "google/protobuf/io/zero_copy_stream.h"
2424
#include "google/protobuf/util/internal/json_stream_parser.h"
2525
#include "google/protobuf/util/type_resolver.h"
2626

2727
namespace google {
28-
namespace api_manager {
28+
namespace grpc {
2929

3030
namespace transcoding {
3131

@@ -106,7 +106,7 @@ class JsonRequestTranslator {
106106

107107
} // namespace transcoding
108108

109-
} // namespace api_manager
109+
} // namespace grpc
110110
} // namespace google
111111

112112
#endif // API_MANAGER_TRANSCODING_REQUEST_TRANSLATOR_H

json_request_translator_test.cc

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

1919
#include <memory>
2020
#include <string>
2121
#include <vector>
2222

23-
#include "contrib/endpoints/src/grpc/transcoding/bookstore.pb.h"
24-
#include "contrib/endpoints/src/grpc/transcoding/proto_stream_tester.h"
25-
#include "contrib/endpoints/src/grpc/transcoding/request_translator_test_base.h"
26-
#include "contrib/endpoints/src/grpc/transcoding/test_common.h"
23+
#include "bookstore.pb.h"
24+
#include "proto_stream_tester.h"
25+
#include "request_translator_test_base.h"
26+
#include "test_common.h"
2727
#include "google/protobuf/io/zero_copy_stream.h"
2828
#include "gtest/gtest.h"
2929

3030
namespace google {
31-
namespace api_manager {
31+
namespace grpc {
3232

3333
namespace transcoding {
3434
namespace testing {
@@ -742,5 +742,5 @@ TEST_F(JsonRequestTranslatorTest, StreamingErrorNotAnArray) {
742742
} // namespace testing
743743
} // namespace transcoding
744744

745-
} // namespace api_manager
745+
} // namespace grpc
746746
} // namespace google

message_reader.cc

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

1919
#include <memory>
2020

2121
#include "google/protobuf/io/zero_copy_stream_impl.h"
2222

2323
namespace google {
24-
namespace api_manager {
24+
namespace grpc {
2525

2626
namespace transcoding {
2727

@@ -134,5 +134,5 @@ std::unique_ptr<pbio::ZeroCopyInputStream> MessageReader::NextMessage() {
134134

135135
} // namespace transcoding
136136

137-
} // namespace api_manager
137+
} // namespace grpc
138138
} // namespace google

0 commit comments

Comments
 (0)