Javier92
Javier92

Reputation: 813

Gradle tooling api get task outputs

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 :)

Upvotes: 3

Views: 599

Answers (2)

gamerson
gamerson

Reputation: 5310

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

Upvotes: 1

Jason
Jason

Reputation: 46

If my understanding is correct, currently Gradle tooling API doesn't support HTML-like reports. There reports should be implemented by the tasks you are using in your build.

For example, for Android testing tasks(task for unit and cAT for UI automation testing), you can find the HTML testing result in [your project path]/app/build/reports.

Upvotes: 0

Related Questions