Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 1 | #!/bin/sh |
Zack Williams | 41513bf | 2018-07-07 20:08:35 -0700 | [diff] [blame] | 2 | # Copyright 2017-present Open Networking Foundation |
| 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. |
Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 15 | |
| 16 | export SRC_DIR="$1" |
| 17 | |
| 18 | echo $SRC_DIR |
| 19 | |
| 20 | export MAPS=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor |
| 21 | export INCS="\ |
| 22 | -I $SRC_DIR \ |
| 23 | -I $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis" |
| 24 | |
| 25 | export VOLTHA_PB="\ |
| 26 | $SRC_DIR/adapter.proto \ |
| 27 | $SRC_DIR/device.proto \ |
| 28 | $SRC_DIR/events.proto \ |
| 29 | $SRC_DIR/health.proto \ |
| 30 | $SRC_DIR/logical_device.proto \ |
| 31 | $SRC_DIR/ponsim.proto \ |
| 32 | $SRC_DIR/voltha.proto" |
| 33 | |
| 34 | export COMMON_PB="\ |
| 35 | $SRC_DIR/common.proto \ |
| 36 | $SRC_DIR/meta.proto \ |
| 37 | $SRC_DIR/yang_options.proto" |
| 38 | |
| 39 | export PONSIM_PB="$SRC_DIR/ponsim_common.proto $SRC_DIR/ponsim_olt.proto" |
| 40 | export SCHEMA_PB="$SRC_DIR/schema.proto" |
| 41 | export IETF_PB="$SRC_DIR/ietf_interfaces.proto" |
| 42 | export OF_PB="$SRC_DIR/openflow_13.proto" |
| 43 | export BAL_PB="$SRC_DIR/bal*.proto" |
| 44 | export BBF_PB="$SRC_DIR/bbf*.proto" |
Stephane Barbarie | c92b9e2 | 2018-04-17 10:11:19 -0400 | [diff] [blame] | 45 | export OMCI_PB="$SRC_DIR/omci*.proto" |
Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 46 | |
| 47 | export PB_VARS="\ |
| 48 | VOLTHA_PB \ |
| 49 | COMMON_PB \ |
| 50 | PONSIM_PB \ |
| 51 | SCHEMA_PB \ |
| 52 | IETF_PB \ |
| 53 | OF_PB \ |
| 54 | BAL_PB \ |
Stephane Barbarie | c92b9e2 | 2018-04-17 10:11:19 -0400 | [diff] [blame] | 55 | BBF_PB \ |
| 56 | OMCI_PB" |
Stephane Barbarie | 3559506 | 2018-02-08 08:34:39 -0500 | [diff] [blame] | 57 | |
| 58 | for pb_var in $PB_VARS |
| 59 | do |
| 60 | pbs="$(eval echo \$$pb_var)" |
| 61 | echo "Compiling $pbs" |
| 62 | protoc --go_out=$MAPS,plugins=grpc:$GOPATH/src $INCS $pbs |
| 63 | done |