google/protobuf-gradle-plugin

Codegen plugins from system search path no longer work

ateirney opened this issue · 5 comments

After upgrading from 0.8.19 to 0.9.X I was no longer able to use codegen plugins that should be located using the system path.

The error that was given was the following.

ExecutableLocator with name 'bq-schema' not found.

The system search path is not working for me either. I got this error:

 Caused by: org.gradle.api.GradleException: protoc: stdout: . stderr: protoc-gen-grpc: program not found or is not executable
    --grpc_out: protoc-gen-grpc: Plugin failed with status code 1.

looking at the command generated it seems not correct: --plugin=protoc-gen-grpc=protoc-gen-grpc,

reproduction using direct protoc call:

$ protoc --grpc_out=/tmp --plugin=protoc-gen-grpc=protoc-gen-grpc src/grpc/proto/io/grpc/testing/integration/empty.proto
protoc-gen-grpc: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.

The error in #699 (comment) is gone when the the plugin executable is in the current build directory! But if the plugin in the system search PATH, it fails with program not found or is not executable.

@andrew-teirney could you show your configuration and more detailed gradle build error? I can't reproduce your error.

I have just created a sample project that I believe reproduces my error.

https://github.com/ateirney/google-protobuf-issue.git is the repository with the replication of the issue.

If I attempt to add an executable locator using the below construct I get the error you encountered above. Historically I have not had to provide an executable locator.

protobuf {
    ...
    plugins {
        id("bq-schema") {
        }
    }
    ...
}

Further to the above, in an older version of the plugin (specifically 0.8.2) without providing an executable locator the following would be emitted.

protoc plugin 'bq-schema' not defined. Trying to use 'protoc-gen-bq-schema' from system path

Thank you @ateirney, I can also reproduce and verify your fix.