Skip to content
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

all: migrate gradle build to java-library plugin #7001

Merged
merged 23 commits into from
May 4, 2020

Conversation

dapengzhang0
Copy link
Member

@dapengzhang0 dapengzhang0 commented May 4, 2020

  • Use gradle configuration api for dependencies that are part of grpc public api signatures.
  • Replace deprecated gradle configurations compile, testCompile, runtime and testRuntime.
  • With minimal change in dependencies: If we need dep X and Y to compile our code, and if X transitively depends on Y, then our build would still pass even if we only include X as compile/implementation dependency for our project. Ideally we should include both X and Y explicitly as implementation dependency for our project, but in this PR we don't add the missing Y if it is previously missing. A followup PR will try to add all such missing dependencies by setting
    configurations {
        compileClasspath.transitive = false
    }

@@ -10,19 +10,20 @@ plugins {
description = 'gRPC: Protobuf'

dependencies {
compile project(':grpc-api'),
api project(':grpc-api'),
libraries.jsr305,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why expose this one?

android-interop-testing/build.gradle Show resolved Hide resolved
libraries.animalsniffer_annotations
guavaDependency 'compile'
api project(':grpc-context'),
libraries.jsr305
Copy link
Contributor

Choose a reason for hiding this comment

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

Why expose this one?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is part of public API signature.

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean annotations like @javax.annotation.concurrent.ThreadSafe, @javax.annotation.Nullable are part of some public API signature.

cronet/build.gradle Show resolved Hide resolved
Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

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

Thank you. Much easier to review.

}
compile libraries.netty_tcnative
implementation libraries.protobuf
implementation libraries.truth
Copy link
Member

Choose a reason for hiding this comment

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

Why was this dep added?

Copy link
Member Author

Choose a reason for hiding this comment

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

Trying to build without it:

/Users/zdapeng/git/grpc-java/gae-interop-testing/gae-jdk8/src/main/java/io/grpc/testing/integration/NettyClientInteropServlet.java:137: error: cannot find symbol
      assertTrue(builder instanceof NettyChannelBuilder);

The reason should be that truth was a dep of grpc-interop-testing which is now changed from compile to implementation. Only api/compile dep is transitive for compileClasspath across subproject. Implementation dep is transitive for runtimeClasspath.

Copy link
Member

Choose a reason for hiding this comment

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

assertTrue is a junit method. This should probably be implementation libraries.junit.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right. My mistake. Done.

protobuf/build.gradle Show resolved Hide resolved
@dapengzhang0 dapengzhang0 merged commit 0044f8c into grpc:master May 4, 2020
@dapengzhang0 dapengzhang0 deleted the java-library-all branch May 4, 2020 23:44
@@ -31,7 +31,7 @@ for (subproject in rootProject.subprojects) {
}

dependencies {
compile subprojects.minus(project(':grpc-protobuf-lite'))
implementation subprojects.minus(project(':grpc-protobuf-lite'))
Copy link
Member Author

Choose a reason for hiding this comment

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

It seems we should use api here. @ejona86 what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

It is probably better to use api to avoid breaking people. That said, I don't have too much sympathy for someone using grpc-all these days (vs early-on-pre-1.0 when it was used more heavily).

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants