Note that using @:persistent does in fact work:

class TestMacro {

@:persistent static var firstBuild:Bool = true;

public static function build():Array<Field> {
   if (firstBuild) {
        trace("congratulations on your first buildd!");
        firstBuild = false;
   }
   else{
		trace("second build");
   }
      return null;
}

}

Thus allowing for file contents to be cached. Be cognizant whether the calling function is a "macro" function or not, it might affect how things like @:persistent works.

In my experience, the main issue is reading files with ".hx" extensions because they apparently conflict with the compiler accessing the file resources. Consider changing the file extension for files you want to load.

Also be aware of Context.registerModuleDependency().

The jury is still out on using "#if display". It isn't clear if there is a seperate "display" build outside the compilation cache build.