• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# Copyright 2016 gRPC authors.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17set -ex
18
19cd $(dirname $0)/../../..
20bazel=`pwd`/tools/bazel
21
22if [ $# -eq 0 ]; then
23  UPB_OUTPUT_DIR=$PWD/src/core/ext/upb-generated
24  rm -rf $UPB_OUTPUT_DIR
25  mkdir -p $UPB_OUTPUT_DIR
26else
27  UPB_OUTPUT_DIR=$1
28fi
29
30$bazel build @com_google_protobuf//:protoc
31PROTOC=$PWD/bazel-bin/external/com_google_protobuf/protoc
32
33$bazel build @upb//:protoc-gen-upb
34UPB_PLUGIN=$PWD/bazel-bin/external/upb/protoc-gen-upb
35
36proto_files=( \
37  "envoy/annotations/deprecation.proto" \
38  "envoy/annotations/resource.proto" \
39  "envoy/api/v2/auth/cert.proto" \
40  "envoy/api/v2/auth/common.proto" \
41  "envoy/api/v2/auth/secret.proto" \
42  "envoy/api/v2/auth/tls.proto" \
43  "envoy/api/v2/cds.proto" \
44  "envoy/api/v2/cluster/circuit_breaker.proto" \
45  "envoy/api/v2/cluster/filter.proto" \
46  "envoy/api/v2/cluster/outlier_detection.proto" \
47  "envoy/api/v2/core/address.proto" \
48  "envoy/api/v2/core/base.proto" \
49  "envoy/api/v2/core/backoff.proto" \
50  "envoy/api/v2/core/config_source.proto" \
51  "envoy/api/v2/core/event_service_config.proto" \
52  "envoy/api/v2/core/grpc_service.proto" \
53  "envoy/api/v2/core/health_check.proto" \
54  "envoy/api/v2/core/http_uri.proto" \
55  "envoy/api/v2/core/protocol.proto" \
56  "envoy/api/v2/core/socket_option.proto" \
57  "envoy/api/v2/cluster.proto" \
58  "envoy/api/v2/discovery.proto" \
59  "envoy/api/v2/eds.proto" \
60  "envoy/api/v2/endpoint.proto" \
61  "envoy/api/v2/endpoint/endpoint.proto" \
62  "envoy/api/v2/endpoint/endpoint_components.proto" \
63  "envoy/api/v2/endpoint/load_report.proto" \
64  "envoy/api/v2/lds.proto" \
65  "envoy/api/v2/listener.proto" \
66  "envoy/api/v2/listener/listener.proto" \
67  "envoy/api/v2/listener/listener_components.proto" \
68  "envoy/api/v2/rds.proto" \
69  "envoy/api/v2/route.proto" \
70  "envoy/api/v2/route/route.proto" \
71  "envoy/api/v2/route/route_components.proto" \
72  "envoy/api/v2/srds.proto" \
73  "envoy/api/v2/scoped_route.proto" \
74  "envoy/config/listener/v2/api_listener.proto" \
75  "envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.proto" \
76  "envoy/config/filter/accesslog/v2/accesslog.proto" \
77  "envoy/config/rbac/v2/rbac.proto" \
78  "envoy/config/trace/v2/http_tracer.proto" \
79  "envoy/service/discovery/v2/ads.proto" \
80  "envoy/service/load_stats/v2/lrs.proto" \
81  "envoy/type/http.proto" \
82  "envoy/type/matcher/regex.proto" \
83  "envoy/api/v2/listener/udp_listener_config.proto" \
84  "envoy/type/matcher/path.proto" \
85  "envoy/type/matcher/string.proto" \
86  "envoy/type/metadata/v2/metadata.proto" \
87  "envoy/type/percent.proto" \
88  "envoy/type/range.proto" \
89  "envoy/type/semantic_version.proto" \
90  "envoy/type/tracing/v2/custom_tag.proto" \
91  "gogoproto/gogo.proto" \
92  "google/api/annotations.proto" \
93  "google/api/expr/v1alpha1/syntax.proto" \
94  "google/api/http.proto" \
95  "google/protobuf/any.proto" \
96  "google/protobuf/descriptor.proto" \
97  "google/protobuf/duration.proto" \
98  "google/protobuf/empty.proto" \
99  "google/protobuf/struct.proto" \
100  "google/protobuf/timestamp.proto" \
101  "google/protobuf/wrappers.proto" \
102  "google/rpc/status.proto" \
103  "src/proto/grpc/gcp/altscontext.proto" \
104  "src/proto/grpc/gcp/handshaker.proto" \
105  "src/proto/grpc/gcp/transport_security_common.proto" \
106  "src/proto/grpc/health/v1/health.proto" \
107  "src/proto/grpc/lb/v1/load_balancer.proto" \
108  "udpa/data/orca/v1/orca_load_report.proto" \
109  "udpa/annotations/migrate.proto" \
110  "udpa/annotations/sensitive.proto" \
111  "udpa/annotations/status.proto" \
112  "validate/validate.proto")
113
114for i in "${proto_files[@]}"
115do
116  echo "Compiling: ${i}"
117  $PROTOC \
118    -I=$PWD/third_party/udpa \
119    -I=$PWD/third_party/envoy-api \
120    -I=$PWD/third_party/googleapis \
121    -I=$PWD/third_party/protobuf/src \
122    -I=$PWD/third_party/protoc-gen-validate \
123    -I=$PWD \
124    $i \
125    --upb_out=$UPB_OUTPUT_DIR \
126    --plugin=protoc-gen-upb=$UPB_PLUGIN
127done
128
129find $UPB_OUTPUT_DIR -name "*.upbdefs.c" -type f -delete
130find $UPB_OUTPUT_DIR -name "*.upbdefs.h" -type f -delete
131