blob: 3d6090a391122a79c94bd3b45ce78bb5f8ad7010 [file] [log] [blame]
William Kurkianbd3736d2019-03-08 12:20:40 -05001#!/bin/sh
William Kurkianbd3736d2019-03-08 12:20:40 -05002# 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
Matt Jeanneret61e94872019-03-22 16:16:01 -040016set -e
17
William Kurkianbd3736d2019-03-08 12:20:40 -050018export PARENT_DIR="$1"
19export SRC_DIR="${PARENT_DIR}/voltha_protos"
20
William Kurkian6ea97f82019-03-13 15:51:55 -040021export LD_LIBRARY_PATH=/usr/local/lib
22
William Kurkianbd3736d2019-03-08 12:20:40 -050023echo $SRC_DIR
24
25export MAPS=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor
26export INCS="\
27 -I $PARENT_DIR \
William Kurkian7c151592019-03-27 09:36:15 -040028 -I ${PARENT_DIR}/google/api"
William Kurkianbd3736d2019-03-08 12:20:40 -050029
30export 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
39export COMMON_PB="\
40 $SRC_DIR/common.proto \
41 $SRC_DIR/meta.proto \
42 $SRC_DIR/yang_options.proto"
43
44export INTER_CONTAINER_PB="$SRC_DIR/inter_container.proto"
45export SCHEMA_PB="$SRC_DIR/schema.proto"
46export IETF_PB="$SRC_DIR/ietf_interfaces.proto"
47export OF_PB="$SRC_DIR/openflow_13.proto"
48export OMCI_PB="$SRC_DIR/omci*.proto"
49export AFROUTER_PB="$SRC_DIR/afrouter.proto"
William Kurkian7c151592019-03-27 09:36:15 -040050export OPENOLT_PB="$SRC_DIR/openolt.proto"
William Kurkianbd3736d2019-03-08 12:20:40 -050051
52export 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 Kurkian7c151592019-03-27 09:36:15 -040061 OMCI_PB \
62 OPENOLT_PB"
William Kurkianbd3736d2019-03-08 12:20:40 -050063
William Kurkian7c151592019-03-27 09:36:15 -040064export OTHER_INCLUDES="${PARENT_DIR}/google/api"
William Kurkian6ea97f82019-03-13 15:51:55 -040065export PROTO_DESC_FILE="go/voltha.pb"
William Kurkianbd3736d2019-03-08 12:20:40 -050066
67for pb_var in $PB_VARS
68do
69 pbs="$(eval echo \$$pb_var)"
70 echo "Compiling $pbs"
71 protoc --go_out=$MAPS,plugins=grpc:$GOPATH/src $INCS $pbs
72done
73
74protoc -I ${PARENT_DIR} -I ${OTHER_INCLUDES} --include_imports --include_source_info --descriptor_set_out=${PROTO_DESC_FILE} ${SRC_DIR}/*.proto