From e58c91d229d47611b70ccbeb2f7e2c2dac5d7adb Mon Sep 17 00:00:00 2001 From: k Date: Sat, 31 Aug 2024 17:33:45 +0200 Subject: [PATCH] Update dab-config --- res/classpath/src/ClassPathMacro.hx | 6 ++++-- src/HaxeClasspath.hx | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/res/classpath/src/ClassPathMacro.hx b/res/classpath/src/ClassPathMacro.hx index 1107dc0..d11b0d9 100644 --- a/res/classpath/src/ClassPathMacro.hx +++ b/res/classpath/src/ClassPathMacro.hx @@ -12,14 +12,16 @@ class ClassPathMacro { Sys.println('[OUT]: ${Compiler.getOutput()}'); var ownPath = FileSystem.fullPath(Path.join([Context.resolvePath("ClassPathMacro.hx"), '..'])); + var fullPath = Context.defined('fullpath'); - for (cp in haxe.macro.Context.getClassPath()) { + for (cp in Context.getClassPath()) { if (cp == "") continue; if (FileSystem.fullPath(cp) == ownPath) continue; + if (fullPath) cp = FileSystem.fullPath(cp); Sys.println('[CLASSPATH]: $cp'); } - haxe.macro.Context.fatalError('Compilation aborted', haxe.macro.Context.currentPos()); + Context.fatalError('Compilation aborted', Context.currentPos()); } static function first(defines:Iterator, targets:Array) { diff --git a/src/HaxeClasspath.hx b/src/HaxeClasspath.hx index 002f416..363d2e5 100644 --- a/src/HaxeClasspath.hx +++ b/src/HaxeClasspath.hx @@ -32,19 +32,24 @@ class HaxeClasspath { static var stdRoot = FileSystem.fullPath(Path.join([Sys.getCwd(), "current", "std"])); - static function getClasspath(?hxml:String = "build.hxml"):ClasspathResult { + static function getClasspath(?hxml:String = "build.hxml", ?fullpath:Bool = false):ClasspathResult { final cwd = Utils.getCallSite(); hxml = Path.isAbsolute(hxml) ? hxml : Path.join([cwd, hxml]); if (!FileSystem.exists(hxml)) throw 'Cannot find hxml file $hxml'; Sys.putEnv("HAXE_STD_PATH", stdRoot); - final proc = new Process("haxe", [ + final args = [ "--cwd", cwd, hxml, "-cp", FileSystem.absolutePath("res/classpath/src"), "--macro", "ClassPathMacro.run()", "--no-output" - ]); + ]; + if (fullpath) { + args.push("-D"); + args.push("fullpath"); + } + final proc = new Process("haxe", args); try { final code = proc.exitCode(); @@ -107,7 +112,7 @@ class HaxeClasspath { public static function getDapConfig(?hxml:String = "build.hxml"):Void { try { - var data = getClasspath(hxml); + var data = getClasspath(hxml, true); Sys.println([ '{', ' name="HashLink",',