-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The plugin does not detect proto file was changed when running build for a second time #331
Comments
This was for PR grpc/grpc-java#6099. It used pull/6099/merge:pull_branch ref to pull. Looks like the first build was |
A gradle plugin [issue](google/protobuf-gradle-plugin#331) was seen for #6099. This PR try to workaround it.
The issue is because proto files in the first build contains some proto messages that the proto files with the same filenames in the second build do not have. Since message types are generated in separate java files, when you switch to to the second build without a clean, generated java files for messages that only exist in the first build are not deleted, while they still have dependencies on other messages whose re-generated java files are modified, so compiling those "should-have-been-deleted" java files results in symbol not found error. This only occurs for cases that the first build contains some messages that the second build does not have. Build systems only add/replace output files if necessary but do not delete things from previous build. This is normal. Gradle compiles all the source files in the SourceSet, this is also reasonable for how it works. I believe it should be the application's responsibility to ensure output directory does not contain unwanted files before each build. grpc/grpc-java#6103 is doing the correct thing and it's not just a workaround. |
In general, Gradle notices when files have been deleted and recompiles. There's basically no change that is "the application's responsibility". |
Filed #332, which should be done first before we can make changes to always wipe out generated file directories. |
I've ran across this just now (after a large update to our proto files). IMO, this should be the responsibility of the plugin. Hopefully anybody else in this situation can use a workaround like this for now:
|
Is this still an issue? I couldn't reproduce, although maybe I'm missing a step here. |
I suspect this still happens. Basically files can be left over from a previous compilation, so if you delete a message in the .proto you might get strange results. |
Duplicate of #33 |
Use the gradle plugin to generate code, then change the proto file, then build again.
As reproduced in https://sponge.corp.google.com/target?id=ff244382-5595-48fd-b556-4b2694aaf5d4&target=grpc%2Fjava%2Fmaster%2Fpresubmit%2Fandroid&searchFor=
The text was updated successfully, but these errors were encountered: