play-services-plugins icon indicating copy to clipboard operation
play-services-plugins copied to clipboard

Correct task property annotations and some other miscellaneous fixes

Open lptr opened this issue 6 years ago • 1 comments

Starting with version 6.0 Gradle will show deprecation warnings for tasks with incorrect annotations. The licenses plugin has a number of these, and in this PR I'm attempting to fix them. I also made some other changes:

  • upgraded to Gradle 5.6.4 and enabled checks that will fail if task annotations are incorrectly defined
  • turned task fields into Groovy properties, as annotations on fields are not supported in Gradle 6.0+
  • removed the OssLicensesCleanupTask as it's not required: clean should already remove the whole build directory automatically
  • no need to pass the outputDir to each task as Gradle takes care of creating parent directories for @OutputFile properties automatically
  • made LicensesTask cacheable by default, and added the @PathSensitive annotation for its input file
  • removed manually recorded inputs and outputs as they are already tracked via task property annotations

There is still the question of DependencyTask.configurations – this is essentially consuming the whole configuration container as input. This is probably not what is intended, but I left it as is. Someone with better understanding of the intention here should capture the inputs and perhaps make the task cacheable if possible in a separate PR.

There are some other things that could also be improved about the plugin in further PRs:

  • use lazy task registration (instead of project.tasks.create() use project.tasks.register())
  • use RegularFileProperty types for the task properties, so they can be connected to each other without having to manually specify dependsOn() relationships.

lptr avatar Nov 08 '19 17:11 lptr

Any update on this?

filipwiech avatar Dec 17 '19 21:12 filipwiech