Merge pull request #1615 from player-03/eval_tools
Add the `-eval` flag to run Lime tools using Eval.
This commit is contained in:
@@ -376,38 +376,18 @@ class HXProject extends Script
|
|||||||
|
|
||||||
var tempDirectory = System.getTemporaryDirectory();
|
var tempDirectory = System.getTemporaryDirectory();
|
||||||
var classFile = Path.combine(tempDirectory, name + ".hx");
|
var classFile = Path.combine(tempDirectory, name + ".hx");
|
||||||
var nekoOutput = Path.combine(tempDirectory, name + ".n");
|
|
||||||
|
|
||||||
System.copyFile(path, classFile);
|
System.copyFile(path, classFile);
|
||||||
|
|
||||||
#if lime
|
|
||||||
var args = [
|
var args = [
|
||||||
name,
|
name,
|
||||||
"-main",
|
#if lime
|
||||||
"lime.tools.HXProject",
|
"-lib", "lime",
|
||||||
"-cp",
|
"-lib", "hxp",
|
||||||
tempDirectory,
|
#end
|
||||||
"-neko",
|
"-cp", tempDirectory,
|
||||||
nekoOutput,
|
"-cp", Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src")
|
||||||
"-cp",
|
|
||||||
Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src"),
|
|
||||||
"-lib",
|
|
||||||
"lime",
|
|
||||||
"-lib",
|
|
||||||
"hxp"
|
|
||||||
];
|
];
|
||||||
#else
|
|
||||||
var args = [
|
|
||||||
name,
|
|
||||||
"--interp",
|
|
||||||
"-main",
|
|
||||||
"lime.tools.HXProject",
|
|
||||||
"-cp",
|
|
||||||
tempDirectory,
|
|
||||||
"-cp",
|
|
||||||
Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src")
|
|
||||||
];
|
|
||||||
#end
|
|
||||||
var input = File.read(classFile, false);
|
var input = File.read(classFile, false);
|
||||||
var tag = "@:compiler(";
|
var tag = "@:compiler(";
|
||||||
|
|
||||||
@@ -430,10 +410,6 @@ class HXProject extends Script
|
|||||||
var cacheDryRun = System.dryRun;
|
var cacheDryRun = System.dryRun;
|
||||||
System.dryRun = false;
|
System.dryRun = false;
|
||||||
|
|
||||||
#if lime
|
|
||||||
System.runCommand("", "haxe", args);
|
|
||||||
#end
|
|
||||||
|
|
||||||
var inputFile = Path.combine(tempDirectory, "input.dat");
|
var inputFile = Path.combine(tempDirectory, "input.dat");
|
||||||
var outputFile = Path.combine(tempDirectory, "output.dat");
|
var outputFile = Path.combine(tempDirectory, "output.dat");
|
||||||
|
|
||||||
@@ -457,10 +433,12 @@ class HXProject extends Script
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if lime
|
#if (lime && !eval)
|
||||||
System.runCommand("", "neko", [FileSystem.fullPath(nekoOutput), inputFile, outputFile]);
|
var nekoOutput = FileSystem.fullPath(Path.combine(tempDirectory, name + ".n"));
|
||||||
|
System.runCommand("", "haxe", args.concat(["--main", "lime.tools.HXProject", "-neko", nekoOutput]));
|
||||||
|
System.runCommand("", "neko", [nekoOutput, inputFile, outputFile]);
|
||||||
#else
|
#else
|
||||||
System.runCommand("", "haxe", args.concat(["--", inputFile, outputFile]));
|
System.runCommand("", "haxe", args.concat(["--run", "lime.tools.HXProject", inputFile, outputFile]));
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
catch (e:Dynamic)
|
catch (e:Dynamic)
|
||||||
|
|||||||
@@ -199,6 +199,23 @@ class RunScript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.indexOf("-eval") >= 0)
|
||||||
|
{
|
||||||
|
args.remove("-eval");
|
||||||
|
Log.info("Experimental: executing `lime " + args.slice(0, args.length - 1).join(" ")
|
||||||
|
+ "` using Eval (https://haxe.org/blog/eval/)");
|
||||||
|
|
||||||
|
var args = [
|
||||||
|
"-D", "lime",
|
||||||
|
"-cp", "tools",
|
||||||
|
"-cp", "tools/platforms",
|
||||||
|
"-cp", "src",
|
||||||
|
"-lib", "format",
|
||||||
|
"-lib", "hxp",
|
||||||
|
"--run", "CommandLineTools"].concat(args);
|
||||||
|
Sys.exit(runCommand("", "haxe", args));
|
||||||
|
}
|
||||||
|
|
||||||
if (!FileSystem.exists("tools/tools.n") || args.indexOf("-rebuild") > -1)
|
if (!FileSystem.exists("tools/tools.n") || args.indexOf("-rebuild") > -1)
|
||||||
{
|
{
|
||||||
rebuildTools();
|
rebuildTools();
|
||||||
|
|||||||
Reference in New Issue
Block a user