Explorar el Código

[java] support --java-lib <directory> (#9551)

* [java] support --java-lib <directory>

* [java] update CLI help for --java-lib
Jens Fischer hace 5 años
padre
commit
cb30bd580a
Se han modificado 2 ficheros con 13 adiciones y 4 borrados
  1. 2 2
      src/compiler/haxe.ml
  2. 11 2
      src/context/nativeLibraryHandler.ml

+ 2 - 2
src/compiler/haxe.ml

@@ -856,10 +856,10 @@ try
 		),"<file>","use the SWF library for type checking");
 		("Target-specific",["--java-lib"],["-java-lib"],Arg.String (fun file ->
 			add_native_lib file false;
-		),"<file>","add an external JAR or class directory library");
+		),"<file>","add an external JAR or directory of JAR files");
 		("Target-specific",["--java-lib-extern"],[],Arg.String (fun file ->
 			add_native_lib file true;
-		),"<file>","use an external JAR or class directory library for type checking");
+		),"<file>","use an external JAR or directory of JAR files for type checking");
 		("Target-specific",["--net-lib"],["-net-lib"],Arg.String (fun file ->
 			add_native_lib file false;
 		),"<file>[@std]","add an external .NET DLL file");

+ 11 - 2
src/context/nativeLibraryHandler.ml

@@ -24,8 +24,17 @@ let add_native_lib com file is_extern = match com.platform with
 	| Globals.Flash ->
 		SwfLoader.add_swf_lib com file is_extern
 	| Globals.Java ->
-		let std = file = "lib/hxjava-std.jar" in
-		Java.add_java_lib com file std is_extern
+		let add file =
+			let std = file = "lib/hxjava-std.jar" in
+			Java.add_java_lib com file std is_extern
+		in
+		if try Sys.is_directory file with Sys_error _ -> false then
+			let dir = file in
+			(fun _ -> Array.iter (fun file ->
+				if ExtString.String.ends_with file ".jar" then add (dir ^ "/" ^ file) ()
+			) (Sys.readdir file))
+		else
+			add file
 	| Globals.Cs ->
 		let file, is_std = match ExtString.String.nsplit file "@" with
 			| [file] ->