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