Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 49 additions & 21 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ $ cd showcase
$ mvn compile -P update
```

## Running the Plugin
## Running the Plugin under googleapis with local gapic-generator-java

See also above section "Showcase Integration Testing".

Expand All @@ -171,28 +171,52 @@ To generate a production GAPIC API:
2. Point to local gapic-generator-java

Normally, googleapis's build pulls in googleapis/gapic-generator-java from the
Internet:

```
# Java microgenerator.
_gapic_generator_java_version = "2.1.0"
Internet, we need to build a local SNAPSHOT jar first and point googleapis to the SNAPSHOT jar and local copy of the repo.

http_archive(
name = "gapic_generator_java",
urls = ["https://github.com/googleapis/gapic-generator-java/archive/v%s.zip" % _gapic_generator_java_version],
)
Before:
```
_gapic_generator_java_version = "2.13.0"

maven_install(
artifacts = [
"com.google.api:gapic-generator-java:" + _gapic_generator_java_version,
],
#Update this False for local development
fail_on_missing_checksum = True,
repositories = [
"m2Local",
"https://repo.maven.apache.org/maven2/",
]
)

http_archive(
name = "gapic_generator_java",
strip_prefix = "gapic-generator-java-%s" % _gapic_generator_java_version,
urls = ["https://github.com/googleapis/gapic-generator-java/archive/v%s.zip" % _gapic_generator_java_version],
)
```

By replacing this portion using the built-in local_repository rule, you can make
it refer to your local development repo:
After

```
local_repository(
name = "gapic_generator_java",
path = "/home/<your id>/gapic-generator-java",
)
_gapic_generator_java_version = "2.13.1-SNAPSHOT"

maven_install(
artifacts = [
"com.google.api:gapic-generator-java:" + _gapic_generator_java_version,
],
#Update this False for local development
fail_on_missing_checksum = False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm Bazel novice) Can't this True/False be a variable, based on _gapic-generator_java_version has SNAPSHOT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's doable as Bazel scripts are basically a Python variant, but we may want to test non-SNAPSHOT version locally sometimes.

repositories = [
"m2Local",
"https://repo.maven.apache.org/maven2/",
]
)

local_repository(
name = "gapic_generator_java",
path = "/absolute/path/to/your/local/gapic-generator-java",
)
```

3. Build the new target.
Expand All @@ -206,6 +230,10 @@ To generate a production GAPIC API:
```
bazel build //google/cloud/speech/v2:google-cloud-speech-v2-java
```




Note: If you are running into bazel build issues, you can try to remove gapic-generator-java cached in your local m2
Try running this command:
```
rm -rf ~/.m2/repository/com/google/api/
```
and then rebuild gapic-generator-java (`mvn clean install`).