Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add generic options flag to gapic script #66

Merged
merged 1 commit into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ RUN pip install /usr/src/gapic-generator-python
# Define the generator as an entry point.
ENTRYPOINT protoc --proto_path=/protos/ --proto_path=/in/ \
--python_gapic_out=/out/ \
--python_gapic_opt=$PLUGIN_OPTIONS \
`find /in/ -name *.proto`
12 changes: 8 additions & 4 deletions gapic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ CMD="$0"
IMAGE=
IN=
OUT=
PLUGIN_OPTIONS=
PROTO_PATH=`pwd`

# Print help and exit.
function show_help {
echo "Usage: $CMD --image IMAGE --in IN_DIR --out OUT_DIR [--path PATH_DIR]"
echo "Usage: $CMD --image IMAGE --in IN_DIR --out OUT_DIR [--options PLUGIN_OPTIONS --path PATH_DIR]"
echo ""
echo "Required arguments:"
echo " --image The Docker image to use. The script will attempt to pull"
Expand All @@ -34,9 +35,10 @@ function show_help {
echo " -o, --out Destination directory for the completed client library."
echo ""
echo "Optional arguments:"
echo " -p, --path The base import path for the protos. Assumed to be the"
echo " current working directory if unspecified."
echo " -h, --help This help information."
echo " --options Options to be passed to the generator plugin"
echo " -p, --path The base import path for the protos. Assumed to be the"
echo " current working directory if unspecified."
echo " -h, --help This help information."
exit 0
}

Expand All @@ -47,6 +49,7 @@ while true; do
--image ) IMAGE="$2"; shift 2 ;;
-i | --in ) IN="$2"; shift 2 ;;
-o | --out ) OUT="$2"; shift 2 ;;
--options ) PLUGIN_OPTIONS="$2"; shift 2 ;;
-p | --path ) PROTO_PATH=$2; shift 2 ;;
-- ) shift; break; ;;
* ) break ;;
Expand Down Expand Up @@ -97,5 +100,6 @@ docker run \
--mount type=bind,source=$OUT,destination=/out \
--rm \
--user $UID \
--env "PLUGIN_OPTIONS=$PLUGIN_OPTIONS" \
$IMAGE
exit $?