William Kurkian | bd3736d | 2019-03-08 12:20:40 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 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 | |
| 17 | export PARENT_DIR="$1" |
| 18 | export SRC_DIR="${PARENT_DIR}/voltha_protos" |
| 19 | |
William Kurkian | 6ea97f8 | 2019-03-13 15:51:55 -0400 | [diff] [blame^] | 20 | export LD_LIBRARY_PATH=/usr/local/lib |
| 21 | |
William Kurkian | bd3736d | 2019-03-08 12:20:40 -0500 | [diff] [blame] | 22 | echo $SRC_DIR |
| 23 | |
| 24 | export MAPS=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor |
| 25 | export INCS="\ |
| 26 | -I $PARENT_DIR \ |
| 27 | -I /usr/local/include/googleapis" |
| 28 | |
| 29 | export VOLTHA_PB="\ |
| 30 | $SRC_DIR/adapter.proto \ |
| 31 | $SRC_DIR/device.proto \ |
| 32 | $SRC_DIR/events.proto \ |
| 33 | $SRC_DIR/health.proto \ |
| 34 | $SRC_DIR/logical_device.proto \ |
| 35 | $SRC_DIR/ponsim.proto \ |
| 36 | $SRC_DIR/voltha.proto" |
| 37 | |
| 38 | export COMMON_PB="\ |
| 39 | $SRC_DIR/common.proto \ |
| 40 | $SRC_DIR/meta.proto \ |
| 41 | $SRC_DIR/yang_options.proto" |
| 42 | |
| 43 | export INTER_CONTAINER_PB="$SRC_DIR/inter_container.proto" |
| 44 | export SCHEMA_PB="$SRC_DIR/schema.proto" |
| 45 | export IETF_PB="$SRC_DIR/ietf_interfaces.proto" |
| 46 | export OF_PB="$SRC_DIR/openflow_13.proto" |
| 47 | export OMCI_PB="$SRC_DIR/omci*.proto" |
| 48 | export AFROUTER_PB="$SRC_DIR/afrouter.proto" |
| 49 | |
| 50 | export PB_VARS="\ |
| 51 | VOLTHA_PB \ |
| 52 | COMMON_PB \ |
| 53 | INTER_CONTAINER_PB \ |
| 54 | SCHEMA_PB \ |
| 55 | IETF_PB \ |
| 56 | OF_PB \ |
| 57 | OMCI_PB \ |
| 58 | AFROUTER_PB \ |
| 59 | OMCI_PB" |
| 60 | |
| 61 | export OTHER_INCLUDES="/usr/local/include/googleapis" |
William Kurkian | 6ea97f8 | 2019-03-13 15:51:55 -0400 | [diff] [blame^] | 62 | export PROTO_DESC_FILE="go/voltha.pb" |
William Kurkian | bd3736d | 2019-03-08 12:20:40 -0500 | [diff] [blame] | 63 | |
| 64 | for pb_var in $PB_VARS |
| 65 | do |
| 66 | pbs="$(eval echo \$$pb_var)" |
| 67 | echo "Compiling $pbs" |
| 68 | protoc --go_out=$MAPS,plugins=grpc:$GOPATH/src $INCS $pbs |
| 69 | done |
| 70 | |
| 71 | protoc -I ${PARENT_DIR} -I ${OTHER_INCLUDES} --include_imports --include_source_info --descriptor_set_out=${PROTO_DESC_FILE} ${SRC_DIR}/*.proto |