Skip to content

Commit 09e2fe2

Browse files
authored
Add arg "--scala_opt" to support scalapbc options (#180)
* Update entrypoint.sh * Default to "" * Fix * Bumping BUILD_VERSION to 2
1 parent d7a53c8 commit 09e2fe2

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

all/entrypoint.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ printUsage() {
3030
as surrounding comments."
3131
echo " --descr-filename The filename for the descriptor proto when used with -l descriptor_set. Default to descriptor_set.pb"
3232
echo " --csharp_opt The options to pass to protoc to customize the csharp code generation."
33+
echo " --scala_opt The options to pass to protoc to customize the scala code generation."
3334
echo " --with-swagger-json-names Use with --with-gateway flag. Generated swagger file will use JSON names instead of protobuf names."
3435
}
3536

@@ -55,6 +56,7 @@ DESCR_INCLUDE_IMPORTS=false
5556
DESCR_INCLUDE_SOURCE_INFO=false
5657
DESCR_FILENAME="descriptor_set.pb"
5758
CSHARP_OPT=""
59+
SCALA_OPT=""
5860
SWAGGER_JSON=false
5961

6062
while test $# -gt 0; do
@@ -174,6 +176,11 @@ while test $# -gt 0; do
174176
CSHARP_OPT=$1
175177
shift
176178
;;
179+
--scala_opt)
180+
shift
181+
SCALA_OPT=$1
182+
shift
183+
;;
177184
--with-swagger-json-names)
178185
SWAGGER_JSON=true
179186
shift
@@ -283,7 +290,13 @@ plugins=grpc+embedded\
283290
GEN_STRING="--grpc_out=$OUT_DIR --${GEN_LANG}_out=$OUT_DIR --plugin=protoc-gen-grpc=`which protoc-gen-grpc-java`"
284291
;;
285292
"scala")
286-
GEN_STRING="--scala_out=$OUT_DIR --plugin=`which protoc-gen-scala`"
293+
SCALA_OUT=$OUT_DIR
294+
295+
if [[ ! -z $SCALA_OPT ]]; then
296+
SCALA_OUT="$SCALA_OPT:$OUT_DIR"
297+
fi
298+
299+
GEN_STRING="--scala_out=$SCALA_OUT --plugin=`which protoc-gen-scala`"
287300
;;
288301
"node")
289302
GEN_STRING="--grpc_out=$OUT_DIR --js_out=import_style=commonjs,binary:$OUT_DIR --plugin=protoc-gen-grpc=`which grpc_${PLUGIN_LANG}_plugin`"
@@ -395,11 +408,11 @@ if [ $GEN_GATEWAY = true ]; then
395408

396409
protoc $PROTO_INCLUDE \
397410
--grpc-gateway_out=logtostderr=true:$GATEWAY_DIR ${PROTO_FILES[@]}
398-
411+
399412
if [[ $SWAGGER_JSON == true ]]; then
400413
protoc $PROTO_INCLUDE \
401414
--swagger_out=logtostderr=true,json_names_for_fields=true:$GATEWAY_DIR ${PROTO_FILES[@]}
402-
else
415+
else
403416
protoc $PROTO_INCLUDE \
404417
--swagger_out=logtostderr=true:$GATEWAY_DIR ${PROTO_FILES[@]}
405418
fi

variables.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ DOCKER_REPO=${DOCKER_REPO}
44
NAMESPACE=${NAMESPACE:-namely}
55
GRPC_VERSION=${GRPC_VERSION:-1.29}
66
GRPC_JAVA_VERSION=${GRPC_JAVA_VERSION:-1.29}
7-
BUILD_VERSION=${BUILD_VERSION:-1}
7+
BUILD_VERSION=${BUILD_VERSION:-2}
88
CONTAINER=${DOCKER_REPO}${NAMESPACE}
99
LATEST=${1:false}
1010
BUILDS=("protoc-all" "protoc" "prototool" "grpc-cli" "gen-grpc-gateway")

0 commit comments

Comments
 (0)