fix macro not running without explicit import
This commit is contained in:
@@ -25,4 +25,5 @@
|
||||
--macro keep("Main")
|
||||
--macro keep("Assets")
|
||||
--macro keep("AssetMacro")
|
||||
--macro macros.AssetMacro.includeAssets()
|
||||
# --macro macros.MacroLoader.run()
|
||||
@@ -1,7 +1,6 @@
|
||||
package;
|
||||
|
||||
import openfl.display.Sprite;
|
||||
import Assets; // Forces @:build(macros.AssetMacro.build()) to run.
|
||||
|
||||
class Main extends Sprite {
|
||||
public function new() {
|
||||
|
||||
@@ -15,6 +15,11 @@ using StringTools;
|
||||
class AssetMacro {
|
||||
// Track all assets processed
|
||||
private static var assetMap:Map<String, Array<{id:String, path:String, size:Int, type:String}>> = new Map();
|
||||
|
||||
/** Force Assets to be typed, which invokes its @:build macro. */
|
||||
public static function includeAssets():Void {
|
||||
Context.getType("Assets");
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry point for the macro - called during compilation
|
||||
|
||||
Reference in New Issue
Block a user