-
Notifications
You must be signed in to change notification settings - Fork 120
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
Option to fail on warning #154
Comments
+1 |
@mojavelinux @lordofthejars : we would need asciidoctor to bubble up the waring through asciidoctorj so that the plugin can configure it. Does asciidoctor (ruby) have a message/logger handler already? perhaps we just need to expose it through asciidoctorj |
We should actually have this as an option in asciidoctor itself, so that asciidoctorj (and such the plugin) can just set it. The failure will then be handled automatically in the same way that it is handled by the plugin today. |
This is already planned in Asciidoctor core. We shouldn't try to patch a solution until we get it solved there. Then it becomes a simple matter of reading the message stack and failing if it contains violations. See asciidoctor/asciidoctor#44. |
This issue should be marked as "tracking". I like to have to label in the issue tracker for this reason. |
I have an intermediate workaround for this problem: Add a stdout listener on the asciidoctor task, and check for "WARNING", or in my case, for missing include files. Not something to be put into this plugin, actually, but I'll add it here so people can bridge the gap until this feature is supported.
|
Very good. This is exactly how this should be solved in the interim. I agree that putting it into the plugin or in AsciidoctorJ is too risky. But putting it in the build configuration is both safe and transparent. Perhaps we can add this to one of the examples in asciidoctor-gradle-examples. |
courtesy of Kimble at stackoverflow, btw. http://stackoverflow.com/questions/31523166/gradle-capturing-output-written-to-out-err-on-a-per-task-basis There seems to be an issue with parallel task execution mentioned there, which I haven't tried to reproduce, as I'm not executing asciidoctor tasks in parallel. |
For reference, @fap- solved this for our build via vogellacompany/com.vogella.gradle.plugins@7a286f7 |
Now that we have the LogHandler in AsciidoctorJ (1.5.7, 1.6.0-alpha.7) we can probably deal with this. I'll look to see if I can add this to 2.0.x development. |
- Proper logging using Log4J has been implemented for workers. - Logging for JavaExec goes to stdout which is then picked up via the JavaExec process. - The `asciidoctorj` extension can be configured to recognise certain messages as fatal errors via the `fatalWarnings` methods. - `missingIncludes` is a helper method that can be passed to the `setFatalWarnings` or `fatalWarnings` methods for the common use case of missing includes.
The code for this will be merged from PR #251 and be available in 2.0-alpha.3 To cover the exact case of this issue the global or task exteniosn can be configured as asciidoctorj {
fatalWarnings missingIncludes()
} More generically any pattern can be supplied, for instance asciidoctorj {
fatalWarnings ~/include file not found|missing callout/
} |
- Proper logging using Log4J has been implemented for workers. - Logging for JavaExec goes to stdout which is then picked up via the JavaExec process. - The `asciidoctorj` extension can be configured to recognise certain messages as fatal errors via the `fatalWarnings` methods. - `missingIncludes` is a helper method that can be passed to the `setFatalWarnings` or `fatalWarnings` methods for the common use case of missing includes.
- Proper logging using Log4J has been implemented for workers. - Logging for JavaExec goes to stdout which is then picked up via the JavaExec process. - The `asciidoctorj` extension can be configured to recognise certain messages as fatal errors via the `fatalWarnings` methods. - `missingIncludes` is a helper method that can be passed to the `setFatalWarnings` or `fatalWarnings` methods for the common use case of missing includes.
Kotlin: tasks {
asciidoctor {
asciidoctorj {
fatalWarnings(listOf(missingIncludes()))
}
}
} |
I'd like to fail the build when AsciiDoctor issues a warning. To reproduce, process a document with an include directive for a non-existent file, like:
include::doesNotExist.txt[]
The text was updated successfully, but these errors were encountered: