Skip to content

Conversation

Jozott00
Copy link
Collaborator

Subsystem
gRPC

Solution
This PR adds the samples/grpc-kmp-app project, a small KMP chat app (including server) that shows how to use the gRPC library.

@Jozott00 Jozott00 self-assigned this Sep 12, 2025
@Jozott00 Jozott00 added the docs Improvements or additions to documentation label Sep 12, 2025
Comment on lines +90 to +99
// TODO: What is the correct way to declare this dependency?
// (without it fails when executing "publishAllPublicationsToBuildRepository")"
val bufGenerateCommonMain = tasks.named("bufGenerateCommonMain")

tasks.withType<org.gradle.jvm.tasks.Jar>().configureEach {
// Only for sources jars
if (archiveClassifier.orNull == "sources" || name.endsWith("SourcesJar")) {
dependsOn(bufGenerateCommonMain)
}
}
Copy link
Collaborator Author

@Jozott00 Jozott00 Sep 12, 2025

Choose a reason for hiding this comment

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

@Mr3zee The source jar must define the dependency on bufGenerateCommonMain outputs, otherwise I get the following gradle error for all targets during publishAllPublicationsToBuildRepository.

> Task :protobuf:protobuf-core:bufGenerateCommonMain FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':protobuf:protobuf-core:bufGenerateCommonMain' (type 'BufGenerateTask').
  - Gradle detected a problem with the following location: '/Users/johannes.zottele/IdeaProjects/kotlinx-rpc/protobuf/protobuf-core/src/commonMain/generated-code'.
    
    Reason: Task ':protobuf:protobuf-core:macosX64SourcesJar' uses this output of task ':protobuf:protobuf-core:bufGenerateCommonMain' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':protobuf:protobuf-core:bufGenerateCommonMain' as an input of ':protobuf:protobuf-core:macosX64SourcesJar'.
      2. Declare an explicit dependency on ':protobuf:protobuf-core:bufGenerateCommonMain' from ':protobuf:protobuf-core:macosX64SourcesJar' using Task#dependsOn.
      3. Declare an explicit dependency on ':protobuf:protobuf-core:bufGenerateCommonMain' from ':protobuf:protobuf-core:macosX64SourcesJar' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.14.2/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

I’m not sure what the proper way is to fix that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant