|
| 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