rocker icon indicating copy to clipboard operation
rocker copied to clipboard

Warnings in Gradle Plugin (@Input annotation used on property of type 'File')

Open GBuervenich opened this issue 5 years ago • 2 comments

When using the Gradle plugin in a build, --warning-mode all yields the following warning concerning class RockerConfiguration:

Property 'rockerProjectConfig.classBaseDirectory' has @Input annotation used on property of type 'File'. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0. See https://docs.gradle.org/6.5/userguide/more_about_tasks.html#sec:up_to_date_checks for more details.

As I understand it, if the current behaviour (i.e. the up-to-date check only considers the path but not the contents of the directory) is to stay unchanged, there needs to be second method (marked with @Input) that returns the directory's path only. The existing method getClassBaseDirectory can then be declared as internal. From the documentation on annotation InputDirectory:

This will cause the task to be considered out-of-date when the directory location or contents have changed.

Note: To make the task dependent on the directory's location but not its contents, expose the path of the directory as an Input property instead.

Is there any reason against these changes?

GBuervenich avatar Sep 11 '20 12:09 GBuervenich

That issue blocks migration to Gradle 7.0

vitaliit avatar Apr 16 '21 14:04 vitaliit

This also blocks the migration of our integration with Rocker in Micronaut to Gradle 7.

ilopmar avatar May 06 '21 09:05 ilopmar

Were there any further updates on this? Looks like the build is failing because of this.

runtime: java11 metadata: {} architecture: arm64 functions: InvoiceTemplateFunction
Running JavaGradleWorkflow:GradleBuild

Build Failed
Error: JavaGradleWorkflow:GradleBuild - Gradle Failed: FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':generateRockerTemplateSource' (type 'RockerTask').
  - In plugin 'com.fizzed.rocker' type 'com.fizzed.rocker.gradle.RockerTask' property 'rockerProjectConfig.classBaseDirectory' has @Input annotation used on property of type 'File'.
    
    Reason: A property of type 'File' annotated with @Input cannot determine how to interpret the file.
    
    Possible solutions:
      1. Annotate with @InputFile for regular files.
      2. Annotate with @InputDirectory for directories.
      3. If you want to track the path, return File.absolutePath as a String and keep @Input.
    
    Please refer to https://docs.gradle.org/7.1/userguide/validation_problems.html#incorrect_use_of_input_annotation for more details about this problem.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

SATHYASAGAR avatar Feb 06 '23 21:02 SATHYASAGAR

@jjlauer Any update on this? Would it be possible to merge the PR? Thank you very much

GBuervenich avatar Jul 24 '23 12:07 GBuervenich

@jjlauer Thanks for releasing the support to Java17. Would that be possible to merge that PR above and enable the migration to Gradle 7. I'm updating a project to Gradle 7.3 (which requires Java17) but unfortunately I cannot use your plugin for the error mentioned above. Thanks again.

antoniopi avatar Oct 11 '23 09:10 antoniopi

When will another release take place? We're trying to select a templating engine for Micronaut and this is a blocker for the selection process.

KangoV avatar Feb 24 '24 13:02 KangoV