square / wire

gRPC and protocol buffers for Android, Kotlin, Swift and Java.
https://square.github.io/wire/
Apache License 2.0
4.23k stars 572 forks source link

Wire adds generated sources to the sourceset two too many times #2950

Closed staktrace closed 1 month ago

staktrace commented 3 months ago

Running gradle kotlinSourcesJar on a simple wire project with a single proto file produces gradle warnings that look like this:

> Task :kotlinSourcesJar
file '/Users/kartikaya/zspace/wire-bugs/20240517-triplicate-sourcejar/build/generated/source/wire/com/squareup/geology/Period.kt' will be copied to 'main/com/squareup/geology/Period.kt', overwriting file '/Users/kartikaya/zspace/wire-bugs/20240517-triplicate-sourcejar/build/generated/source/wire/com/squareup/geology/Period.kt', which has already been copied there.
file '/Users/kartikaya/zspace/wire-bugs/20240517-triplicate-sourcejar/build/generated/source/wire/com/squareup/geology/Period.kt' will be copied to 'main/com/squareup/geology/Period.kt', overwriting file '/Users/kartikaya/zspace/wire-bugs/20240517-triplicate-sourcejar/build/generated/source/wire/com/squareup/geology/Period.kt', which has already been copied there.

and then the generated sources jar file has 3 copies of each generated source file, which is 2 copies more than it should have. I have added a test case that demonstrates the problem in https://github.com/square/wire/pull/2949

staktrace commented 1 month ago

This is fixed now with #2949 . thanks!