Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct task property annotations and some other miscellaneous fixes #111

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

lptr
Copy link

@lptr lptr commented Nov 8, 2019

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.

Such a task should not be needed as `clean` already removes `project.buildDir`.
There's also auto-generated `clean*` tasks that allow cleaning up the ouptut of specific tasks.
This is not needed as Gradle will auto-create parent directories for output files.
This is not needed as Gradle will auto-create parent directories for output files.
These are already captured via the annotations on the task's properties.
So that future violations will break the build.
@filipwiech
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants