bito-code-review[bot] commented on PR #15327:
URL: https://github.com/apache/grails-core/pull/15327#issuecomment-4237075297
<!-- Bito Reply -->
You're right that patching generated docs is a workaround; ideally, we'd fix
the source Groovydoc generation to avoid bad links. To change this to an audit
task that fails the build on bad links, add an audit mode to the task that
throws an exception instead of fixing. This allows CI to catch issues early.
**build-logic/docs-core/src/main/groovy/org/grails/doc/gradle/FixGroovydocLinksTask.groovy**
```
abstract class FixGroovydocLinksTask extends DefaultTask {
@InputDirectory
abstract DirectoryProperty getApiDocsDir()
// Add audit property
boolean audit = false
@TaskAction
void fixLinks() {
// ... existing code ...
if (audit && changed) {
throw new GradleException("Bad links found in Groovydoc; fix
source generation.")
}
// ... rest ...
}
}
```
**grails-doc/build.gradle**
```
def fixGroovydocLinks = tasks.register('fixGroovydocLinks',
FixGroovydocLinksTask) {
dependsOn combinedGroovydoc
apiDocsDir = combinedGroovydoc.get().destinationDir
audit = true // Enable audit mode for CI
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]