Skip to content

Commit

Permalink
Update dab-config
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Aug 31, 2024
1 parent 0f343db commit e58c91d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions res/classpath/src/ClassPathMacro.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>, targets:Array<String>) {
Expand Down
13 changes: 9 additions & 4 deletions src/HaxeClasspath.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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",',
Expand Down

0 comments on commit e58c91d

Please sign in to comment.