intellij-platform-gradle-plugin icon indicating copy to clipboard operation
intellij-platform-gradle-plugin copied to clipboard

Update task inputs/outputs to use Gradle filesystem types, not strings

Open aSemy opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe.

Related to

  • #1114
  • #1103

Several places in code use strings to define the locations of files and directories

  • https://github.com/JetBrains/gradle-intellij-plugin/blob/f5b07b4c210752ee10cc8ce89fe4671d9c719f59/src/main/kotlin/org/jetbrains/intellij/tasks/ListProductsReleasesTask.kt#L29-L31

This makes converting strings to files, and linking task inputs and outputs more difficult.

  • https://github.com/JetBrains/gradle-intellij-plugin/blob/f5b07b4c210752ee10cc8ce89fe4671d9c719f59/src/main/kotlin/org/jetbrains/intellij/IntelliJPlugin.kt#L809-L811
  • https://github.com/JetBrains/gradle-intellij-plugin/blob/f5b07b4c210752ee10cc8ce89fe4671d9c719f59/src/main/kotlin/org/jetbrains/intellij/IntelliJPlugin.kt#L945-L947

I also suspect that that Gradle won't be able to inspect task inputs and outputs more effectively. This will cause issues with

Describe the solution you'd like

  • https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:task_input_output_annotations
  • https://docs.gradle.org/current/userguide/lazy_configuration.html#working_with_task_dependencies_in_lazy_properties

The Gradle Provider API has file-based properties, 'filesystem types', that can be used instead.

https://docs.gradle.org/current/userguide/lazy_configuration.html#property_files_api_reference

The properties should be annotated correctly https://docs.gradle.org/current/userguide/more_about_tasks.html#table:incremental_build_annotations

This might result in API changes, which can be mitigated by providing overloaded functions or properties that will still allow the user to enter strings, but under the hood the task will convert the string to a file or directory, and add it to a registered input: https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:add_cached_input_output_methods

aSemy avatar Sep 30 '22 10:09 aSemy