google / protobuf-gradle-plugin

Protobuf Plugin for Gradle
Other
1.77k stars 273 forks source link

Circular dependency error on multi-project builds with same project names #330

Open Archengius opened 5 years ago

Archengius commented 5 years ago

Imagine a project with the following graph:

Root:
  - ServiceAPIs:
      - Example - API of Example service
         - protobuf definition files here
  - Services:
      - Example - service API implementation
          - compile dependency on :ServiceAPIs:Example

When building :Services:Example project with protobuf-gradle, gradle reports circular dependency. Example circular dependency graph as reported by gradle:

Circular dependency between the following tasks:
:Services:Example:classes
\--- :Services:Example:compileJava
     +--- :Services:Example:compileKotlin
     |    +--- :Services:Example:generateProto
     |    |    \--- :Services:Example:extractIncludeProto
     |    |         \--- :Services:Example:jar
     |    |              +--- :Services:Example:classes (*)
     |    |              +--- :Services:Example:compileKotlin (*)
     |    |              \--- :Services:Example:inspectClassesForKotlinIC
     |    |                   \--- :Services:Example:classes (*)
     |    \--- :Services:Example:jar (*)
     +--- :Services:Example:generateProto (*)
     \--- :Services:Example:jar (*)
zhangkun83 commented 5 years ago

Not sure why :Services:Example:extractIncludeProto depends on :Services:Example:jar. Since you mentioned "with same project names", do you mean you won't have the error if you renamed one of the two Examples to a different name?

Archengius commented 5 years ago

that's true, renaming one of the project from Example to some other name fixes issue. I have no idea about jar dependency either, it's not declared anywhere. I can provide full project where it can be reproduced if needed

Archengius commented 5 years ago

looks like i closed it accidentally when commenting, oops