protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.83k stars 15.52k forks source link

generateDebugProto task failing #10334

Closed MaxMichel2 closed 2 years ago

MaxMichel2 commented 2 years ago

What version of protobuf and what language are you using? Version:

What operating system (Linux, Windows, ...) and version? Windows 10

What runtime / compiler are you using (e.g., python version or gcc version)

What did you do?

Clean architecture application with a specific data module build.gradle.kts file

import com.google.protobuf.gradle.protobuf
import com.google.protobuf.gradle.protoc
import com.google.protobuf.gradle.generateProtoTasks

apply {
    from("../config/quality.gradle")
}

plugins {
    id("module-plugin")
    id("com.google.protobuf")
}

dependencies {
    implementation(project(":domain"))
    implementation(project(":common"))

    implementation(Libs.Retrofit.RETROFIT)
    implementation(Libs.Retrofit.MOSHI_CONVERTER)
    implementation(Libs.Retrofit.SCALAR_CONVERTER)

    implementation(Libs.OkHttp.OKHTTP)
    debugImplementation(Libs.OkHttp.LOGGING_INTERCEPTOR)

    implementation(Libs.Moshi.MOSHI)
    implementation(Libs.Moshi.MOSHI_KOTLIN)
    implementation(Libs.Moshi.ADAPTERS)
    kapt(Libs.Moshi.CODEGEN)

    implementation(Libs.AndroidX.DataStore.PREFERENCES)
    implementation(Libs.ProtoBuf.PROTO_BUF)

    debugImplementation(Libs.Chucker.DEBUG)
    releaseImplementation(Libs.Chucker.RELEASE)
}

protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:4.0.0-rc-2"
    }

    // Generates the java Protobuf-lite code for the Protobufs in this project. See
    // https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
    // for more information.
    generateProtoTasks {
        all().forEach { task ->
            task.builtins {
                create("java") {
                    option("lite")
                }
            }
        }
    }
}

All that was doen was build the project but the build failed

What did you expect to see

Task :data:generateDebugProto to execute correctly without errors

What did you see instead?

Execution failed for task ':data:generateMockDebugProto'.

Expected configuration ':data:protobufToolsLocator_protoc' files to contain exactly one file, however, it contains no files.

deannagarcia commented 2 years ago

The most recent form of protobuf is actually 3.21.4. We made a mistake in releasing 4.0.0. If you use 3.21.4 instead, is this issue still there?

MaxMichel2 commented 2 years ago

Yes, I tried multiple versions including this one. I can however point out that with the Android Gradle Plugin version 7.0.2 (with Kotlin 1.5 or 1.6, I'm not 100% sure which version) the issue didn't arise

deannagarcia commented 2 years ago

The fact that it works with other versions of Android Gradle Plugin makes me think this might be a bug there, can you file an issue with them?

MaxMichel2 commented 2 years ago

Probably, I'll file one on their side! Thank you for your reply!