@@ -18,33 +18,58 @@ below are temporary and better ones will be coming.
18
18
1. Clone [googleapis](https://github.com/googleapis/googleapis) and
19
19
[gapic-showcase](https://github.com/googleapis/gapic-showcase/) and install
20
20
protoc.
21
+
21
22
2. Copy the protos from Showcase into googleapis/google/showcase.
22
23
23
24
` ` ` sh
24
25
cp gapic-showcase/schema/google/showcase/v1beta1 googleapis/google/showcase/v1beta
25
26
` ` `
26
27
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
+ )
33
67
```
34
68
35
- 4. Build this plugin .
69
+ 4. Build the new target .
36
70
37
71
```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
48
73
```
49
74
50
75
## Code Formatting
0 commit comments