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