khenaidoo | abad44c | 2018-08-03 16:58:35 -0400 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Zack Williams | 998f442 | 2018-09-19 10:38:57 -0700 | [diff] [blame] | 3 | # Copyright 2018 the original author or 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 | |
khenaidoo | abad44c | 2018-08-03 16:58:35 -0400 | [diff] [blame] | 17 | export SRC_DIR="$1" |
| 18 | |
| 19 | echo $SRC_DIR |
| 20 | |
| 21 | export MAPS=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor |
| 22 | export INCS="\ |
| 23 | -I $SRC_DIR \ |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 24 | -I /usr/local/include/googleapis" |
khenaidoo | abad44c | 2018-08-03 16:58:35 -0400 | [diff] [blame] | 25 | |
| 26 | export VOLTHA_PB="\ |
| 27 | $SRC_DIR/adapter.proto \ |
| 28 | $SRC_DIR/device.proto \ |
| 29 | $SRC_DIR/events.proto \ |
| 30 | $SRC_DIR/health.proto \ |
| 31 | $SRC_DIR/logical_device.proto \ |
Chip Boling | 32aab30 | 2019-01-23 10:50:18 -0600 | [diff] [blame^] | 32 | $SRC_DIR/omci_mib_db.proto \ |
khenaidoo | abad44c | 2018-08-03 16:58:35 -0400 | [diff] [blame] | 33 | $SRC_DIR/ponsim.proto \ |
| 34 | $SRC_DIR/voltha.proto" |
| 35 | |
| 36 | export COMMON_PB="\ |
| 37 | $SRC_DIR/common.proto \ |
| 38 | $SRC_DIR/meta.proto \ |
| 39 | $SRC_DIR/yang_options.proto" |
| 40 | |
khenaidoo | 7923270 | 2018-12-04 11:00:41 -0500 | [diff] [blame] | 41 | export INTER_CONTAINER_PB="$SRC_DIR/inter_container.proto" |
khenaidoo | abad44c | 2018-08-03 16:58:35 -0400 | [diff] [blame] | 42 | export SCHEMA_PB="$SRC_DIR/schema.proto" |
| 43 | export IETF_PB="$SRC_DIR/ietf_interfaces.proto" |
| 44 | export OF_PB="$SRC_DIR/openflow_13.proto" |
| 45 | export OMCI_PB="$SRC_DIR/omci*.proto" |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 46 | export AFROUTER_PB="$SRC_DIR/afrouter.proto" |
khenaidoo | abad44c | 2018-08-03 16:58:35 -0400 | [diff] [blame] | 47 | |
| 48 | export PB_VARS="\ |
| 49 | VOLTHA_PB \ |
| 50 | COMMON_PB \ |
khenaidoo | 7923270 | 2018-12-04 11:00:41 -0500 | [diff] [blame] | 51 | INTER_CONTAINER_PB \ |
khenaidoo | abad44c | 2018-08-03 16:58:35 -0400 | [diff] [blame] | 52 | SCHEMA_PB \ |
| 53 | IETF_PB \ |
| 54 | OF_PB \ |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 55 | OMCI_PB \ |
| 56 | AFROUTER_PB" |
| 57 | |
| 58 | export OTHER_INCLUDES="/usr/local/include/googleapis" |
| 59 | export PROTO_DESC_FILE="${SRC_DIR}/voltha.pb" |
khenaidoo | abad44c | 2018-08-03 16:58:35 -0400 | [diff] [blame] | 60 | |
| 61 | for pb_var in $PB_VARS |
| 62 | do |
| 63 | pbs="$(eval echo \$$pb_var)" |
| 64 | echo "Compiling $pbs" |
| 65 | protoc --go_out=$MAPS,plugins=grpc:$GOPATH/src $INCS $pbs |
| 66 | done |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 67 | |
| 68 | protoc -I ${SRC_DIR} -I ${OTHER_INCLUDES} --include_imports --include_source_info --descriptor_set_out=${PROTO_DESC_FILE} ${SRC_DIR}/*.proto |