Skip to content

Commit ffbc759

Browse files
authored
fix: add new Bazel workflow to docs (#338)
* fix: add new Bazel workflow to docs This will work once [this PR](googleapis/googleapis#620) is in. * fix: update steps
1 parent 8705f55 commit ffbc759

File tree

1 file changed

+42
-17
lines changed

1 file changed

+42
-17
lines changed

DEVELOPMENT.md

+42-17
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,58 @@ below are temporary and better ones will be coming.
1818
1. Clone [googleapis](https://github.com/googleapis/googleapis) and
1919
[gapic-showcase](https://github.com/googleapis/gapic-showcase/) and install
2020
protoc.
21+
2122
2. Copy the protos from Showcase into googleapis/google/showcase.
2223

2324
```sh
2425
cp gapic-showcase/schema/google/showcase/v1beta1 googleapis/google/showcase/v1beta
2526
```
2627

27-
3. Export tool paths.
28-
29-
```sh
30-
PROTOC_INCLUDE_DIR=/usr/local/include/google/protobuf/
31-
GOOGLEAPIS_DIR=/usr/local/google/home/$USER/dev/googleapis
32-
YOUR_PROTO_DIR=/usr/local/google/home/$USER/dev/googleapis/google/showcase/v1beta
28+
3. Add the new microgenerator rules to the protobuf directory's `BUILD.bazel`
29+
file as follows:
30+
31+
```python
32+
load(
33+
"@com_google_googleapis_imports//:imports.bzl",
34+
# Existing rules here.
35+
"java_gapic_assembly_gradle_pkg2",
36+
"java_gapic_library2",
37+
)
38+
39+
# This should either replace the existing monolith target or have a unique name
40+
# that includes "java_gapic".
41+
java_gapic_library2(
42+
name = "showcase_java_gapic",
43+
srcs = [":showcase_proto_with_info"],
44+
# The gapic_yaml file is needed only for APIs that have batching configs.
45+
grpc_service_config = "showcase_grpc_service_config.json",
46+
package = "google.showcase.v1beta1",
47+
test_deps = [
48+
":showcase_java_grpc",
49+
],
50+
deps = [
51+
":showcase_java_proto",
52+
],
53+
)
54+
55+
java_gapic_assembly_gradle_pkg2(
56+
# This name should be unique from the existing target name.
57+
name = "google-cloud-showcase-v1beta1-java",
58+
deps = [
59+
# This is the new microgen target above.
60+
":showcase_java_gapic",
61+
# The following targets already exist.
62+
":showcase_java_grpc",
63+
":showcase_java_proto",
64+
":showcase_proto",
65+
],
66+
)
3367
```
3468
35-
4. Build this plugin.
69+
4. Build the new target.
3670
3771
```sh
38-
bazel build :protoc-gen-java_gapic
39-
```
40-
41-
5. Run the plugin. At this stage, it will not do anything except write
42-
hardcoded Java into two files.
43-
44-
```
45-
protoc -I=${PROTOC_INCLUDE_DIR} -I=${GOOGLEAPIS_DIR} -I=${YOUR_PROTO_DIR} \
46-
--plugin=bazel-bin/protoc-gen-java_gapic ~/dev/googleapis/google/showcase/v1test/*.proto \
47-
--gapic-java_out=/tmp/test
72+
bazel build google/showcase/v1beta1:showcase_java_gapic
4873
```
4974
5075
## Code Formatting

0 commit comments

Comments
 (0)