vaadin/vaadin-gradle-plugin

Circular task dependency with additional Gradle source set

Closed this issue · 4 comments

Desktop:

  • OS: Windows 10
  • JDK version: 13.0.1
  • Gradle version: 6.1.1
  • Vaadin Plugin version: 0.5.0

Describe the bug
Adding an additional Gradle source set and configuring it to depend on the main source set's output, causes a circular dependency when trying to execute the vaadinBuildFrontend task.

To Reproduce
I forked one of the example repositories and extended it with an examplary configuration for an additional source set. Here's the link: https://github.com/martingr/base-starter-gradle

Steps to reproduce the behavior:

  1. Clone the forked project
  2. Run Gradle task vaadinBuildFrontend

Expected behavior
Expected the vaadinBuildFrontend task to run without an exception.

Additional context
We use the additional source set to keep our main sources separated from our Guice sources/configuration.

Here's the Gradle output:

cd C:\src\base-starter-gradle; ./gradlew vaadinBuildFrontend

FAILURE: Build failed with an exception.

* What went wrong:
Circular dependency between the following tasks:
:classes
\--- :processResources
     \--- :vaadinBuildFrontend
          \--- :compileGuiceConfigJava
               \--- :classes (*)

(*) - details omitted (listed previously)

Does this plugin evaluate the project's source sets in some way? Can the behavior of the plugin be adjusted in this regard? I cannot come up with a workaround for this.

I quickly skimmed the source code and have a hunch that this part is the problem:

https://github.com/vaadin/vaadin-gradle-plugin/blob/master/src/main/kotlin/com/vaadin/gradle/VaadinBuildFrontendTask.kt#L53-L62

Any insights @mvysny ?

I think the cleanest fix would be to modify the plugin to run after classes and processResources, but then we need to figure out how to add generated webpack bundle to the target artifact...

The idea has been implemented in PR #44

Fixed in 8d38236