|
97 | 97 |
|
98 | 98 | ## Running the Plugin
|
99 | 99 |
|
100 |
| -1. Clone [googleapis](https://github.com/googleapis/googleapis) and |
| 100 | +1. Clone [googleapis](https://github.com/googleapis/googleapis) and |
101 | 101 | [gapic-showcase](https://github.com/googleapis/gapic-showcase/).
|
102 | 102 |
|
103 |
| -2. Copy the protos from Showcase into googleapis/google/showcase. |
| 103 | +2. Copy the protos from Showcase into googleapis/google/showcase. |
104 | 104 |
|
105 | 105 | ```sh
|
106 | 106 | mkdir googleapis/google/showcase
|
107 | 107 | cp -r gapic-showcase/schema/google/showcase/v1beta1 googleapis/google/showcase/v1beta1
|
108 | 108 | ```
|
109 | 109 |
|
110 |
| -3. Add the new microgenerator rules to |
| 110 | +3. Add the new microgenerator rules to |
111 | 111 | `googleapis/google/showcase/v1beta1/BUILD.bazel` file as follows:
|
112 | 112 |
|
113 | 113 | ```python
|
|
162 | 162 | )
|
163 | 163 | ```
|
164 | 164 |
|
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 | +
|
166 | 210 |
|
167 |
| - ```sh |
168 |
| - bazel build //google/showcase/v1beta1:showcase_java_gapic |
169 |
| - ``` |
|
0 commit comments