Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
16 changes: 10 additions & 6 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ below are temporary and better ones will be coming.
java_gapic_library2(
name = "showcase_java_gapic",
srcs = [":showcase_proto_with_info"],
# The gapic_yaml file is needed only for APIs that have batching configs.
grpc_service_config = "showcase_grpc_service_config.json",
package = "google.showcase.v1beta1",
test_deps = [
Expand Down Expand Up @@ -100,21 +99,26 @@ below are temporary and better ones will be coming.
bazel run //src/test/java/com/google/api/generator/engine:JavaCodeGeneratorTest
```

- Update goldens files based on code generation in unit test, for example `JavaCodeGeneratorTest.java`
- Update goldens files based on code generation in unit test, for example
`JavaCodeGeneratorTest.java`

```sh
bazel run //src/test/java/com/google/api/generator/engine:JavaCodeGeneratorTest_update
```

- Run a single integration test for API like `Redis`, it generates Java source code using
the Java microgenerator and compares them with the goldens files in `test/integration/goldens/redis`.
- Run a single integration test for API like `Redis`, it generates Java source
code using the Java microgenerator and compares them with the goldens files
in `test/integration/goldens/redis`.

```sh
bazel test //test/integration:redis
```

- Update goldens files based on code generation in integration test, for example `Redis`. It generates Java source code using the Java microgenerator and overwrites the goldens files in `test/integration/goldens/redis` based on code generation.
- Update goldens files based on code generation in integration test, for
example `Redis`. It generates Java source code using the Java microgenerator
and overwrites the goldens files in `test/integration/goldens/redis` based
on code generation.

```sh
bazel run //test/integration:redis_update
```
```
4 changes: 0 additions & 4 deletions rules_java_gapic/java_gapic.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def java_gapic_library(
package = None,
service_yaml = None,
grpc_service_config = None,
gapic_yaml = None,
deps = [],
test_deps = [],
**kwargs):
Expand All @@ -92,9 +91,6 @@ def java_gapic_library(
if grpc_service_config:
file_args_dict[grpc_service_config] = "grpc-service-config"

if gapic_yaml:
file_args_dict[gapic_yaml] = "gapic-config"

# Currently a no-op.
if service_yaml:
file_args_dict[service_yaml] = "gapic-service-config"
Expand Down
8 changes: 1 addition & 7 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ DEFINE_string --alias=s service_config '' 'Path to the JSON service config'
# Optional flags.
DEFINE_bool --alias=c use_cached false 'If true, does not rebuild the plugin.'
DEFINE_string --alias=o out '/tmp/test' 'Output directory'
DEFINE_string gapic_config '' 'Path to the config ending in gapic.yaml. Optional'

gbash::init_google "$@"

Expand Down Expand Up @@ -78,19 +77,14 @@ if [ -n "$FLAGS_service_config" ]
then
SERVICE_CONFIG_OPT="grpc-service-config=$FLAGS_service_config"
fi
GAPIC_CONFIG_OPT=""
if [ -n "$FLAGS_gapic_config" ]
then
GAPIC_CONFIG_OPT="gapic-config=$FLAGS_gapic_config"
fi

# Run protoc.
protoc -I="${PROTOC_INCLUDE_DIR}" -I="${FLAGS_googleapis}" -I="${FLAGS_protos}" \
-I="${FLAGS_googleapis}/google/longrunning" \
--include_source_info \
--plugin=bazel-bin/protoc-gen-java_gapic ${FLAGS_protos}/*.proto \
--java_gapic_out="${FLAGS_out}" \
--java_gapic_opt="${SERVICE_CONFIG_OPT},${GAPIC_CONFIG_OPT}" \
--java_gapic_opt="${SERVICE_CONFIG_OPT}" \
--experimental_allow_proto3_optional

echo_success "Output files written to ${FLAGS_out}"
Loading