blob: 931541967a26fa1a64d379c58fb8b0ebdd777903 [file] [log] [blame]
William Kurkianbd3736d2019-03-08 12:20:40 -05001#!/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
17export PARENT_DIR="$1"
18export SRC_DIR="${PARENT_DIR}/voltha_protos"
19
William Kurkian6ea97f82019-03-13 15:51:55 -040020export LD_LIBRARY_PATH=/usr/local/lib
21
William Kurkianbd3736d2019-03-08 12:20:40 -050022echo $SRC_DIR
23
24export MAPS=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor
25export INCS="\
26 -I $PARENT_DIR \
27 -I /usr/local/include/googleapis"
28
29export 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
38export COMMON_PB="\
39 $SRC_DIR/common.proto \
40 $SRC_DIR/meta.proto \
41 $SRC_DIR/yang_options.proto"
42
43export INTER_CONTAINER_PB="$SRC_DIR/inter_container.proto"
44export SCHEMA_PB="$SRC_DIR/schema.proto"
45export IETF_PB="$SRC_DIR/ietf_interfaces.proto"
46export OF_PB="$SRC_DIR/openflow_13.proto"
47export OMCI_PB="$SRC_DIR/omci*.proto"
48export AFROUTER_PB="$SRC_DIR/afrouter.proto"
49
50export 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
61export OTHER_INCLUDES="/usr/local/include/googleapis"
William Kurkian6ea97f82019-03-13 15:51:55 -040062export PROTO_DESC_FILE="go/voltha.pb"
William Kurkianbd3736d2019-03-08 12:20:40 -050063
64for pb_var in $PB_VARS
65do
66 pbs="$(eval echo \$$pb_var)"
67 echo "Compiling $pbs"
68 protoc --go_out=$MAPS,plugins=grpc:$GOPATH/src $INCS $pbs
69done
70
71protoc -I ${PARENT_DIR} -I ${OTHER_INCLUDES} --include_imports --include_source_info --descriptor_set_out=${PROTO_DESC_FILE} ${SRC_DIR}/*.proto