Matt Jeanneret | 9fba865 | 2019-04-02 12:00:17 -0400 | [diff] [blame] | 1 | #!/bin/sh |
Matt Jeanneret | 9fba865 | 2019-04-02 12:00:17 -0400 | [diff] [blame] | 2 | # Copyright 2018 the original author or authors. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
William Kurkian | c91266e | 2019-04-05 14:21:20 -0400 | [diff] [blame] | 16 | set -e |
| 17 | |
Matt Jeanneret | 9fba865 | 2019-04-02 12:00:17 -0400 | [diff] [blame] | 18 | export PARENT_DIR="$1" |
| 19 | export SRC_DIR="${PARENT_DIR}/voltha_protos" |
| 20 | |
| 21 | export LD_LIBRARY_PATH=/usr/local/lib |
| 22 | |
| 23 | echo $SRC_DIR |
| 24 | |
| 25 | export MAPS=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor |
| 26 | export INCS="\ |
| 27 | -I $PARENT_DIR \ |
William Kurkian | c91266e | 2019-04-05 14:21:20 -0400 | [diff] [blame] | 28 | -I ${PARENT_DIR}/google/api" |
Matt Jeanneret | 9fba865 | 2019-04-02 12:00:17 -0400 | [diff] [blame] | 29 | |
| 30 | export VOLTHA_PB="\ |
| 31 | $SRC_DIR/adapter.proto \ |
| 32 | $SRC_DIR/device.proto \ |
| 33 | $SRC_DIR/events.proto \ |
| 34 | $SRC_DIR/health.proto \ |
| 35 | $SRC_DIR/logical_device.proto \ |
| 36 | $SRC_DIR/ponsim.proto \ |
| 37 | $SRC_DIR/voltha.proto" |
| 38 | |
| 39 | export COMMON_PB="\ |
| 40 | $SRC_DIR/common.proto \ |
| 41 | $SRC_DIR/meta.proto \ |
| 42 | $SRC_DIR/yang_options.proto" |
| 43 | |
| 44 | export INTER_CONTAINER_PB="$SRC_DIR/inter_container.proto" |
| 45 | export SCHEMA_PB="$SRC_DIR/schema.proto" |
| 46 | export IETF_PB="$SRC_DIR/ietf_interfaces.proto" |
| 47 | export OF_PB="$SRC_DIR/openflow_13.proto" |
| 48 | export OMCI_PB="$SRC_DIR/omci*.proto" |
| 49 | export AFROUTER_PB="$SRC_DIR/afrouter.proto" |
William Kurkian | c91266e | 2019-04-05 14:21:20 -0400 | [diff] [blame] | 50 | export OPENOLT_PB="$SRC_DIR/openolt.proto" |
Matt Jeanneret | 9fba865 | 2019-04-02 12:00:17 -0400 | [diff] [blame] | 51 | |
| 52 | export PB_VARS="\ |
| 53 | VOLTHA_PB \ |
| 54 | COMMON_PB \ |
| 55 | INTER_CONTAINER_PB \ |
| 56 | SCHEMA_PB \ |
| 57 | IETF_PB \ |
| 58 | OF_PB \ |
| 59 | OMCI_PB \ |
| 60 | AFROUTER_PB \ |
William Kurkian | c91266e | 2019-04-05 14:21:20 -0400 | [diff] [blame] | 61 | OMCI_PB \ |
| 62 | OPENOLT_PB" |
Matt Jeanneret | 9fba865 | 2019-04-02 12:00:17 -0400 | [diff] [blame] | 63 | |
William Kurkian | c91266e | 2019-04-05 14:21:20 -0400 | [diff] [blame] | 64 | export OTHER_INCLUDES="${PARENT_DIR}/google/api" |
Matt Jeanneret | 9fba865 | 2019-04-02 12:00:17 -0400 | [diff] [blame] | 65 | export PROTO_DESC_FILE="go/voltha.pb" |
| 66 | |
| 67 | for pb_var in $PB_VARS |
| 68 | do |
| 69 | pbs="$(eval echo \$$pb_var)" |
| 70 | echo "Compiling $pbs" |
| 71 | protoc --go_out=$MAPS,plugins=grpc:$GOPATH/src $INCS $pbs |
| 72 | done |
| 73 | |
| 74 | protoc -I ${PARENT_DIR} -I ${OTHER_INCLUDES} --include_imports --include_source_info --descriptor_set_out=${PROTO_DESC_FILE} ${SRC_DIR}/*.proto |