Closed Dvergar closed 11 months ago
Interesting case. Currently each file runs in a separate isolate, so there is no memory sharing between files.
You could try to actually write to a file to store the current value.
Thanks for the trick @schultek !
I made it work this way: I actually need a type id per class type so I'm storing the class name in a text file (if it does not exist) and get the index of the lines list of that very class name. The index becomes my type id.
This works but I'm a bit stuck with an endless growing file (i'm limiting this by storing the class name and not an id) as I cannot find a way to reset its content before or after a codegen and I can only make the runAfter
property of @Codegen
on a per-file basis.
A bit dirty as i'll probably have to clean the text file manually from time to time but it works for now 👍.
I'm trying to make a simple integer id generator for each visit of an
apply
call but it seems likesuper_annotation
build is running so isolated that i cannot even read/write a static value. How would you handle such a case?I'm trying to bind a unique id (incremented) to every class having a specific annotation.
Thanks 🙌.