Skip to content

Commit

Permalink
auto-depend on grpc runtime artifact (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewparmet authored Dec 15, 2024
1 parent e5b33fb commit 51d904d
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ plugins {
}

dependencies {
implementation(project(":protokt-runtime-grpc-lite"))
implementation(libs.grpc.stub)

runtimeOnly(libs.grpc.netty)
Expand Down
1 change: 0 additions & 1 deletion examples/grpc-node/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ protokt {
}

dependencies {
implementation(project(":protokt-runtime-grpc-lite"))
implementation(project(":examples:protos"))
implementation(libs.kotlinx.coroutines.core)

Expand Down
20 changes: 20 additions & 0 deletions shared-src/gradle-plugin/protokt/v1/gradle/ProtoktBuild.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ internal fun configureProtokt(
project.afterEvaluate {
project.configurations.named(EXTENSIONS) {
project.resolveProtoktCoreDep(protoktVersion)?.let(dependencies::add)
project.resolveProtoktGrpcDep(protoktVersion)?.let(dependencies::add)
}
}
}
Expand Down Expand Up @@ -232,6 +233,25 @@ internal fun Project.resolveProtoktCoreDep(protoktVersion: Any?): Dependency? {
}
}

internal fun Project.resolveProtoktGrpcDep(protoktVersion: Any?): Dependency? {
val artifactId =
if (the<ProtoktExtension>().generate.grpcDescriptors) {
if (the<ProtoktExtension>().generate.descriptors) {
"protokt-runtime-grpc"
} else {
"protokt-runtime-grpc-lite"
}
} else {
return null
}

return if (protoktVersion == null) {
dependencies.project(":$artifactId")
} else {
dependencies.create("com.toasttab.protokt:$artifactId:$protoktVersion")
}
}

internal fun Project.appliedKotlinPlugin() =
when {
plugins.hasPlugin("org.jetbrains.kotlin.multiplatform") ->
Expand Down
1 change: 0 additions & 1 deletion testing/interop/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ dependencies {
protoktExtensions(project(":extensions:protokt-extensions"))

implementation(libs.grpc.stub)
implementation(project(":protokt-runtime-grpc"))

testImplementation(project(":protokt-reflect"))
testImplementation(project(":testing:protobuf-java"))
Expand Down
1 change: 0 additions & 1 deletion testing/options/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ dependencies {
protoktExtensions(project(":third-party:proto-google-common-protos-extensions"))

implementation(libs.grpc.stub)
implementation(project(":protokt-runtime-grpc-lite"))

testImplementation(kotlin("reflect"))
testImplementation(project(":testing:protokt-generation"))
Expand Down
1 change: 0 additions & 1 deletion testing/protokt-generation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ protokt {

dependencies {
implementation(kotlin("reflect"))
implementation(project(":protokt-runtime-grpc"))
implementation(project(":testing:protobuf-java"))
implementation(libs.grpc.kotlin.stub)
implementation(libs.grpc.stub)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ protokt {
dependencies {
protobufExcludingProtobufJava(libs.protoGoogleCommonProtos)

api(project(":protokt-runtime-grpc"))
api(project(":third-party:proto-google-common-protos-grpc"))
api(libs.grpc.kotlin.stub)
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ protokt {
dependencies {
protobufExcludingProtobufJava(libs.protoGoogleCommonProtos)

api(project(":protokt-runtime-grpc-lite"))
api(project(":third-party:proto-google-common-protos"))
api(libs.grpc.stub)
}

0 comments on commit 51d904d

Please sign in to comment.