From 413b3424922a710f268bd246cb806e71c9a95009 Mon Sep 17 00:00:00 2001 From: Yanrishatum Date: Sat, 25 Aug 2018 18:30:18 +0300 Subject: [PATCH] Add hxml parsing support. --- HLCompiler.hx | 16 ++++------------ HLCompilerCLI.hx | 8 ++++---- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/HLCompiler.hx b/HLCompiler.hx index 47ec40c..be869c7 100644 --- a/HLCompiler.hx +++ b/HLCompiler.hx @@ -340,7 +340,6 @@ class HLCompiler var hxmlPath:String = path; base.resolveIncludes(Path.directory(path)); base.resolveLibraries(); - var found:Hxml = null; for(x in base.generateTargetHxmls()) { var targets = x.getTargets(); @@ -348,21 +347,14 @@ class HLCompiler { if (t.target.indexOf("-hl") != -1 && StringTools.endsWith(t.path, ".c")) { - found = x; - srcPath = Path.directory(t.path); - mainName = Path.withoutDirectory(t.path); - output = Path.directory(t.path); - exeName = Path.withoutDirectory(Path.withExtension(t.path, "exe")); - break; + Sys.command("haxe", [hxmlPath]); + compileJson(Path.join([Path.directory(t.path), "hlc.json"])); + return; } } - if (found != null) break; - } - if (found == null) - { - error("Hxml file does not generate HL C code!"); } + error("Hxml file does not generate HL C code!"); } public function compile():Void diff --git a/HLCompilerCLI.hx b/HLCompilerCLI.hx index fb67cdc..f64dc70 100644 --- a/HLCompilerCLI.hx +++ b/HLCompilerCLI.hx @@ -74,9 +74,8 @@ class HLCompilerCLI test = Path.join([path, file]); if (FileSystem.exists(test)) { - // compiler.compileHxml(test); - // Sys.exit(0); - handleError("Found HXML, but HXML parsing not yet supported"); + compiler.compileHxml(test); + Sys.exit(0); } } } @@ -90,7 +89,8 @@ class HLCompilerCLI } if (p.ext == "hxml") { - handleError("Found HXML, but HXML parsing not yet supported"); + compiler.compileHxml(path); + Sys.exit(0); } } }