Skip to content

Commit cbb9dce

Browse files
authored
docs: development with local gapic-generator-java (#1132)
* docs: development with local gapic-generator-java * adding instruction for arbitrary target
1 parent 17d5c04 commit cbb9dce

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

gapic-generator-java/DEVELOPMENT.md

+48-7
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@
9797

9898
## Running the Plugin
9999

100-
1. Clone [googleapis](https://github.com/googleapis/googleapis) and
100+
1. Clone [googleapis](https://github.com/googleapis/googleapis) and
101101
[gapic-showcase](https://github.com/googleapis/gapic-showcase/).
102102

103-
2. Copy the protos from Showcase into googleapis/google/showcase.
103+
2. Copy the protos from Showcase into googleapis/google/showcase.
104104

105105
```sh
106106
mkdir googleapis/google/showcase
107107
cp -r gapic-showcase/schema/google/showcase/v1beta1 googleapis/google/showcase/v1beta1
108108
```
109109

110-
3. Add the new microgenerator rules to
110+
3. Add the new microgenerator rules to
111111
`googleapis/google/showcase/v1beta1/BUILD.bazel` file as follows:
112112

113113
```python
@@ -162,8 +162,49 @@
162162
)
163163
```
164164

165-
4. Build the new target.
165+
4. Point to local gapic-generator-java
166+
167+
Normally, googleapis's build pulls in googleapis/gapic-generator-java from the
168+
Internet:
169+
170+
```
171+
# Java microgenerator.
172+
173+
_gapic_generator_java_version = "2.1.0"
174+
175+
http_archive(
176+
name = "gapic_generator_java",
177+
178+
urls = ["https://github.com/googleapis/gapic-generator-java/archive/v%s.zip" % _gapic_generator_java_version],
179+
)
180+
```
181+
182+
By replacing this portion using the built-in local_repository rule, you can mak
183+
it refer to your local development repo:
184+
185+
```
186+
local_repository(
187+
name = "gapic_generator_java",
188+
path = "/home/<your id>/gapic-generator-java",
189+
)
190+
```
191+
192+
5. Build the new target.
193+
194+
```sh
195+
cd googleapis
196+
bazel build //google/showcase/v1beta1:showcase_java_gapic
197+
```
198+
199+
You can generate any client library based on the protos within googleapis.
200+
You just need the name of the service within the `java_gapic_assembly_gradle_pkg`
201+
rules within the service's `BUILD.bazel` file.
202+
For instance, to run your local generator on the `speech`'s v2 service, you can
203+
run:
204+
205+
```
206+
bazel build //google/cloud/speech/v2:google-cloud-speech-v2-java
207+
```
208+
209+
166210
167-
```sh
168-
bazel build //google/showcase/v1beta1:showcase_java_gapic
169-
```

0 commit comments

Comments
 (0)