Skip to content

Commit

Permalink
make gogo flags as var for reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
rpatali committed Oct 11, 2019
1 parent 05e2602 commit 34ebfb3
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions codegen/runner/pre-steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ done
ABS_IDL_DIR="$(cd "$IDL_DIR" && pwd)"
ABS_GENCODE_DIR="$(cd "$BUILD_DIR" && pwd)/$(basename "$BUILD_DIR/gen-code")"

GOGO_WKT_COMPATIBILITY="\\
Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\\
Mgoogle/protobuf/api.proto=github.com/gogo/protobuf/types,\\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\\
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types,\\
Mgoogle/protobuf/source_context.proto=github.com/gogo/protobuf/types,\\
Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,\\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\\
Mgoogle/protobuf/type.proto=github.com/gogo/protobuf/types,\\
Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,\\
"

echo "Generating Go code from Proto files"
found_protos=$(find "$IDL_DIR" -name "*.proto")
for proto_file in ${found_protos}; do
Expand All @@ -81,17 +94,7 @@ for proto_file in ${found_protos}; do
proto_file="$PWD/$proto_file"
protoc --proto_path="$proto_path" \
--proto_path=./vendor/github.com/gogo/protobuf/protobuf \
--gogoslick_out=\
Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/api.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/source_context.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/type.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,:"$gencode_path" \
--gogoslick_out="$GOGO_WKT_COMPATIBILITY":"$gencode_path" \
"$proto_file"
done

Expand Down Expand Up @@ -125,17 +128,7 @@ for config_file in ${config_files}; do
proto_file="$ABS_IDL_DIR/$proto_file"
protoc --proto_path="$proto_path" \
--proto_path=./vendor/github.com/gogo/protobuf/protobuf \
--gogoslick_out=\
Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/api.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/source_context.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/type.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,:"$gencode_path" \
--gogoslick_out="$GOGO_WKT_COMPATIBILITY":"$gencode_path" \
--yarpc-go_out="$gencode_path" \
"$proto_file"
fi
Expand Down

0 comments on commit 34ebfb3

Please sign in to comment.