This is the rub. Unless you use an interpreted language (which would potentially incur the performance issue that JhonKkk mentions) then you will always have this “compile at runtime” problem.
I’m not planning on releasing any of my stuff to android in the near future, but if I were then I would try to arrange the groovy scripts so that I can precompile them to .class files. (one of the benefits of the non-interpreted languages like groovy, etc.).
I will probably explore this for Mythruna also because with the number of scripts I will have the load time becomes pretty high. (The new engine serializes the blockset prebuilt instead of running the groovy scripts to assemble them and that’s a difference of countable seconds to less than a millisecond to load the whole set… and now I’m greedy.)
For my groovy scripts that rely heavily on certain types of DSL tricks, I’m going to experiment to see if I can serialize the class + objects and get around runtime compilation. (Also gives a bit of obfuscation I guess.) That wouldn’t necessarily work for Android, though.
Stylistically, over the years I prefer fewer DSL hacks anyway over more straight-forward groovy scripts… maybe with some injected preamble for common includes, etc. (which could pretty easily be rolled into a gradle precompilation task, I guess.)