Skip to content

Commit 776f4e0

Browse files
authored
Merge pull request #1 from rkpagadala/master
Separate grpc transcoding library
2 parents 597c4d4 + 9f6ee2c commit 776f4e0

Some content is hidden

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

44 files changed

+9453
-2
lines changed

BUILD

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2017 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+
#

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Want to contribute? Great! First, read this page (including the small print at the end).
2+
3+
### Before you contribute
4+
Before we can use your code, you must sign the
5+
[Google Individual Contributor License Agreement]
6+
(https://cla.developers.google.com/about/google-individual)
7+
(CLA), which you can do online. The CLA is necessary mainly because you own the
8+
copyright to your changes, even after your contribution becomes part of our
9+
codebase, so we need your permission to use and distribute your code. We also
10+
need to be sure of various other things—for instance that you'll tell us if you
11+
know that your code infringes on other people's patents. You don't have to sign
12+
the CLA until after you've submitted your code for review and a member has
13+
approved it, but you must do it before we can put your code into our codebase.
14+
Before you start working on a larger contribution, you should get in touch with
15+
us first through the issue tracker with your idea so that we can help out and
16+
possibly guide you. Coordinating up front makes it much easier to avoid
17+
frustration later on.
18+
19+
### Code reviews
20+
All submissions, including submissions by project members, require review. We
21+
use Github pull requests for this purpose.
22+
23+
### The small print
24+
Contributions made by corporations are covered by a different agreement than
25+
the one above, the
26+
[Software Grant and Corporate Contributor License Agreement]
27+
(https://cla.developers.google.com/about/google-corporate).

LICENSE

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Apache License
1+
Copyright 2017 Google Inc. All rights reserved.
2+
3+
Apache License
24
Version 2.0, January 2004
35
http://www.apache.org/licenses/
46

@@ -186,7 +188,7 @@
186188
same "printed page" as the copyright notice for easier
187189
identification within third-party archives.
188190

189-
Copyright {yyyy} {name of copyright owner}
191+
Copyright 2016 Google Inc
190192

191193
Licensed under the Apache License, Version 2.0 (the "License");
192194
you may not use this file except in compliance with the License.

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# grpc-httpjson-transcoding
2+
3+
grpc-httpjson-transcoding is a library that supports
4+
[transcoding](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto)
5+
so that HTTP/JSON can be converted to gRPC.
6+
7+
It helps you to provide your APIs in both gRPC and RESTful style at the same
8+
time. The code is used in istio [proxy](https://github.com/istio/proxy) and
9+
cloud [endpoints](https://cloud.google.com/endpoints/) to provide HTTP+JSON
10+
interface to gRPC service.
11+
12+
13+
## Develop
14+
15+
[Bazel](https://bazel.build/) is used for build and dependency management. The
16+
following commands build and test sources:
17+
18+
```bash
19+
$ bazel build //...
20+
$ bazel test //...
21+
```
22+
23+
# Contribution
24+
See [CONTRIBUTING.md](CONTRIBUTING.md).
25+
26+
# License
27+
grpc-httpjson-transcoding is licensed under the Apache 2.0 license. See
28+
[LICENSE](LICENSE) for more details.
29+

WORKSPACE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
"googleapis_repositories",
23+
)
24+
25+
protobuf_repositories()
26+
27+
googletest_repositories()
28+
29+
googleapis_repositories()

repositories.bzl

Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
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+
def protobuf_repositories(bind=True):
18+
native.git_repository(
19+
name = "protobuf_git",
20+
commit = "593e917c176b5bc5aafa57bf9f6030d749d91cd5", # v3.2.0
21+
remote = "https://github.com/google/protobuf.git",
22+
)
23+
24+
if bind:
25+
native.bind(
26+
name = "protoc",
27+
actual = "@protobuf_git//:protoc",
28+
)
29+
30+
native.bind(
31+
name = "protobuf",
32+
actual = "@protobuf_git//:protobuf",
33+
)
34+
35+
native.bind(
36+
name = "cc_wkt_protos",
37+
actual = "@protobuf_git//:cc_wkt_protos",
38+
)
39+
40+
native.bind(
41+
name = "cc_wkt_protos_genproto",
42+
actual = "@protobuf_git//:cc_wkt_protos_genproto",
43+
)
44+
45+
native.bind(
46+
name = "protobuf_compiler",
47+
actual = "@protobuf_git//:protoc_lib",
48+
)
49+
50+
native.bind(
51+
name = "protobuf_clib",
52+
actual = "@protobuf_git//:protoc_lib",
53+
)
54+
55+
56+
def googletest_repositories(bind=True):
57+
BUILD = """
58+
# Copyright 2016 Google Inc. All Rights Reserved.
59+
#
60+
# Licensed under the Apache License, Version 2.0 (the "License");
61+
# you may not use this file except in compliance with the License.
62+
# You may obtain a copy of the License at
63+
#
64+
# http://www.apache.org/licenses/LICENSE-2.0
65+
#
66+
# Unless required by applicable law or agreed to in writing, software
67+
# distributed under the License is distributed on an "AS IS" BASIS,
68+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69+
# See the License for the specific language governing permissions and
70+
# limitations under the License.
71+
#
72+
################################################################################
73+
#
74+
75+
cc_library(
76+
name = "googletest",
77+
srcs = [
78+
"googletest/src/gtest-all.cc",
79+
"googlemock/src/gmock-all.cc",
80+
],
81+
hdrs = glob([
82+
"googletest/include/**/*.h",
83+
"googlemock/include/**/*.h",
84+
"googletest/src/*.cc",
85+
"googletest/src/*.h",
86+
"googlemock/src/*.cc",
87+
]),
88+
includes = [
89+
"googlemock",
90+
"googletest",
91+
"googletest/include",
92+
"googlemock/include",
93+
],
94+
visibility = ["//visibility:public"],
95+
)
96+
97+
cc_library(
98+
name = "googletest_main",
99+
srcs = ["googlemock/src/gmock_main.cc"],
100+
visibility = ["//visibility:public"],
101+
linkopts = [
102+
"-lpthread",
103+
],
104+
deps = [":googletest"],
105+
)
106+
107+
cc_library(
108+
name = "googletest_prod",
109+
hdrs = [
110+
"googletest/include/gtest/gtest_prod.h",
111+
],
112+
includes = [
113+
"googletest/include",
114+
],
115+
visibility = ["//visibility:public"],
116+
)
117+
"""
118+
native.new_git_repository(
119+
name = "googletest_git",
120+
build_file_content = BUILD,
121+
commit = "d225acc90bc3a8c420a9bcd1f033033c1ccd7fe0",
122+
remote = "https://github.com/google/googletest.git",
123+
)
124+
125+
if bind:
126+
native.bind(
127+
name = "googletest",
128+
actual = "@googletest_git//:googletest",
129+
)
130+
131+
native.bind(
132+
name = "googletest_main",
133+
actual = "@googletest_git//:googletest_main",
134+
)
135+
136+
native.bind(
137+
name = "googletest_prod",
138+
actual = "@googletest_git//:googletest_prod",
139+
)
140+
141+
def googleapis_repositories(protobuf_repo="@protobuf_git//", bind=True):
142+
BUILD = """
143+
# Copyright 2016 Google Inc. All Rights Reserved.
144+
#
145+
# Licensed under the Apache License, Version 2.0 (the "License");
146+
# you may not use this file except in compliance with the License.
147+
# You may obtain a copy of the License at
148+
#
149+
# http://www.apache.org/licenses/LICENSE-2.0
150+
#
151+
# Unless required by applicable law or agreed to in writing, software
152+
# distributed under the License is distributed on an "AS IS" BASIS,
153+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
154+
# See the License for the specific language governing permissions and
155+
# limitations under the License.
156+
#
157+
################################################################################
158+
#
159+
160+
licenses(["notice"])
161+
162+
load("@protobuf_git//:protobuf.bzl", "cc_proto_library")
163+
164+
exports_files(glob(["google/**"]))
165+
166+
cc_proto_library(
167+
name = "servicecontrol",
168+
srcs = [
169+
"google/api/servicecontrol/v1/check_error.proto",
170+
"google/api/servicecontrol/v1/distribution.proto",
171+
"google/api/servicecontrol/v1/log_entry.proto",
172+
"google/api/servicecontrol/v1/metric_value.proto",
173+
"google/api/servicecontrol/v1/operation.proto",
174+
"google/api/servicecontrol/v1/service_controller.proto",
175+
"google/logging/type/http_request.proto",
176+
"google/logging/type/log_severity.proto",
177+
"google/rpc/error_details.proto",
178+
"google/rpc/status.proto",
179+
"google/type/money.proto",
180+
],
181+
include = ".",
182+
visibility = ["//visibility:public"],
183+
deps = [
184+
":service_config",
185+
],
186+
protoc = "//external:protoc",
187+
default_runtime = "//external:protobuf",
188+
)
189+
190+
cc_proto_library(
191+
name = "service_config",
192+
srcs = [
193+
"google/api/annotations.proto",
194+
"google/api/auth.proto",
195+
"google/api/backend.proto",
196+
"google/api/billing.proto",
197+
"google/api/consumer.proto",
198+
"google/api/context.proto",
199+
"google/api/control.proto",
200+
"google/api/documentation.proto",
201+
"google/api/endpoint.proto",
202+
"google/api/http.proto",
203+
"google/api/label.proto",
204+
"google/api/log.proto",
205+
"google/api/logging.proto",
206+
"google/api/metric.proto",
207+
"google/api/experimental/experimental.proto",
208+
"google/api/experimental/authorization_config.proto",
209+
"google/api/monitored_resource.proto",
210+
"google/api/monitoring.proto",
211+
"google/api/quota.proto",
212+
"google/api/service.proto",
213+
"google/api/source_info.proto",
214+
"google/api/system_parameter.proto",
215+
"google/api/usage.proto",
216+
],
217+
include = ".",
218+
visibility = ["//visibility:public"],
219+
deps = [
220+
"//external:cc_wkt_protos",
221+
],
222+
protoc = "//external:protoc",
223+
default_runtime = "//external:protobuf",
224+
)
225+
226+
cc_proto_library(
227+
name = "cloud_trace",
228+
srcs = [
229+
"google/devtools/cloudtrace/v1/trace.proto",
230+
],
231+
include = ".",
232+
default_runtime = "//external:protobuf",
233+
protoc = "//external:protoc",
234+
visibility = ["//visibility:public"],
235+
deps = [
236+
":service_config",
237+
"//external:cc_wkt_protos",
238+
],
239+
)
240+
""".format(protobuf_repo)
241+
242+
native.new_git_repository(
243+
name = "googleapis_git",
244+
commit = "2fe0050bd2a6d4c6ba798c0311f0b149b8997314",
245+
remote = "https://github.com/googleapis/googleapis.git",
246+
build_file_content = BUILD,
247+
)
248+
249+
if bind:
250+
native.bind(
251+
name = "servicecontrol",
252+
actual = "@googleapis_git//:servicecontrol",
253+
)
254+
255+
native.bind(
256+
name = "servicecontrol_genproto",
257+
actual = "@googleapis_git//:servicecontrol_genproto",
258+
)
259+
260+
native.bind(
261+
name = "service_config",
262+
actual = "@googleapis_git//:service_config",
263+
)
264+
265+
native.bind(
266+
name = "cloud_trace",
267+
actual = "@googleapis_git//:cloud_trace",
268+
)

0 commit comments

Comments
 (0)