blob: f8046cc298c54cdb2691edc30bcf258656c83986 [file] [log] [blame]
William Kurkianbd3736d2019-03-08 12:20:40 -05001#!/bin/sh
2
William Kurkianad745652019-03-20 08:45:51 -04003set -e
4
William Kurkianbd3736d2019-03-08 12:20:40 -05005# Copyright 2018 the original author or authors.
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18
19export PARENT_DIR="$1"
20export SRC_DIR="${PARENT_DIR}/voltha_protos"
21
William Kurkian6ea97f82019-03-13 15:51:55 -040022export LD_LIBRARY_PATH=/usr/local/lib
23
William Kurkianbd3736d2019-03-08 12:20:40 -050024echo $SRC_DIR
25
26export MAPS=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor
27export INCS="\
28 -I $PARENT_DIR \
William Kurkian7c151592019-03-27 09:36:15 -040029 -I ${PARENT_DIR}/google/api"
William Kurkianbd3736d2019-03-08 12:20:40 -050030
31export VOLTHA_PB="\
32 $SRC_DIR/adapter.proto \
33 $SRC_DIR/device.proto \
34 $SRC_DIR/events.proto \
35 $SRC_DIR/health.proto \
36 $SRC_DIR/logical_device.proto \
37 $SRC_DIR/ponsim.proto \
38 $SRC_DIR/voltha.proto"
39
40export COMMON_PB="\
41 $SRC_DIR/common.proto \
42 $SRC_DIR/meta.proto \
43 $SRC_DIR/yang_options.proto"
44
45export INTER_CONTAINER_PB="$SRC_DIR/inter_container.proto"
46export SCHEMA_PB="$SRC_DIR/schema.proto"
47export IETF_PB="$SRC_DIR/ietf_interfaces.proto"
48export OF_PB="$SRC_DIR/openflow_13.proto"
49export OMCI_PB="$SRC_DIR/omci*.proto"
50export AFROUTER_PB="$SRC_DIR/afrouter.proto"
William Kurkian7c151592019-03-27 09:36:15 -040051export OPENOLT_PB="$SRC_DIR/openolt.proto"
William Kurkianbd3736d2019-03-08 12:20:40 -050052
53export PB_VARS="\
54 VOLTHA_PB \
55 COMMON_PB \
56 INTER_CONTAINER_PB \
57 SCHEMA_PB \
58 IETF_PB \
59 OF_PB \
60 OMCI_PB \
61 AFROUTER_PB \
William Kurkian7c151592019-03-27 09:36:15 -040062 OMCI_PB \
63 OPENOLT_PB"
William Kurkianbd3736d2019-03-08 12:20:40 -050064
William Kurkian7c151592019-03-27 09:36:15 -040065
66export OTHER_INCLUDES="${PARENT_DIR}/google/api"
William Kurkian6ea97f82019-03-13 15:51:55 -040067export PROTO_DESC_FILE="go/voltha.pb"
William Kurkianbd3736d2019-03-08 12:20:40 -050068
69for pb_var in $PB_VARS
70do
71 pbs="$(eval echo \$$pb_var)"
72 echo "Compiling $pbs"
73 protoc --go_out=$MAPS,plugins=grpc:$GOPATH/src $INCS $pbs
74done
75
76protoc -I ${PARENT_DIR} -I ${OTHER_INCLUDES} --include_imports --include_source_info --descriptor_set_out=${PROTO_DESC_FILE} ${SRC_DIR}/*.proto