buildship icon indicating copy to clipboard operation
buildship copied to clipboard

Wrong synchronizationTasks/autoBuildTasks called on composite builds

Open nostradani opened this issue 4 years ago • 1 comments

We use a workspace that imports several projects that are all based on a common library. The library is imported as composite build in each project and contains tasks that generate source code (e.g. from proto files). Those code generation tasks create packages and classes and they are added to the main source set. The tasks are added as dependencies to the respective gradle build tasks but also to the eclipse synchronizationTasks and autoBuildTasks in order to ensure that the eclipse project is generated correctly. However the tasks don't get called on "Gradle Refresh" in Eclipse.

Expected Behavior

When executing "Gradle -> Refresh Gradle project" on "Library", the generated code/files should appear in the eclipse project

Current Behavior

Other gradle tasks get executed. To be more precise, the synchronizationTasks of one of the projects using "Library" gets called.

Context

When freshly checking out the projects and adding them to a new workspace, usually it will fail to build. The single projects and "Library" get added correctly to the workspace, but since the generated files are still missing, our build would fail. You would have to execute the gradle tasks manually from the command line.

Steps to Reproduce

  • Create a java library gradle project with some dummy code
  • Create a java executable gradle project named "Demo" that uses the aforementioned library as dependency
  • Add the library as composite build using "includeBuild" in settings.gradle
  • Add a task to the libraries build.gradle that prints "This is the right task" and add it to the eclipse synchronizationTasks
  • Add a task to the java executable project that prints "This is the wrong task" and add it to the eclipse synchronizationTasks
  • Import the "Demo" project into your eclipse workspace. "Demo" and "Library" should show up
  • Execute "Gradle -> Refresh Gradle project" on "Library" and check the "Gradle Operations" console output.
  • You will find the output "This is the wrong task" clearly originated from the "Demo" project.

Your Environment

  • Eclipse 2020-09
  • Gradle 6.5
  • MacOS 11.0.1 Big Sur

nostradani avatar Nov 19 '20 23:11 nostradani