Closed mintdaniel42 closed 5 months ago
it is very old mechanism developed 20+ years ago to provide some point where custom code can be called to use it just set instance of your class into created context before execution as it is shown in com.igormaznitsa.jcp.usecases.UserFunctionTest
context.setPreprocessorExtension(instanceOfYourClass);
then your registered extension should be called during preprocessing
//#action arg1, arg2, arg3
just will call processAction and arguments will be provided through array
Okay thanks, but how can I use this with a build tool?
it was developed for use preprocessor programmatically as part of build process, for use on application level it needs improvements
Oh okay but thanks anyway
anyway it is a good point, I will provide way to register a class as action preprocessor extension in plugins
I have made some improvements in 7.1.2-SNAPSHOT, added /EA:<class.name>
for CLI and actionPreprocessorExtension
for plugins. It will be looking for the class by its name in class path and then the class will be instantiated through default constructor. So you can try if you wish.
Yoo, that's cool. Thank you! I'll take a look into it!
the feature is released in 7.1.2
I've searched through half of the code in order to understand how the //#action directive works. As far as I understood one can plug in your own preprocessing macros through extending the PreprocessorExtension. But how can I set my own extension class so that the preprocessor uses it? Neither the documap nor the gradle task give any information about that. In addition to that, a PreprocessorContext.setPreprocessorExtension(PreprocessorExtension) method is defined but never used (at least I couldn't find any usages with IntelliJ decompiler & find usages). Is the feature not ready yet or did I just miss something?