Skip to content

Commit

Permalink
Tighter dependency for protoc plugin (#2209)
Browse files Browse the repository at this point in the history
Motivation:
Currently the `servicetalk-grpc-protoc` module exposes javapoet and
protobuf-java as dependencies though they are used only in the protoc
plugin and are not accurately dependencies of the module.
Modifications:
Use `compileOnly` for protoc plugin dependencies and change shadowJar
to build using `compileClasspath` configuration. The dependencies are
also needed for `testImplementation`.
Result:
Fewer exposed dependencies, especially dependency which is not
actually used by module outside of protoc plugin.
  • Loading branch information
bondolo authored May 11, 2022
1 parent 4bcfe24 commit 4ce81d5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions servicetalk-grpc-protoc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ dependencies {

implementation project(":servicetalk-annotations")

// runtimeOnly is enough for this module in isolation, but we want transitive modules to include at compile time too.
// Needed for the generated classes
api project(":servicetalk-data-protobuf")

implementation "com.google.code.findbugs:jsr305:$jsr305Version"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.squareup:javapoet:$javaPoetVersion"
compileOnly "com.google.code.findbugs:jsr305:$jsr305Version"
compileOnly "com.squareup:javapoet:$javaPoetVersion"

testImplementation project(":servicetalk-grpc-api")
testImplementation project(":servicetalk-grpc-protobuf")
testImplementation "com.squareup:javapoet:$javaPoetVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api"
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion"
}
Expand All @@ -48,6 +48,8 @@ jar {
}

shadowJar {
// includes javaPoet and Google protobufs
configurations = [project.configurations.compileClasspath]
archiveBaseName = project.name
classifier = 'all'
}
Expand Down

0 comments on commit 4ce81d5

Please sign in to comment.