Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle tooling api get task outputs

Tags:

gradle

tooling

I've managed to get some project's task list thanks to the Gradle tooling API GradleProject.getTasks(). It's kinda cool, I can read task's name, description, group and whether it's public or not.

I was wondering if it was possible to get tasks outputs directory, especially for tests or code coverage stuff, the kind of tasks that produce HTML-like reports. It would be nice to display these reports in a web UI.

Does anyone know if this is possible, or at least planned to be added in a future release of the tooling API ?

Thanks alot :)

like image 674
Javier92 Avatar asked May 29 '26 16:05

Javier92


1 Answers

In order to get additional information about tasks like the TaskOutputs from tooling api you, would have to implement a tooling API plugin like this:

https://github.com/bmuschko/tooling-api-custom-model

See here: https://github.com/bmuschko/tooling-api-custom-model/blob/master/plugin/src/main/java/org/gradle/sample/plugins/toolingapi/custom/ToolingApiCustomModelPlugin.java#L31-L39. This method is where you can collect the information you are interested it and surface that in your "model" class.

I have successfully done this for one of the projects I work on: https://github.com/liferay/liferay-blade-cli/tree/master/gradle-tooling/src/main/java/com/liferay/blade/gradle/tooling

like image 165
gamerson Avatar answered Jun 01 '26 17:06

gamerson