Hi all,
I’ve been researching this question for the last couple of days, but I have not found a good answer:
Is there a way for gradle to output a format that is suitable for machine parsing?
For example, there is a oh-my-zsh plugin for task autocompletion that parses the task list ./gradlew tasks
, but it doesn’t always do a very good job. I tried to solve it with this pull request: https://github.com/robbyrussell/oh-my-zsh/pull/5230 but the patch relies on assuming the format of the ouput is the same on all versions of gradle, as well as it not changing in the future.
It would be better if gradle had an output mode similar to git’s porcelain mode. Does it?
Furthermore, the zsh script only ever regenerates the task autocomplete list if the top level build.gradle file changes, but changes in build.gradle files in subprojects could also trigger changes to the tasks list. It would be nice if it was possible to query the “newest last modified date of any gradle file in any subproject including the root project”, alternatively a checksum of some sort.
So my TL;DR questions are:
- Is there a porcelain-like mode for gradle output (specifically for task listing)
- Is there a way of asking gradle the date of the last changed build.gradle/settings.gradle file, or a checksum?
And maybe most importantly: - Would it be possible for gradle to implement task autocompletion internally, so that the zsh plugin could be deprecated?
Best Regards