Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

GAX now declares google-auth-library-oauth2-http as runtime scope. Is this correct? #1534

Closed
suztomo opened this issue Oct 15, 2021 · 3 comments · Fixed by #1535
Closed

GAX now declares google-auth-library-oauth2-http as runtime scope. Is this correct? #1534

suztomo opened this issue Oct 15, 2021 · 3 comments · Fixed by #1535
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@suztomo
Copy link
Member

suztomo commented Oct 15, 2021

googleapis/java-shared-dependencies@3e5ffe0#r730141975 a check failed because GAX recently changed the scope of the google-auth-library-oauth2-http as runtime.

Screen Shot 2021-10-15 at 5 58 04 PM

This means the code that touches the class of google-auth-library-oauth2-http now have to declare google-auth-library-oauth2-http as dependency. (This is a good thing; If you use a class, then you should declare the dependency.)

Is there any other implications of changing the scope?

@suztomo suztomo added type: question Request for information or clarification. Not an issue. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Oct 15, 2021
@chanseokoh
Copy link
Contributor

chanseokoh commented Oct 15, 2021

I believe this is the commit that made the change. The compile configuration name (you may think of it as "scope" in Maven's terms) in Gradle is deprecated and shouldn't be used.

Now, whether google-auth-library-oauth2-http and (all other dependencies of gax-java affected by the change) should be exposed to the compile classpath of the user using gax-java, the answer depends on whether it's necessary to do so or not. As a Java library, if the public API surface of gax-java does make use of the classes from google-auth-library-oauth2-http (e.g., used as a return value of a public interface), then it must be exposed. Otherwise, if all the classes from google-auth-library-oauth2-http are never visible through the public surface but consumed only internally by gax-java, it shouldn't be exposed. I'm pretty new to gax-java, so I don't have an immediate answer.

@suztomo
Copy link
Member Author

suztomo commented Oct 16, 2021

Thank you for the pointer. I found the corresponding explanation of Gradle's "implementation" mapped to Maven's "runtime" scope:

Gradle will also use the versions resolved on the runtimeClasspath for dependencies declared in implementation, which are mapped to the runtime scope of Maven

https://docs.gradle.org/current/userguide/publishing_maven.html

@suztomo
Copy link
Member Author

suztomo commented Oct 16, 2021

@chanseokoh For the classes in com.google.auth.oauth2 (com.google.auth.oauth2.QuotaProjectIdProvider, com.google.auth.oauth2.ComputeEngineCredentials, com.google.auth.oauth2.GoogleCredentials, com.google.auth.oauth2.ServiceAccountCredentials, com.google.auth.oauth2.ServiceAccountJwtAccessCredentials, com.google.auth.oauth2.QuotaProjectIdProvider), I didn't find any of them used as API surface. Therefore "implementation" makes sense.

However, I found com.google.auth.Credentials class in google-auth-library-credentials is exposed in gax. This artifact is not declared in gax's build.gradle.

Screen Shot 2021-10-15 at 10 53 38 PM

Other artifacts?

org_threeten_threetenbp

The artifact defines org.threeten.bp.Duration.

gax exposes it in its public API

public abstract Duration getDelayThreshold();

gax-grpc uses it in its public API

gax-httpjson uses it in its public API

maven.com_google_api_api_common

gax uses com.google.api.core.ApiFuture in its public API

public ApiFuture<Void> pushCurrentBatch() {
.

gax-grpc uses it

public static ApiFuture<ListOperationsPagedResponse> createAsync(

gax-httpjson uses it

<ResponseT, RequestT> ApiFuture<ResponseT> issueFutureUnaryCall(

maven.io_opencensus_opencensus_api

It doesn't appear in the API surfaces of gax, gax-grpc, and gax-httpjson.

grpc-api

gax-grpc uses it in public API

grpc-auth, grpc-protobuf, grpc-netty-shaded, grpc-alts, grpc-stub

They are not in public API.

guava

gax-grpc uses com.google.common.collect.ImmutableList in public API

public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() {

gax-httpjson uses it in public API

public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() {

com_google_api_grpc_proto_google_common_protos

gax-grpc uses com.google.longrunning.Operation in public API

GrpcCallSettings<RequestT, Operation> grpcCallSettings,

gax-httpjson uses com.google.longrunning.ListOperationsRequest in public API

public UnaryCallable<ListOperationsRequest, ListOperationsPagedResponse>

com_google_protobuf

gax-httpjson uses com.google.protobuf.TypeRegistry in public API

public ResponseT parse(InputStream httpResponseBody, TypeRegistry registry) {

com_google_protobuf_java_util

It's not used as public API.

com_google_code_gson_gson

gax-httpjson uses com.google.gson.JsonElement in public API

com_google_http_client_google_http_client

gax-httpjson uses com.google.api.client.http.HttpTransport in public API

public Builder setHttpTransport(HttpTransport httpTransport) {

com_google_http_client_google_http_client_gson

This is not used in public API.

suztomo added a commit to suztomo/gax-java that referenced this issue Oct 16, 2021
suztomo added a commit to suztomo/gax-java that referenced this issue Oct 18, 2021
Adding more artifacts to be declared as 'api' because they appear
in public API surface. See the comment of the following issue
for the analysis:
googleapis#1534
suztomo added a commit that referenced this issue Oct 18, 2021
* deps: declaring the latest auth library version

* fix: declare API surface as api configuration

Fix #1534

* fix: declare API surface's dependencies as 'api'

Adding more artifacts to be declared as 'api' because they appear
in public API surface. See the comment of the following issue
for the analysis:
#1534

* refactor: move java-library declaration to top-level build.gradle
suztomo added a commit to suztomo/gax-java that referenced this issue Oct 18, 2021
* deps: declaring the latest auth library version

* fix: declare API surface as api configuration

Fix googleapis#1534

* fix: declare API surface's dependencies as 'api'

Adding more artifacts to be declared as 'api' because they appear
in public API surface. See the comment of the following issue
for the analysis:
googleapis#1534

* refactor: move java-library declaration to top-level build.gradle
suztomo added a commit that referenced this issue Oct 18, 2021
* deps: declaring the latest auth library version

* fix: declare API surface as api configuration

Fix #1534

* fix: declare API surface's dependencies as 'api'

Adding more artifacts to be declared as 'api' because they appear
in public API surface. See the comment of the following issue
for the analysis:
#1534

* refactor: move java-library declaration to top-level build.gradle
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants