Use post-processing approach for test report formatting to support Gradle 9#891
Conversation
Generate changelog in
|
✅ Successfully generated changelog entry!Need to regenerate?Simply interact with the changelog bot comment again to regenerate these entries. 🔄 Changelog entries were re-generated at Mon, 26 Jan 2026 14:20:19 UTC!📋Changelog Preview💡 Improvements
|
|
|
||
| // Match <pre> tags within stdout/stderr sections: <h2>standard output</h2>...<pre>...</pre> | ||
| private static final Pattern OUTPUT_SECTION_PATTERN = Pattern.compile( | ||
| "(<h2>standard (?:output|error)</h2>\\s*<span[^>]*>\\s*<pre[^>]*>)(.*?)(</pre>)", |
There was a problem hiding this comment.
one thing to note is whether or not this regex is greedy, which I think you want
There was a problem hiding this comment.
I think the current is correct no? The .*? is non-greedy, which is correct here. It stops at the first </pre> after each opening tag, so multiple stdout/stderr sections are matched individually rather than being consumed as one giant match
|
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.