jmix-projects / jmix-ui

DEPRECATED. Use https://github.com/jmix-framework/jmix
https://www.jmix.io
3 stars 7 forks source link

Task compileWidgets is executed with no changes in project #722

Closed alexbudarov closed 2 years ago

alexbudarov commented 3 years ago

Jmix 1.1.0. Project: https://github.com/jmix-projects/sample-sales-jmix/tree/security-advanced-facebook-complete

Sometimes (not always)when you run Jmix application in Studio with no changes in the project, Gradle executes compileWidgets task.

Because of that, application is launched for 1 minute every time.

Also I see this message in Gradle console:

> Task :compileWidgets
> Task :processResources
Execution optimizations have been disabled for task ':processResources' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: '/home/alexander/projects/jmix-samples/sample-sales-jmix/build/resources/main'. Reason: Task ':compileWidgets' uses this output of task ':processResources' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency for more details about this problem.

Is it problem with project or with task?

glebfox commented 2 years ago

Since a Jmix app is a single module app, SkipUpToDateStep checks every source file in a project even if it's not related to Widgetset. To see the actual changes that trigger re-compile, the --info param can be used in the Terminal, e.g.: ./gradlew assemble --info.

In https://github.com/Haulmont/jmix-gradle-plugin/issues/8 the excludePaths param for the compileWidgets task has been introduced. So, in the simple case, when you only need to use some add-on with widgetset, the compileWidgetstask may look as follows:

compileWidgets {
    generate 'com.company.demo.widgets.CustomWidgetSet'
    excludePaths('**/com/company/demo/**')
}

In the next Jmix Gradle plugin release, the includePaths param will be introduced (see https://github.com/Haulmont/jmix-gradle-plugin/issues/30).