Skip to content

chore: Merge Pre-DIREGAPIC refactoring #735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
echo "The old one will disappear after 7 days."

- name: Unit Tests
run: bazel --batch test $(bazel query "//src/test/..." | grep "Test$") --noshow_progress
run: bazel --batch test $(bazel query "//src/test/..." | grep "Test$") --noshow_progress --test_output=errors

- name: Integration Tests
run: bazel --batch test //test/integration:asset //test/integration:credentials //test/integration:iam //test/integration:kms //test/integration:logging //test/integration:redis //test/integration:library --noshow_progress
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

* Add PubSub to service.yaml / mixin allowlist ([#729](https://www.github.com/googleapis/gapic-generator-java/issues/729)) ([e7f6d33](https://www.github.com/googleapis/gapic-generator-java/commit/e7f6d33051e335504b05c402d3b98c387a9f0daf))


### [1.0.6](https://www.github.com/googleapis/gapic-generator-java/compare/v1.0.5...v1.0.6) (2021-05-19)


Expand Down
3 changes: 1 addition & 2 deletions dependencies.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ version.com_google_protobuf=3.13.0
# Version of google-java-format is downgraded from 1.8 to 1.7, because 1.8 supports java 11 minimum, while our JRE is java 8.
version.google_java_format=1.7
version.com_google_api_common_java=1.9.3
# TODO(miraleung): Update this.
version.com_google_gax_java=1.62.0
version.io_grpc_java=1.30.2

# Common deps.
maven.com_google_guava_guava=com.google.guava:guava:26.0-jre
maven.com_google_guava_guava=com.google.guava:guava:30.1-android
maven.com_google_code_findbugs_jsr305=com.google.code.findbugs:jsr305:3.0.0
maven.com_google_auto_value_auto_value=com.google.auto.value:auto-value:1.7.2
maven.com_google_auto_value_auto_value_annotations=com.google.auto.value:auto-value-annotations:1.7.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ java_library(
"//src/main/java/com/google/api/generator/engine/writer",
"//src/main/java/com/google/api/generator/gapic:status_java_proto",
"//src/main/java/com/google/api/generator/gapic/composer/comment",
"//src/main/java/com/google/api/generator/gapic/composer/common",
"//src/main/java/com/google/api/generator/gapic/composer/defaultvalue",
"//src/main/java/com/google/api/generator/gapic/composer/grpc",
"//src/main/java/com/google/api/generator/gapic/composer/resourcename",
"//src/main/java/com/google/api/generator/gapic/composer/samplecode",
"//src/main/java/com/google/api/generator/gapic/composer/store",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
import com.google.api.generator.engine.ast.ClassDefinition;
import com.google.api.generator.engine.ast.ScopeNode;
import com.google.api.generator.gapic.composer.comment.CommentComposer;
import com.google.api.generator.gapic.composer.common.ServiceClientClassComposer;
import com.google.api.generator.gapic.composer.common.ServiceStubClassComposer;
import com.google.api.generator.gapic.composer.grpc.GrpcServiceCallableFactoryClassComposer;
import com.google.api.generator.gapic.composer.grpc.GrpcServiceStubClassComposer;
import com.google.api.generator.gapic.composer.grpc.MockServiceClassComposer;
import com.google.api.generator.gapic.composer.grpc.MockServiceImplClassComposer;
import com.google.api.generator.gapic.composer.grpc.ServiceClientTestClassComposer;
import com.google.api.generator.gapic.composer.grpc.ServiceSettingsClassComposer;
import com.google.api.generator.gapic.composer.grpc.ServiceStubSettingsClassComposer;
import com.google.api.generator.gapic.composer.resourcename.ResourceNameHelperClassComposer;
import com.google.api.generator.gapic.model.GapicClass;
import com.google.api.generator.gapic.model.GapicClass.Kind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class SettingsCommentComposer {
public static final CommentStatement DEFAULT_CREDENTIALS_PROVIDER_BUILDER_METHOD_COMMENT =
toSimpleComment("Returns a builder for the default credentials for this service.");

public static final CommentStatement DEFAULT_GRPC_TRANSPORT_PROVIDER_BUILDER_METHOD_COMMENT =
public static final CommentStatement DEFAULT_TRANSPORT_PROVIDER_BUILDER_METHOD_COMMENT =
toSimpleComment("Returns a builder for the default ChannelProvider for this service.");

public static final CommentStatement NEW_BUILDER_METHOD_COMMENT =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,53 @@
public class StubCommentComposer {
private static final String STUB_CLASS_HEADER_SUMMARY_PATTERN =
"Base stub class for the %s service API.";
private static final String GRPC_CALLABLE_FACTORY_CLASS_HEADER_SUMMARY_PATTERN =
"gRPC callable factory implementation for the %s service API.";
private static final String GRPC_STUB_CLASS_HEADER_SUMMARY_PATTERN =
"gRPC stub implementation for the %s service API.";
private static final String TRANSPORT_CALLABLE_FACTORY_CLASS_HEADER_SUMMARY_PATTERN =
"%s callable factory implementation for the %s service API.";
private static final String TRANSPORT_STUB_CLASS_HEADER_SUMMARY_PATTERN =
"%s stub implementation for the %s service API.";

private static final String ADVANCED_USAGE_DESCRIPTION = "This class is for advanced usage.";
private static final String ADVANCED_USAGE_API_REFLECTION_DESCRIPTION =
"This class is for advanced usage and reflects the underlying API directly.";

public static List<CommentStatement> createGrpcServiceStubClassHeaderComments(
private final String transportPrefix;

public StubCommentComposer(String transportPrefix) {
this.transportPrefix = transportPrefix;
}

public List<CommentStatement> createTransportServiceStubClassHeaderComments(
String serviceName, boolean isDeprecated) {
JavaDocComment.Builder javaDocBuilder = JavaDocComment.builder();
if (isDeprecated) {
javaDocBuilder = javaDocBuilder.setDeprecated(CommentComposer.DEPRECATED_CLASS_STRING);
}

return Arrays.asList(
CommentComposer.AUTO_GENERATED_CLASS_COMMENT,
CommentStatement.withComment(
javaDocBuilder
.addComment(String.format(GRPC_STUB_CLASS_HEADER_SUMMARY_PATTERN, serviceName))
.addComment(
String.format(
TRANSPORT_STUB_CLASS_HEADER_SUMMARY_PATTERN, transportPrefix, serviceName))
.addParagraph(ADVANCED_USAGE_API_REFLECTION_DESCRIPTION)
.build()));
}

public static List<CommentStatement> createGrpcServiceCallableFactoryClassHeaderComments(
public List<CommentStatement> createTransportServiceCallableFactoryClassHeaderComments(
String serviceName, boolean isDeprecated) {
JavaDocComment.Builder javaDocBuilder = JavaDocComment.builder();
if (isDeprecated) {
javaDocBuilder = javaDocBuilder.setDeprecated(CommentComposer.DEPRECATED_CLASS_STRING);
}

return Arrays.asList(
CommentComposer.AUTO_GENERATED_CLASS_COMMENT,
CommentStatement.withComment(
javaDocBuilder
.addComment(
String.format(GRPC_CALLABLE_FACTORY_CLASS_HEADER_SUMMARY_PATTERN, serviceName))
String.format(
TRANSPORT_CALLABLE_FACTORY_CLASS_HEADER_SUMMARY_PATTERN,
transportPrefix,
serviceName))
.addParagraph(ADVANCED_USAGE_DESCRIPTION)
.build()));
}
Expand Down
Loading