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

Introduce tasks report that renders task dependencies as tree #980

Open
bmuschko opened this issue Dec 7, 2016 · 11 comments
Open

Introduce tasks report that renders task dependencies as tree #980

bmuschko opened this issue Dec 7, 2016 · 11 comments
Labels
a:feature A new functionality in:reporting-tasks help dependencyInsight dependencies in:scheduler execution plan, task graph, work lease, project lock

Comments

@bmuschko
Copy link
Contributor

bmuschko commented Dec 7, 2016

As a user, I want to know all the tasks that are available, but instead of a flat list, I want to know how they depend on one another. Even better: tell me why.

Expected Behavior

I propose perhaps a flag for the gradle tasks command like --tree or --dependencies that prints the report suggested above. I strongly feel that this ought to be baked in.

A user can render tasks and their task dependencies as a tree. It would be helpful to have a filter option that allows for rendering task dependencies for just a single task or a collection of tasks. The new report will likely expose poor performance for large projects if all tasks are rendered at once as the whole task graph needs to be walked.

Current Behavior

The existing tasks report does not render task dependencies at all.

Context

This a very popular plugin https://github.com/dorongold/gradle-task-tree, and we've gotten a lot of feedback from folks that suggest this should be built-in

The end user can discover task dependencies and make an educated decision on whether to run a task or not.

@bmuschko bmuschko added a:feature A new functionality from:member labels Dec 7, 2016
@bmuschko bmuschko added this to the 4.0 milestone Dec 7, 2016
@eriwen eriwen modified the milestones: 4.0 RC1, 4.0 Dec 22, 2016
@Reager-
Copy link

Reager- commented Jan 11, 2017

Would be great also to integrate this with the build scan tool when using -Dscan and visualize the tree with something like this http://bl.ocks.org/d3noob/8375092

@eriwen eriwen removed this from the 4.0 RC1 milestone Feb 3, 2017
@marvertin
Copy link

It is very missing.

@ldaley
Copy link
Member

ldaley commented Dec 11, 2017

Would be great also to integrate this with the build scan too

This is something that is on our radar for build scans.

@lptr
Copy link
Member

lptr commented Apr 8, 2018

Instead of a task hierarchy, what I usually find asking is "why did task X get triggered when I asked for task Y". In a project where there are lots of tasks, it might be more useful to address this use case instead of printing a huge tree.

@kno10
Copy link

kno10 commented Oct 28, 2018

Yes, when debugging unnecessary task executions (to speed up incremental build), what you really are interested in is "why does gradle think we need to rerun this task". The task tree is useful for this, but still requires manually checking which of the prerequisites get executed.

For those struggling with the same problem: --debug is helpful. In my case, it contained the message

Task ':X:javadoc' is not up-to-date because:
  Value of input property 'options.footer' has changed for task ':X:javadoc'

because the footer was set to contain the build time... the solution then was to add to javadoc {}:

inputs.property("options.footer","") // Ignore

to not use the footer for change detection, and afterwards it would stop being rebuilt every time. It will still use the other mechanisms - so a change to a java file should cause the javadoc to be rebuilt.

As you can see in this example, it is not always a task that is causing a rebuild. Any time (or commit) dependent option can be causing extra rebuilds, and logging with --debug is likely the way to go for debugging this.

@simtel12
Copy link
Contributor

I think that the original request is still valid.

We have a scenario where built artifacts get stored after a CI build. They're then pulled out of a number of other jobs that want to run tests with those artifacts (androidTest suites). We want to run a subset of those test suites without having to re-run the entire task hierarchy - because the intermediates were not stored, and so the build will be considered "out of date".

At the moment there is no good [built-in] way to discover the dependencies of the test task.

@gavenkoa
Copy link

--dry-run (or short -m) is the only way to debug task dependencies.

@IARI
Copy link

IARI commented May 13, 2020

Are there any plans/updates regarding this?

@sky-ruimartins
Copy link

Long standing required feature.

@BenderRodrigez
Copy link

When you are working in a large project with multiple sub-projects and sometimes not very clean dependencies, it is really devastating to not have any tool to determine and cleanup tasks execution tree. --dry-run does not provide any valuable information about references, only the set of tasks to execute.

Thank you for the link to plugin!

@sschuberth
Copy link
Contributor

Another plugin I can recommend until this is implemented upstream is https://gitlab.com/barfuin/gradle-taskinfo.

@jbartok jbartok added in:scheduler execution plan, task graph, work lease, project lock in:reporting-tasks help dependencyInsight dependencies and removed in:core labels Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:reporting-tasks help dependencyInsight dependencies in:scheduler execution plan, task graph, work lease, project lock
Projects
None yet
Development

No branches or pull requests