瀏覽代碼

[4.3.6] Fix --java out -D jvm deprecation warning (#11739)

* Fix detection of --java out -D jvm

* [tests] add test for 11737
Rudy Ges 1 年之前
父節點
當前提交
729001353d

+ 1 - 0
src/compiler/compiler.ml

@@ -129,6 +129,7 @@ module Setup = struct
 			| Java ->
 				Java.before_generate com;
 				if defined com Define.Jvm then begin
+					if not actx.jvm_flag then com.warning WDeprecated com.warning_options ("--java out.jar -D jvm is deprecated; use --jvm out.jar directly") null_pos;
 					add_std "jvm";
 					com.package_rules <- PMap.remove "jvm" com.package_rules;
 				end;

+ 2 - 3
src/compiler/generate.ml

@@ -81,10 +81,9 @@ let generate ctx tctx ext actx =
 		| Cs ->
 			Gencs.generate,"cs"
 		| Java ->
-			if Common.defined com Jvm then begin
-				com.warning WDeprecated com.warning_options ("--java out.jar -D jvm is deprecated; use --jvm out.jar directly") null_pos;
+			if Common.defined com Jvm then
 				Genjvm.generate actx.jvm_flag,"java"
-			end else
+			else
 				Genjava.generate,"java"
 		| Python ->
 			Genpy.generate,"python"

+ 1 - 0
tests/misc/projects/Issue11737/Main.hx

@@ -0,0 +1 @@
+function main() {}

+ 1 - 0
tests/misc/projects/Issue11737/_setup.hxml

@@ -0,0 +1 @@
+--cmd haxelib install --quiet hxjava

+ 3 - 0
tests/misc/projects/Issue11737/compile.hxml

@@ -0,0 +1,3 @@
+--main Main
+--java bin
+-D jvm

+ 1 - 0
tests/misc/projects/Issue11737/compile.hxml.stderr

@@ -0,0 +1 @@
+Warning : (WDeprecated) --java out.jar -D jvm is deprecated; use --jvm out.jar directly

+ 2 - 0
tests/misc/projects/Issue11737/compile1.hxml

@@ -0,0 +1,2 @@
+--main Main
+--jvm bin/jvm.jar

+ 0 - 0
tests/misc/projects/Issue11737/compile1.hxml.stderr


+ 2 - 0
tests/misc/projects/Issue11737/compile2.hxml

@@ -0,0 +1,2 @@
+--main Main
+--java bin

+ 0 - 0
tests/misc/projects/Issue11737/compile2.hxml.stderr