blob: d221fa5c29d9ebcbda7722a120045d1abbae3066 [file] [log] [blame]
khenaidooabad44c2018-08-03 16:58:35 -04001#!/bin/sh
2
Zack Williams998f4422018-09-19 10:38:57 -07003# 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
khenaidooabad44c2018-08-03 16:58:35 -040017export SRC_DIR="$1"
18
19echo $SRC_DIR
20
21export MAPS=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor
22export INCS="\
23 -I $SRC_DIR \
khenaidooac637102019-01-14 15:44:34 -050024 -I /usr/local/include/googleapis"
khenaidooabad44c2018-08-03 16:58:35 -040025
26export VOLTHA_PB="\
27 $SRC_DIR/adapter.proto \
28 $SRC_DIR/device.proto \
29 $SRC_DIR/events.proto \
30 $SRC_DIR/health.proto \
31 $SRC_DIR/logical_device.proto \
32 $SRC_DIR/ponsim.proto \
33 $SRC_DIR/voltha.proto"
34
35export COMMON_PB="\
36 $SRC_DIR/common.proto \
37 $SRC_DIR/meta.proto \
38 $SRC_DIR/yang_options.proto"
39
khenaidoo79232702018-12-04 11:00:41 -050040export INTER_CONTAINER_PB="$SRC_DIR/inter_container.proto"
khenaidooabad44c2018-08-03 16:58:35 -040041export SCHEMA_PB="$SRC_DIR/schema.proto"
42export IETF_PB="$SRC_DIR/ietf_interfaces.proto"
43export OF_PB="$SRC_DIR/openflow_13.proto"
44export OMCI_PB="$SRC_DIR/omci*.proto"
sslobodra3ea7d42019-01-16 15:03:16 -050045export AFROUTER_PB="$SRC_DIR/afrouter.proto"
khenaidooabad44c2018-08-03 16:58:35 -040046
47export PB_VARS="\
48 VOLTHA_PB \
49 COMMON_PB \
khenaidoo79232702018-12-04 11:00:41 -050050 INTER_CONTAINER_PB \
khenaidooabad44c2018-08-03 16:58:35 -040051 SCHEMA_PB \
52 IETF_PB \
53 OF_PB \
sslobodra3ea7d42019-01-16 15:03:16 -050054 OMCI_PB \
55 AFROUTER_PB"
56
57export OTHER_INCLUDES="/usr/local/include/googleapis"
58export PROTO_DESC_FILE="${SRC_DIR}/voltha.pb"
khenaidooabad44c2018-08-03 16:58:35 -040059
60for pb_var in $PB_VARS
61do
62 pbs="$(eval echo \$$pb_var)"
63 echo "Compiling $pbs"
64 protoc --go_out=$MAPS,plugins=grpc:$GOPATH/src $INCS $pbs
65done
sslobodra3ea7d42019-01-16 15:03:16 -050066
67protoc -I ${SRC_DIR} -I ${OTHER_INCLUDES} --include_imports --include_source_info --descriptor_set_out=${PROTO_DESC_FILE} ${SRC_DIR}/*.proto