statiqdev / Statiq.Framework

A flexible and extensible static content generation framework for .NET.
https://statiq.dev/framework
MIT License
421 stars 74 forks source link

Need a way to define pipelines with dependencies on post-process or output phases #237

Open daveaglick opened 2 years ago

daveaglick commented 2 years ago

Basically we need deployment pipelines, but for processing stuff so they always still come before deployment. Use case is something like a pipeline that processes the final HTML as rendered by Razor from other modules post-process phase and then writes an extra file to disk as a result. This needs to be able to 1) run after other modules like content have completed their post-process phase 2) read the output documents from the post-process phase (non-deployment pipelines are only allowed to read output documents from their own previous phases and other pipeline process phases) 3) run before other deployment pipelines since it's not really a deployment pipeline in spirit

One thought was that to accomplish this today in an extensible generic way would be to register the pipeline as a deployment pipeline, then later (in an event or something) crawl through all registered pipelines in the engine and set DependencyOf in the pipeline in question to all the other dependency pipelines. That would grant it dependency pipeline functionality like 1) and 2) above while making all other dependency pipelines dependent on it to satisfy 3) above. Except I don't actually think that would work because the dependency chains are all about the process phase and still wouldn't prevent other deployment pipelines from executing their output phase before this one got a chance to write files in its own output phase.

A new mechanism might be needed here, or perhaps some changes to how dependencies work.

cc @phil-scott-78