Where to place @:build macros with module level fields

I like MLFs Module-level fields are here! - Haxe - The Cross-platform Toolkit because it makes the code cleaner, by not requiring the class keyboard, or public static on every ivocation.

How can i use it with build macro annonations?

You can add --macro addGlobalMetadata('some.Module', '@:build(Tro.lolo())', false) to you your build.

Or --macro addGlobalMetada('', '@:build(Every.thing())') to run a build macro across all modules and then use something that is cheap to check against.

For example:

You could define a module called SomePragma (can be empty) and then in Every.thing do if (!Lambda.exists(haxe.macro.Context.getLocalUsing(), c -> c.toString() == 'SomePragma')) return null to bail out early in all modules that don’t have using SomePragma;

You can then also add using SomePragma; into an import.hx to apply it to entire folders when so desired.