MoiraeSoftware / myriad

Myriad is a code generator for F#

Home Page:https://moiraesoftware.github.io/myriad/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add batching API so state can be passed amongst plugins of the same type

7sharp9 opened this issue · comments

A rough idea of the changes would be a batch option added to the plugin API, where a state is passed whenever the plugin is invoked, that way it would have access to a potential cache and other information like whether this is the first time the generator has been ran so it can create the assembly results AST for further plugins to use.

API would have a IsBatch that returns true and a property that exposes the state that that particular plugin can update, or potentially just add to the list of states so fan, unsure...

type state {
FirstRun: bool
Cache: KVP<string, obj> }

So the first run could be queried to see if a first run action might need to be run, like erasing some stuff or clearing a folder, what ever.

Or there could be a OnFirstRun() function that gets run, on the first run my the plugin host. Probably better to just defer to the plugin, it gets supplied a state, state gets updates on plugin completion, simple, firstRun always set to false when its returned, plugin wonders can add stuff to the cache that subsequent plugins can use that are in the same batch.

This might be useful for #145 or #146

I don't want plugins to get too complex so on second thoughts this is out of scope.