Skip to content

Commit 22032ef

Browse files
committed
Allow eval for HXP projects.
Plus, do some cleanup. For instance, `nekoOutput` is only used in one spot, so might as well declare it there. Aside: I doubt `fullPath()` is needed, but I don't care to test it.
1 parent 92e6537 commit 22032ef

File tree

1 file changed

+11
-33
lines changed

1 file changed

+11
-33
lines changed

src/lime/tools/HXProject.hx

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -376,38 +376,18 @@ class HXProject extends Script
376376

377377
var tempDirectory = System.getTemporaryDirectory();
378378
var classFile = Path.combine(tempDirectory, name + ".hx");
379-
var nekoOutput = Path.combine(tempDirectory, name + ".n");
380379

381380
System.copyFile(path, classFile);
382381

383-
#if lime
384-
var args = [
385-
name,
386-
"-main",
387-
"lime.tools.HXProject",
388-
"-cp",
389-
tempDirectory,
390-
"-neko",
391-
nekoOutput,
392-
"-cp",
393-
Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src"),
394-
"-lib",
395-
"lime",
396-
"-lib",
397-
"hxp"
398-
];
399-
#else
400382
var args = [
401383
name,
402-
"--interp",
403-
"-main",
404-
"lime.tools.HXProject",
405-
"-cp",
406-
tempDirectory,
407-
"-cp",
408-
Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src")
384+
#if lime
385+
"-lib", "lime",
386+
"-lib", "hxp",
387+
#end
388+
"-cp", tempDirectory,
389+
"-cp", Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src")
409390
];
410-
#end
411391
var input = File.read(classFile, false);
412392
var tag = "@:compiler(";
413393

@@ -430,10 +410,6 @@ class HXProject extends Script
430410
var cacheDryRun = System.dryRun;
431411
System.dryRun = false;
432412

433-
#if lime
434-
System.runCommand("", "haxe", args);
435-
#end
436-
437413
var inputFile = Path.combine(tempDirectory, "input.dat");
438414
var outputFile = Path.combine(tempDirectory, "output.dat");
439415

@@ -457,10 +433,12 @@ class HXProject extends Script
457433

458434
try
459435
{
460-
#if lime
461-
System.runCommand("", "neko", [FileSystem.fullPath(nekoOutput), inputFile, outputFile]);
436+
#if (lime && !eval)
437+
var nekoOutput = FileSystem.fullPath(Path.combine(tempDirectory, name + ".n"));
438+
System.runCommand("", "haxe", args.concat(["--main", "lime.tools.HXProject", "-neko", nekoOutput]));
439+
System.runCommand("", "neko", [nekoOutput, inputFile, outputFile]);
462440
#else
463-
System.runCommand("", "haxe", args.concat(["--", inputFile, outputFile]));
441+
System.runCommand("", "haxe", args.concat(["--run", "lime.tools.HXProject", inputFile, outputFile]));
464442
#end
465443
}
466444
catch (e:Dynamic)

0 commit comments

Comments
 (0)