-
Notifications
You must be signed in to change notification settings - Fork 4
Use post-processing approach for test report formatting to support Gradle 9 #891
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
base: develop
Are you sure you want to change the base?
Conversation
Generate changelog in
|
|
|
||
| class TestReportFormattingPluginIntegrationSpec extends IntegrationSpec { | ||
| private static final List<String> GRADLE_VERSIONS = ["7.6.4", "8.8", GradleVersion.current().getVersion()] | ||
| private static final List<String> GRADLE_VERSIONS = ["8.8", GradleVersion.current().getVersion(), "9.3.0"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will disappear when the migration happens. We shoudl probably add a note to the excavator to be like if it is sees this, it should add to the test-versions.yml file
| new LogParser<>(TestLogFilter.INSTANCE.combineWith(LogFormatter.INSTANCE, (include, formatted) -> | ||
| include ? Optional.of(formatted) : Optional.empty())); | ||
|
|
||
| private static final Pattern PRE_PATTERN = Pattern.compile("(<pre[^>]*>)(.*?)(</pre>)", Pattern.DOTALL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would want you to find the stdout/stderr section, this feels like too big a capture group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to Match <pre> tags within stdout/stderr sections: <h2>standard output</h2>...<pre>...</pre>
If we think this is a sensible route to go I'll tidy up and migrate the tests etc
Before this PR
The
TestReportFormattingPluginrelied on internal Gradle APIs (HtmlTestReport,TestReporter, etc.) using reflection to intercept and format test report output. This approach broke frequently across Gradle versions, requiring version-specific reflection hacks for 8.8, 8.11, and now completelybreaking in 9.3.0 where
org/gradle/api/internal/tasks/testing/report/HtmlTestReportwas removed entirely.After this PR
Replaces the reflection-heavy internal API approach with a simple post-processing strategy. The plugin now uses
FlowScope.always()to run after test tasks complete, walking the generated HTML report directory and reformatting witchcraft log JSON lines in-place. This approach works across all Gradle 8.1+versions including 9.x without version-specific code
==COMMIT_MSG==
Use post-processing approach for test report formatting to support Gradle 9
==COMMIT_MSG==
Possible downsides?
Drops Gradle 7 support. The post-processing happens after test execution completes rather than during report generation, but the end result is equivalent.