blob: 3d6090a391122a79c94bd3b45ce78bb5f8ad7010 [file] [log] [blame]
Matt Jeanneret9fba8652019-04-02 12:00:17 -04001#!/bin/sh
Matt Jeanneret9fba8652019-04-02 12:00:17 -04002# 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 Kurkianc91266e2019-04-05 14:21:20 -040016set -e
17
Matt Jeanneret9fba8652019-04-02 12:00:17 -040018export PARENT_DIR="$1"
19export SRC_DIR="${PARENT_DIR}/voltha_protos"
20
21export LD_LIBRARY_PATH=/usr/local/lib
22
23echo $SRC_DIR
24
25export MAPS=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor
26export INCS="\
27 -I $PARENT_DIR \
William Kurkianc91266e2019-04-05 14:21:20 -040028 -I ${PARENT_DIR}/google/api"
Matt Jeanneret9fba8652019-04-02 12:00:17 -040029
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 Kurkianc91266e2019-04-05 14:21:20 -040050export OPENOLT_PB="$SRC_DIR/openolt.proto"
Matt Jeanneret9fba8652019-04-02 12:00:17 -040051
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 Kurkianc91266e2019-04-05 14:21:20 -040061 OMCI_PB \
62 OPENOLT_PB"
Matt Jeanneret9fba8652019-04-02 12:00:17 -040063
William Kurkianc91266e2019-04-05 14:21:20 -040064export OTHER_INCLUDES="${PARENT_DIR}/google/api"
Matt Jeanneret9fba8652019-04-02 12:00:17 -040065export PROTO_DESC_FILE="go/voltha.pb"
66
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