Skip to content

Commit

Permalink
Expose linting (#69)
Browse files Browse the repository at this point in the history
* Expose linting

* Update conditional

* Update entrypoint.sh

* formatting
  • Loading branch information
Ben Limmer authored and mdkess committed May 12, 2018
1 parent 3c29b88 commit 3a87206
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions all/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ printUsage() {
echo " -l LANGUAGE The language to generate (${SUPPORTED_LANGUAGES[@]})"
echo " -o DIRECTORY The output directory for generated files. Will be automatically created."
echo " -i includes Extra includes"
echo " --lint CHECKS Enable linting protoc-lint (CHECKS are optional - see https://github.com/ckaznocha/protoc-gen-lint#optional-checks)"
echo " --with-gateway Generate grpc-gateway files (experimental)."

}

GEN_GATEWAY=false
LINT=false
LINT_CHECKS=""
SUPPORTED_LANGUAGES=("go" "ruby" "csharp" "java" "python" "objc" "gogo" "php" "node")
EXTRA_INCLUDES=""
OUT_DIR=""
Expand Down Expand Up @@ -71,6 +74,14 @@ while test $# -gt 0; do
GEN_GATEWAY=true
shift
;;
--lint)
LINT=true
if [ "$#" -gt 1 ] && [[ $2 != -* ]]; then
LINT_CHECKS=$2
shift
fi
shift
;;
*)
break
;;
Expand Down Expand Up @@ -159,6 +170,15 @@ plugins=grpc+embedded\
;;
esac

LINT_STRING=''
if [[ $LINT == true ]]; then
if [[ $LINT_CHECKS == '' ]]; then
LINT_STRING="--lint_out=."
else
LINT_STRING="--lint_out=$LINT_CHECKS:."
fi
fi

PROTO_INCLUDE="-I /usr/include/ \
-I /usr/local/include/ \
-I ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/ \
Expand All @@ -175,6 +195,7 @@ fi

protoc $PROTO_INCLUDE \
$GEN_STRING \
$LINT_STRING \
${PROTO_FILES[@]}

# Python also needs __init__.py files in each directory to import.
Expand Down

0 comments on commit 3a87206

Please sign in to comment.