-
Notifications
You must be signed in to change notification settings - Fork 80
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
Request for a PostModifier start/end of life-cycle method #213
Comments
Thank you for reporting! Big 👍 from me. Would you be interested in contributing this feature? One question: how should the start/end methods work under --watch mode? You might be able to get some inspiration for how to implement this by looking at
|
Example: the
During
|
@olafurpg Ok, I will take a look at the links you show and see what I can come up with. In regards to the --watch flag I confess I did not think about this. I will have to give it some more though. But right now I think that the strategy I outlined above will won't work. The JavaFX platform cannot be started more than once per JVM. Will come back to you on this. |
One thing we can do it several callbacks for different events 🤔
|
I had to revisit the stuff I made in order to determine how to stop/start the JavaFX application and this can be used within MDoc. I have two sets of operations:
Seem to be working correctly. We have 2 different cases:
The problem here is how to support both scenarios at the same time. In case 1 I can start and stop both platform and application with a In case 2 I would have to :
The above steps lets us use MDoc with --watch (no need to restart between watches). It also subsumes case 1. So I would need 4 methods:
Don't know if a Is this ok? Can it be done with minor changes to the current code base ? TIA Side note: I am using MDoc as a Mill task. Mill has the |
@hmf thanks for the update. Feel free to add only the hooks that you need. We can add
The reason mdoc has its own --watch is to be able to reuse the compiler instance between compilations. The 2nd/3rd/... compilations are usually 10x faster than the 1st compilation. |
Hope I am not overstepping my bounds here but I have a use-case that I cannot get around and this request seems to be a good way to solve it. Any suggestion for an alternative workaround is welcome. Some background and context. I am using a
PostModifier
to process code fences that generate plots via a JavaScript library (in this case PlotlyJS). In order to generate static documents (PDF) via Laika I need to render and convert those plots into raster images (png, tiff, etc). To do this I need to instantiate a JavaFX application (with a WebKit component) that will execute the JS script and render the plots headless to files.So what is the problem? This process is executed as a Miil module (akin to an SBT plug-in) in a forked JVM. Because of the JavaFX application daemon thread, the spawned job will not terminate. In order to termnate this task I need to explicitly stop the headless javaFX application. However I can only do this when I know that MDoc has finished all processing. Hence the request to add such a method. Here I can place a call that stops the javaFX thread. Once no more files need processing, MDoc closes the
PostModifier
.So my question are: is this viable and acceptable? Are their mechanisms for me to do this shutdown without the need for such changes?
TIA
The text was updated successfully, but these errors were encountered: