Browse Source

Revert "[tests] align JVM CLI usage with other targets"

This reverts commit 2b0d4100e2c8268268cfe0b5553925a3bd9bc188.
Aleksandr Kuzmenko 5 năm trước cách đây
mục cha
commit
174cf69bba

+ 2 - 1
extra/all.hxml

@@ -33,7 +33,8 @@
 -xml java.xml
 
 --next
---jvm all_jvm
+-java all_jvm
+-D jvm
 -xml jvm.xml
 
 --next

+ 11 - 11
src/compiler/haxe.ml

@@ -677,7 +677,7 @@ let rec process_params create pl =
 
 and init ctx =
 	let usage = Printf.sprintf
-		"Haxe Compiler %s - (C)2005-2020 Haxe Foundation\nUsage: haxe%s <target> [options] [hxml files and dot paths...]\n"
+		"Haxe Compiler %s - (C)2005-2020 Haxe Foundation\nUsage: haxe%s <target> [options] [hxml files...]\n"
 		(s_version true) (if Sys.os_type = "Win32" then ".exe" else "")
 	in
 	let com = ctx.com in
@@ -715,10 +715,10 @@ try
 	in
 	(* category, official names, deprecated names, arg spec, usage hint, doc *)
 	let basic_args_spec = [
-		("Target",["--js"],["-js"],Arg.String (Initialize.set_platform com Js),"<file>","generate JavaScript code into target file");
-		("Target",["--lua"],["-lua"],Arg.String (Initialize.set_platform com Lua),"<file>","generate Lua code into target file");
-		("Target",["--swf"],["-swf"],Arg.String (Initialize.set_platform com Flash),"<file>","generate Flash SWF bytecode into target file");
-		("Target",["--neko"],["-neko"],Arg.String (Initialize.set_platform com Neko),"<file>","generate Neko bytecode into target file");
+		("Target",["--js"],["-js"],Arg.String (Initialize.set_platform com Js),"<file>","compile code to JavaScript file");
+		("Target",["--lua"],["-lua"],Arg.String (Initialize.set_platform com Lua),"<file>","compile code to Lua file");
+		("Target",["--swf"],["-swf"],Arg.String (Initialize.set_platform com Flash),"<file>","compile code to Flash SWF file");
+		("Target",["--neko"],["-neko"],Arg.String (Initialize.set_platform com Neko),"<file>","compile code to Neko Binary");
 		("Target",["--php"],["-php"],Arg.String (fun dir ->
 			classes := (["php"],"Boot") :: !classes;
 			Initialize.set_platform com Php dir;
@@ -729,7 +729,7 @@ try
 		("Target",["--cppia"],["-cppia"],Arg.String (fun file ->
 			Common.define com Define.Cppia;
 			Initialize.set_platform com Cpp file;
-		),"<file>","generate Cppia bytecode into target file");
+		),"<file>","generate Cppia code into target file");
 		("Target",["--cs"],["-cs"],Arg.String (fun dir ->
 			cp_libs := "hxcs" :: !cp_libs;
 			Initialize.set_platform com Cs dir;
@@ -738,18 +738,18 @@ try
 			cp_libs := "hxjava" :: !cp_libs;
 			Initialize.set_platform com Java dir;
 		),"<directory>","generate Java code into target directory");
-		("Target",["--jvm"],[],Arg.String (fun dir ->
+		("Target",["--jvm"],["-jvm"],Arg.String (fun dir ->
 			cp_libs := "hxjava" :: !cp_libs;
 			Common.define com Define.Jvm;
 			jvm_flag := true;
 			Initialize.set_platform com Java dir;
-		),"<file>","generate JVM bytecode into target file");
+		),"<directory>","generate JVM bytecode into target file");
 		("Target",["--python"],["-python"],Arg.String (fun dir ->
 			Initialize.set_platform com Python dir;
-		),"<file>","generate Python code into target file");
+		),"<file>","generate Python code as target file");
 		("Target",["--hl"],["-hl"],Arg.String (fun file ->
 			Initialize.set_platform com Hl file;
-		),"<file>","generate HashLink .hl bytecode or .c code into target file");
+		),"<file>","compile HL code as target file");
 		("Target",[],["-x"], Arg.String (fun cl ->
 			let cpath = Path.parse_type_path cl in
 			(match com.main_class with
@@ -765,7 +765,6 @@ try
 			Initialize.set_platform com (!Globals.macro_platform) "";
 			interp := true;
 		),"","interpret the program using internal macro system");
-		("Target",["--run"],[], Arg.Unit (fun() -> die "" __LOC__), "<module> [args...]","interpret a Haxe module with command line arguments");
 
 		("Compilation",["-p";"--class-path"],["-cp"],Arg.String (fun path ->
 			process_libs();
@@ -818,6 +817,7 @@ try
 			List.iter (fun msg -> ctx.com.print (msg ^ "\n")) all;
 			did_something := true
 		),"","print help for all compiler metadatas");
+		("Misc",["--run"],[], Arg.Unit (fun() -> die "" __LOC__), "<module> [args...]","compile and execute a Haxe module with command line arguments");
 	] in
 	let adv_args_spec = [
 		("Optimization",["--dce"],["-dce"],Arg.String (fun mode ->

+ 1 - 1
tests/benchs/.vscode/settings.json

@@ -13,7 +13,7 @@
 		{"label": "PHP", "args": ["build.hxml", "-php", "export/php", "-cmd", "C:\\WINDOWS\\Sysnative\\bash.exe -c 'php export/php/index.php'"]},
 		{"label": "PHP 7", "args": ["build.hxml", "-php", "export/php", "-D", "php7", "-cmd", "C:\\WINDOWS\\Sysnative\\bash.exe -c 'php7.0 export/php/index.php'"]},
 		{"label": "Java", "args": ["build.hxml", "-java", "export/java", "-cmd", "java -jar export/java/Main.jar"]},
-		{"label": "JVM", "args": ["build.hxml", "--jvm", "export/run.jar", "-cmd", "java -jar export/run.jar"]},
+		{"label": "Jvm", "args": ["build.hxml", "-D", "jvm", "-java", "export/java", "-cmd", "java -jar export/java/Main.jar"]},
 		{"label": "C#", "args": ["build.hxml", "-cs", "export/cs", "-cmd", "cmd /C export\\cs\\bin\\Main.exe"]},
 		{"label": "Interp", "args": ["build.hxml", "--interp"]},
 	],

+ 4 - 2
tests/benchs/mandelbrot/compile-jvm.hxml

@@ -1,7 +1,9 @@
 --main Mandelbrot
---jvm bin/Mandelbrot.jar
+-java bin/jvm
+-D jvm
 
 --next
 --main Mandelbrot
---jvm bin/Mandelbrot-anon.jar
+-java bin/jvm-anon
 -D anon_objects
+-D jvm

+ 2 - 1
tests/misc/java/projects/Issue9210/compile.hxml

@@ -1,4 +1,5 @@
---jvm bin/haxe.jar
+--java bin
+-D jvm
 haxe.ds.Option
 
 --next

+ 5 - 5
tests/runci/targets/Jvm.hx

@@ -6,19 +6,19 @@ import runci.Config.*;
 class Jvm {
 	static public function run(args:Array<String>) {
 		runCommand("haxe", ["compile-jvm.hxml"].concat(args));
-		runCommand("java", ["-jar", "bin/unit.jar"]);
+		runCommand("java", ["-jar", "bin/jvm/TestMain-Debug.jar"]);
 
 		runCommand("haxe", ["compile-jvm.hxml","-dce","no"].concat(args));
-		runCommand("java", ["-jar", "bin/unit.jar"]);
+		runCommand("java", ["-jar", "bin/jvm/TestMain-Debug.jar"]);
 
 		changeDirectory(sysDir);
 		runCommand("haxe", ["compile-jvm.hxml"].concat(args));
-		runCommand("java", ["-jar", "bin/jvm/sys.jar"]);
+		runCommand("java", ["-jar", "bin/jvm/Main-Debug.jar"]);
 
 		changeDirectory(threadsDir);
-		runCommand("haxe", ["build.hxml", "--jvm", "export/threads.jar"].concat(args));
+		runCommand("haxe", ["build.hxml", "-java", "export/jvm", "-D", "jvm"].concat(args));
 		if (systemName != "Windows") { // #8154
-			runCommand("java", ["-jar", "export/threads.jar"]);
+			runCommand("java", ["-jar", "export/jvm/Main.jar"]);
 		}
 	}
 }

+ 8 - 4
tests/sys/compile-jvm.hxml

@@ -1,18 +1,22 @@
 compile-each.hxml
 --main Main
---jvm bin/jvm/sys.jar
+-java bin/jvm
+-D jvm
 
 --next
 compile-each.hxml
 --main TestArguments
---jvm bin/jvm/TestArguments.jar
+-java bin/jvm
+-D jvm
 
 --next
 compile-each.hxml
 --main ExitCode
---jvm bin/jvm/ExitCode.jar
+-java bin/jvm
+-D jvm
 
 --next
 compile-each.hxml
 --main UtilityProcess
---jvm bin/jvm/UtilityProcess.jar
+-java bin/jvm
+-D jvm

+ 1 - 0
tests/sys/genTestRes.py

@@ -83,6 +83,7 @@ for data in allFilenames:
       ("../../bin/lua/UtilityProcess.lua", "bin-lua"),
       ("../../bin/java/UtilityProcess-Debug.jar", "bin-java-debug"),
       ("../../bin/java/UtilityProcess.jar", "bin-java"),
+      ("../../bin/jvm/UtilityProcess-Debug.jar", "bin-jvm-debug"),
       ("../../bin/jvm/UtilityProcess.jar", "bin-jvm"),
       ("../../bin/neko/UtilityProcess.n", "bin-neko"),
       ("../../bin/php/UtilityProcess/index.php", "bin-php"),

+ 6 - 2
tests/sys/src/ExitCode.hx

@@ -25,8 +25,12 @@ class ExitCode {
 		#else
 			"bin/cs/bin/ExitCode.exe";
 		#end
-	#elseif jvm
-		"bin/jvm/ExitCode.jar";
+	#elseif (java && jvm)
+		#if debug
+			"bin/jvm/ExitCode-Debug.jar";
+		#else
+			"bin/jvm/ExitCode.jar";
+		#end
 	#elseif java
 		#if debug
 			"bin/java/ExitCode-Debug.jar";

+ 6 - 2
tests/sys/src/TestArguments.hx

@@ -85,8 +85,12 @@ class TestArguments extends utest.Test {
 		#else
 			"bin/cs/bin/TestArguments.exe";
 		#end
-	#elseif jvm
-		"bin/jvm/TestArguments.jar";
+	#elseif (java && jvm)
+		#if debug
+			"bin/jvm/TestArguments-Debug.jar";
+		#else
+			"bin/jvm/TestArguments.jar";
+		#end
 	#elseif java
 		#if debug
 			"bin/java/TestArguments-Debug.jar";

+ 0 - 2
tests/sys/src/TestSys.hx

@@ -37,8 +37,6 @@ class TestSys extends TestCommandBase {
 			}
 		#elseif cs
 			Assert.isTrue(StringTools.endsWith(p, "Main-Debug.exe"));
-		#elseif jvm
-			Assert.isTrue(StringTools.endsWith(p, "sys.jar"));
 		#elseif java
 			Assert.isTrue(StringTools.endsWith(p, "Main-Debug.jar"));
 		#elseif python

+ 6 - 2
tests/sys/src/TestUnicode.hx

@@ -26,8 +26,12 @@ class TestUnicode extends utest.Test {
 		"bin-hl";
 #elseif lua
 		"bin-lua";
-#elseif jvm
-		"bin-jvm";
+#elseif (java && jvm)
+		#if debug
+			"bin-jvm-debug";
+		#else
+			"bin-jvm";
+		#end
 #elseif java
 		#if debug
 			"bin-java-debug";

+ 1 - 3
tests/sys/src/UtilityProcess.hx

@@ -16,7 +16,7 @@ class UtilityProcess {
 		Path.join(["bin", "hl"]);
 #elseif lua
 		Path.join(["bin", "lua"]);
-#elseif jvm
+#elseif (java && jvm)
 		Path.join(["bin", "jvm"]);
 #elseif java
 		Path.join(["bin", "java"]);
@@ -48,8 +48,6 @@ class UtilityProcess {
 		"UtilityProcess.hl";
 #elseif lua
 		"UtilityProcess.lua";
-#elseif jvm
-		"UtilityProcess.jar";
 #elseif java
 		#if debug
 			"UtilityProcess-Debug.jar";

+ 1 - 1
tests/unit/compile-jvm.hxml

@@ -6,4 +6,4 @@
 compile-each.hxml
 --main unit.TestMain
 --java-lib native_java/native.jar
---jvm bin/unit.jar
+-jvm bin/jvm/TestMain-debug.jar