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

Print failure report to console #18

Open
Egorand opened this issue Apr 25, 2018 · 1 comment
Open

Print failure report to console #18

Egorand opened this issue Apr 25, 2018 · 1 comment

Comments

@Egorand
Copy link

Egorand commented Apr 25, 2018

I was looking for a way to configure the plugin to output the failure report into the console, that'd be very helpful on CI. Currently I'd just do:

after_failure:
  - cat build/reports/japi.txt

but this would obviously print the report even if the failure wasn't caused by Japicmp. Would be great to be able to enable this with a plugin config option.

@simonbasle
Copy link
Contributor

simonbasle commented Mar 29, 2022

@melix I'm coming across a similar need. My previous way of doing this was to actually print out the content of the TextReport on console using a task listener:

gradle.taskGraph.afterTask { task, state ->
	if (task instanceof JapicmpTask && state.failure && ((JapicmpTask) task).richReport == null) {
		//FIXME print the rich report somehow on console ?
		print file("${project.buildDir}/reports/japi.txt").getText()
	}
}

The trouble is that afterTask is now deprecated and will be removed in Gradle 8.
The other drawback of this approach is that if any other type of report is configured, including the rich report, the textReport is suppressed. When I was experimenting with custom rules and filters, this would effectively prevent the console output (since the rich report is not fit for console display, being HTML).

What do you think about adding a boolean parameter that would add the equivalent of the textReport to the end of the exception message (after the See failure report at _URL_ bit)?

I have a prototype, which uses StdoutOutputGenerator to add a textual report after the "See failure report at" line

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

No branches or pull requests

2 participants