Skip to content

Commit

Permalink
[ggj][bazel] fix: rename protoc plugin binary (#296)
Browse files Browse the repository at this point in the history
* fix: refactor and rename Bazel rules to use googleapis' toolchain

* fix: simplify Bazel rules post-refactoring

* fix: rename protoc plugin binary
  • Loading branch information
miraleung authored Sep 12, 2020
1 parent dd21dd5 commit dcf91f6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ java_proto_library(
# ============= Binary targets ================

java_binary(
name = "protoc-gen-gapic-java",
name = "protoc-gen-java_gapic",
srcs = [
"//src/main/java/com/google/api/generator:generator_files",
],
Expand Down
4 changes: 2 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ below are temporary and better ones will be coming.
4. Build this plugin.

```sh
bazel build :protoc-gen-gapic-java
bazel build :protoc-gen-java_gapic
```

5. Run the plugin. At this stage, it will not do anything except write
hardcoded Java into two files.

```
protoc -I=${PROTOC_INCLUDE_DIR} -I=${GOOGLEAPIS_DIR} -I=${YOUR_PROTO_DIR} \
--plugin=bazel-bin/protoc-gen-gapic-java ~/dev/googleapis/google/showcase/v1test/*.proto \
--plugin=bazel-bin/protoc-gen-java_gapic ~/dev/googleapis/google/showcase/v1test/*.proto \
--gapic-java_out=/tmp/test
```

Expand Down
10 changes: 5 additions & 5 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ then
fi

# Build if needed.
if [[ "${FLAGS_use_cached}" == 0 ]] || [[ ! -f bazel-bin/protoc-gen-gapic-java ]]
if [[ "${FLAGS_use_cached}" == 0 ]] || [[ ! -f bazel-bin/protoc-gen-java_gapic ]]
then
echo_success "Rebuilding the microgenerator..."
bazel build :protoc-gen-gapic-java
bazel build :protoc-gen-java_gapic
if [[ $? -ne 0 ]]
then
echo_error "Build failed."
Expand All @@ -75,9 +75,9 @@ fi
# Run protoc.
protoc -I="${PROTOC_INCLUDE_DIR}" -I="${FLAGS_googleapis}" -I="${FLAGS_protos}" \
-I="${FLAGS_googleapis}/google/longrunning" \
--plugin=bazel-bin/protoc-gen-gapic-java ${FLAGS_protos}/*.proto \
--gapic-java_out="${FLAGS_out}" \
--gapic-java_opt="${FLAGS_service_config},${FLAGS_gapic_config}" \
--plugin=bazel-bin/protoc-gen-java_gapic ${FLAGS_protos}/*.proto \
--java_gapic_out="${FLAGS_out}" \
--java_gapic_opt="${FLAGS_service_config},${FLAGS_gapic_config}" \
--experimental_allow_proto3_optional

echo_success "Output files written to ${FLAGS_out}"

0 comments on commit dcf91f6

Please sign in to comment.