@@ -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
5556DESCR_INCLUDE_SOURCE_INFO=false
5657DESCR_FILENAME=" descriptor_set.pb"
5758CSHARP_OPT=" "
59+ SCALA_OPT=" "
5860SWAGGER_JSON=false
5961
6062while 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
0 commit comments