-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Codegen Common Plugin Properties
Jenny plugins are implemented as classes that implement at least one of the following interfaces (all of which are available in DesperateDevs.CodeGeneration
):
These interfaces all extend the ICodeGenerationPlugin
interface, which means that all plugins effectively implement it.
Most likely, plugins will also implement one or both of:
-
IConfigurable (available in
DesperateDevs.Serialization
) -
ICachable (available in
DesperateDevs.CodeGeneration
)
All of the interfaces previously listed except for IConfigurable
and ICachable
implement ICodeGenerationPlugin
, which is declared like so:
using System;
namespace DesperateDevs.CodeGeneration
{
public interface ICodeGenerationPlugin
{
string name { get; }
int priority { get; }
bool runInDryMode { get; }
}
}
This means that all Jenny plugins must provide these properties. While you can technically compute these values any way you want, they will almost certainly be constant values in practice.
A short, human-readable name to identify this plugin in log files or console output. You can use whatever characters you'd like (including whitespace).
An integer used to determine the execution order plugins of a given type, with lower priorities (including negative values) being executed first.
Use this if you need to ensure that one plugin finishes before another starts. If two plugins have the same priority
, their relative execution order is unspecified (i.e. either one of them could be run first). If in doubt, you can return zero. To ensure that your plugin is among the first or last to execute, return int.MinValue
or int.MaxValue
, respectively. Generally, this is more useful for IPreProcessor
s, IPostProcessor
s, and IDoctor
s than it is for IDataProvider
or ICodeGenerator
s.
Note that regardless of the value of this property, all plugins in one stage will execute before the next stage is started (e.g. all IDataProvider
s are guaranteed to have finished before any ICodeGenerator
is executed).
Return true
to allow this plugin to execute in dry runs of Jenny. If your plugin modifies the file system or other external resources in any way, you should return false
. Otherwise, you can return true
.
IDataProvider
s and ICodeGenerator
s generally don't modify the file system, so they can more than likely return true
.
Guides: Introduction - Installation - Upgrading - FAQ - Cookbook - Contributing
Need Help? Ask a question on Discord or create an issue.
- The Basics
- Concepts
- Architecture / Patterns