I have an AST transformation which runs both as a global and a local one.
The idea is,
the global AST finds all the classes annotated with @Entity
the local AST is "injecting" a list of found class-names into a new field of a specifically annotated class.
The whole thing works, and unit-tests prove that.
Although, I'm not sure about the ordering of local and global ASTs, and couldn't find the info on that in ref-doc.
Is it guaranteed, that the global AST always runs before the local one? Is it subject to change in upcoming Groovy 4+ versions?
The answer is that yes, global transforms are always running before local ones if in the same phase.
the longer answer is that the compile passes through different phase in which one is responsible for recognizing the local transform. The transform is then registered and run as part of the compilation in the same and later phases, depending on the configuration of the transform. But global transforms have been already added at this point. Of course a global transform for a later phase is run after a local transform for an earlier phase.