Skip to content

Commit a3b577e

Browse files
committed
[hx list-modules] restore needed files...
1 parent 0382c17 commit a3b577e

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

extra/classpath/src/ClassPathMacro.hx

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import haxe.macro.Context;
2+
import haxe.io.Path;
3+
import sys.FileSystem;
4+
5+
class ClassPathMacro {
6+
public static function run() {
7+
var defines = Context.getDefines();
8+
var targets = ["js", "hl", "cpp", "cppia", "cs", "java", "jvm", "lua", "swf", "neko", "php", "python", "interp"];
9+
var target = first(defines.keys(), targets);
10+
Sys.println('[TARGET]: $target');
11+
12+
var ownPath = FileSystem.fullPath(Path.join([Context.resolvePath("ClassPathMacro.hx"), '..']));
13+
14+
for (cp in haxe.macro.Context.getClassPath()) {
15+
if (cp == "") continue;
16+
if (FileSystem.fullPath(cp) == ownPath) continue;
17+
Sys.println('[CLASSPATH]: $cp');
18+
}
19+
20+
haxe.macro.Context.fatalError('Compilation aborted', haxe.macro.Context.currentPos());
21+
}
22+
23+
static function first(defines:Iterator<String>, targets:Array<String>) {
24+
for (def in defines) if (targets.contains(def)) return def;
25+
return null;
26+
}
27+
}

src/HaxeModules.hx

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ class HaxeModules {
3333
final proc = new Process("haxe", [
3434
"--cwd", cwd,
3535
hxml,
36-
FileSystem.absolutePath("extra/fzf/classpath.hxml")
36+
"-cp", FileSystem.absolutePath("extra/classpath/src"),
37+
"--macro", "ClassPathMacro.run()",
38+
"--no-output"
3739
]);
3840

3941
try {

0 commit comments

Comments
 (0)