diff -aur original/display.ml patched/display.ml --- original/display.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/display.ml 2009-08-27 21:16:24.000000000 +0200 @@ -73,6 +73,7 @@ let default_update_interval = 0.05;; let default_tagline_description = [ "ocaml", 'O'; + "java", 'J'; "native", 'N'; "byte", 'B'; "program", 'P'; diff -aur original/fda.ml patched/fda.ml --- original/fda.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/fda.ml 2009-08-27 21:16:24.000000000 +0200 @@ -23,13 +23,13 @@ let laws = [ { law_name = "Leftover Ocaml compilation files"; - law_rules = [Not ".cmo"; Not ".cmi"; Not ".cmx"; Not ".cma"; Not ".cmxa"]; + law_rules = [Not ".cmo"; Not ".cmi"; Not ".cmx"; Not ".cmj"; Not ".cma"; Not ".cmxa"; Not "cmja"]; law_penalty = Fail }; { law_name = "Leftover Ocaml type annotation files"; law_rules = [Not ".annot"]; law_penalty = Warn }; { law_name = "Leftover object files"; - law_rules = [Not ".o"; Not ".a"; Not ".so"; Not ".obj"; Not ".lib"; Not ".dll"]; + law_rules = [Not ".o"; Not ".a"; Not ".so"; Not ".obj"; Not ".lib"; Not ".dll"; Not "jo"]; law_penalty = Fail }; { law_name = "Leftover ocamlyacc-generated files"; law_rules = [Implies_not(".mly",".ml"); Implies_not(".mly",".mli")]; diff -aur original/main.ml patched/main.ml --- original/main.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/main.ml 2009-08-27 21:16:23.000000000 +0200 @@ -75,11 +75,14 @@ <**/*.byte>: ocaml, byte, program <**/*.odoc>: ocaml, doc <**/*.native>: ocaml, native, program + <**/*.jar>: ocaml, java, program <**/*.cma>: ocaml, byte, library <**/*.cmxa>: ocaml, native, library + <**/*.cmja>: ocaml, java, library <**/*.cmo>: ocaml, byte <**/*.cmi>: ocaml, byte, native <**/*.cmx>: ocaml, native + <**/*.cmj>: ocaml, java "; Configuration.tag_any !Options.tags; @@ -185,13 +188,13 @@ let link x = if !Options.make_links then ignore (call (S [A"ln"; A"-sf"; P x; A Pathname.current_dir_name])) in match ext with - | "byte" | "native" | "top" -> + | "byte" | "native" | "jar" | "top" -> link cmd; cmd :: acc | "html" -> link (Pathname.dirname cmd); acc | _ -> if !Options.program_to_execute then - eprintf "Warning: Won't execute %s whose extension is neither .byte nor .native" cmd; + eprintf "Warning: Won't execute %s whose extension is neither .byte nor .native nor .jar" cmd; acc end targets [] in @@ -201,7 +204,12 @@ | [] -> raise (Exit_usage "Using -- requires one target"); | cmd :: rest -> if rest <> [] then dprintf 0 "Warning: Using -- only run the last target"; - let cmd_spec = S [P cmd; atomize !Options.program_args] in + let prefix = + if Filename.check_suffix cmd ".jar" then + [A(!Options.java); A"-jar"] + else + [] in + let cmd_spec = S (prefix @ [P cmd; atomize !Options.program_args]) in dprintf 3 "Running the user command:@ %a" Pathname.print cmd; raise (Exit_with_code (call cmd_spec)) (* Exit with the exit code of the called command *) end diff -aur original/ocaml_compiler.ml patched/ocaml_compiler.ml --- original/ocaml_compiler.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/ocaml_compiler.ml 2009-08-27 21:16:22.000000000 +0200 @@ -97,6 +97,39 @@ let native_lib_linker_tags tags = tags++"ocaml"++"link"++"native"++"library" +let ocamljava_c tags arg out = + let tags = tags++"ocaml"++"java" in + Cmd (S [!Options.ocamljava; A"-c"; Ocaml_arch.forpack_flags_of_pathname arg; + T(tags++"compile"); ocaml_ppflags tags; flags_of_pathname arg; + flags_of_pathname out; ocaml_include_flags arg; + A"-o"; Px out; P arg]) + +let ocamljava_link flag tags deps out = + Cmd (S [!Options.ocamljava; flag; forpack_flags out tags; T tags; + atomize_paths deps; flags_of_pathname out; A"-o"; Px out]) + +let ocamljava_link_lib = ocamljava_link (A"-a") +let ocamljava_link_prog = ocamljava_link (A"-standalone") + +let ocamljava_p tags deps out = + let dirnames = List.union [] (List.map Pathname.dirname deps) in + let include_flags = List.fold_right ocaml_add_include_flag dirnames [] in + let mli = Pathname.update_extensions "mli" out in + let cmd = + S [!Options.ocamljava; A"-pack"; forpack_flags out tags; T tags; + S include_flags; atomize_paths deps; flags_of_pathname out; + A"-o"; Px out] in + if (*FIXME true ||*) Pathname.exists mli then Cmd cmd + else + let rm = S[A"rm"; A"-f"; P mli] in + Cmd(S[A"touch"; P mli; Sh" ; if "; cmd; Sh" ; then "; rm; Sh" ; else "; + rm; Sh" ; exit 1; fi"]) + +let java_lib_linker tags = + ocamljava_link_lib tags + +let java_lib_linker_tags tags = tags++"ocaml"++"link"++"java"++"library" + let prepare_compile build ml = let dir = Pathname.dirname ml in let include_dirs = Pathname.include_dirs_of dir in @@ -153,6 +186,13 @@ prepare_link cmx cmi [cmx_ext; "cmi"] build; ocamlopt_c (tags_of_pathname ml++"implem"+++tag) ml cmx +let java_compile_ocaml_implem ?tag ?(cmj_ext="cmj") ml env build = + let ml = env ml in + let cmi = Pathname.update_extensions "cmi" ml in + let cmj = Pathname.update_extensions cmj_ext ml in + prepare_link cmj cmi [cmj_ext; "cmi"] build; + ocamljava_c (tags_of_pathname ml++"implem"+++tag) ml cmj + let libs_of_use_lib tags = Tags.fold begin fun tag acc -> try let libpath, extern = Hashtbl.find info_libraries tag in @@ -240,6 +280,15 @@ let native_profile_library_link x = native_profile_link_gen native_lib_linker (fun tags -> native_lib_linker_tags tags++"profile") x +let java_link_gen linker = + link_gen "cmj" "cmja" !Options.ext_java_lib [!Options.ext_java_obj; "cmi"] linker + +let java_link x = java_link_gen ocamljava_link_prog + (fun tags -> tags++"ocaml"++"link"++"java"++"program") x + +let java_library_link x = + java_link_gen java_lib_linker java_lib_linker_tags x + let link_units table extensions cmX_ext cma_ext a_ext linker tagger contents_list cmX env build = let cmX = env cmX in let tags = tagger (tags_of_pathname cmX) in @@ -345,3 +394,15 @@ (fun tags -> native_lib_linker_tags tags++"profile") x let native_profile_library_link_mllib = link_from_file native_profile_library_link_modules + +let java_library_link_modules x = + link_modules [("cmj",[!Options.ext_obj])] "cmj" "cmja" + !Options.ext_java_lib java_lib_linker java_lib_linker_tags x + +let java_library_link_mllib = link_from_file java_library_link_modules + +let java_pack_modules x = + pack_modules [("cmj",["cmi"; !Options.ext_java_obj]); ("cmi",[])] "cmj" "cmja" !Options.ext_java_lib ocamljava_p + (fun tags -> tags++"ocaml"++"pack"++"java") x + +let java_pack_mlpack = link_from_file java_pack_modules diff -aur original/ocaml_compiler.mli patched/ocaml_compiler.mli --- original/ocaml_compiler.mli 2010-02-06 18:26:58.000000000 +0100 +++ patched/ocaml_compiler.mli 2009-08-27 21:16:22.000000000 +0200 @@ -21,6 +21,10 @@ val ocamlopt_link_lib : Tags.t -> Pathname.t list -> Pathname.t -> Command.t val ocamlopt_link_prog : Tags.t -> Pathname.t list -> Pathname.t -> Command.t val ocamlopt_p : Tags.t -> Pathname.t list -> Pathname.t -> Command.t +val ocamljava_c : Tags.t -> Pathname.t -> Pathname.t -> Command.t +val ocamljava_link_lib : Tags.t -> Pathname.t list -> Pathname.t -> Command.t +val ocamljava_link_prog : Tags.t -> Pathname.t list -> Pathname.t -> Command.t +val ocamljava_p : Tags.t -> Pathname.t list -> Pathname.t -> Command.t val ocamlmklib : Tags.t -> Pathname.t list -> Pathname.t -> Command.t val ocamlmktop : Tags.t -> Pathname.t list -> Pathname.t -> Command.t val prepare_compile : Rule.builder -> Pathname.t -> unit @@ -30,6 +34,7 @@ Pathname.t -> Pathname.t -> string list -> Rule.builder -> unit val native_compile_ocaml_implem : ?tag:string -> ?cmx_ext:string -> string -> Rule.action +val java_compile_ocaml_implem : ?tag:string -> ?cmj_ext:string -> string -> Rule.action val prepare_libs : string -> string -> Pathname.t -> Rule.builder -> Pathname.t list @@ -46,6 +51,8 @@ val native_library_link : string -> string -> Rule.action val native_profile_link : string -> string -> Rule.action val native_profile_library_link : string -> string -> Rule.action +val java_link : string -> string -> Rule.action +val java_library_link : string -> string -> Rule.action val link_modules : (Pathname.t * string list) list -> string -> string -> @@ -76,6 +83,10 @@ val native_profile_pack_mlpack : string -> string -> Rule.action val native_profile_library_link_modules : string list -> string -> Rule.action val native_profile_library_link_mllib : string -> string -> Rule.action +val java_library_link_modules : string list -> string -> Rule.action +val java_library_link_mllib : string -> string -> Rule.action +val java_pack_modules : string list -> string -> Rule.action +val java_pack_mlpack : string -> string -> Rule.action (** [hide_package_contents pack_name] Don't treat the given package as an open package. diff -aur original/ocaml_specific.ml patched/ocaml_specific.ml --- original/ocaml_specific.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/ocaml_specific.ml 2010-01-24 19:24:23.000000000 +0100 @@ -50,11 +50,16 @@ let ext_lib = !Options.ext_lib;; let ext_obj = !Options.ext_obj;; let ext_dll = !Options.ext_dll;; +let ext_java_lib = !Options.ext_java_lib;; +let ext_java_obj = !Options.ext_java_obj;; +let ext_java_dll = !Options.ext_java_dll;; let x_o = "%"-.-ext_obj;; let x_a = "%"-.-ext_lib;; let x_dll = "%"-.-ext_dll;; let x_p_o = "%.p"-.-ext_obj;; let x_p_a = "%.p"-.-ext_lib;; +let x_jo = "%"-.-ext_java_obj;; +let x_jar = "%"-.-ext_java_lib;; rule "target files" ~dep:"%.itarget" @@ -117,6 +122,12 @@ ~deps:["%.mlpack"; "%.cmi"] (Ocaml_compiler.native_pack_mlpack "%.mlpack" "%.cmx");; +rule "ocaml: mlpack & cmi & cmj* & jo* -> cmx & jo" + ~tags:["ocaml"; "java"] + ~prods:["%.cmj"; x_jo(* no cmi here you must make the byte version to have it *)] + ~deps:["%.mlpack"; "%.cmi"] + (Ocaml_compiler.java_pack_mlpack "%.mlpack" "%.cmj");; + rule "ocaml: ml & cmi -> p.cmx & p.o" ~tags:["ocaml"; "native"; "profile"] ~prods:["%.p.cmx"; x_p_o] @@ -129,6 +140,12 @@ ~deps:["%.ml"; "%.ml.depends"; "%.cmi"] (Ocaml_compiler.native_compile_ocaml_implem "%.ml");; +rule "ocaml: ml & cmi -> cmj & jo" + ~tags:["ocaml"; "java"] + ~prods:["%.cmj"; x_jo] + ~deps:["%.ml"; "%.ml.depends"; "%.cmi"] + (Ocaml_compiler.java_compile_ocaml_implem "%.ml");; + rule "ocaml: ml -> d.cmo & cmi" ~tags:["ocaml"; "debug"] ~prods:["%.d.cmo"] @@ -165,6 +182,12 @@ ~deps:["%.cmx"; x_o] (Ocaml_compiler.native_link "%.cmx" "%.native");; +rule "ocaml: cmj* & jo* -> jar" + ~tags:["ocaml"; "java"; "program"] + ~prod:"%-standalone.jar" + ~deps:["%.cmj"; x_jo] + (Ocaml_compiler.java_link "%.cmj" "%-standalone.jar");; + rule "ocaml: mllib & d.cmo* -> d.cma" ~tags:["ocaml"; "byte"; "debug"; "library"] ~prod:"%.d.cma" @@ -195,6 +218,12 @@ ~dep:"%(path)lib%(libname).clib" (C_tools.link_C_library "%(path)lib%(libname).clib" ("%(path)lib%(libname)"-.-ext_lib) "%(path)%(libname)");; +rule "ocaml: mllib & cmj* & jo* -> cmja & jar" + ~tags:["ocaml"; "java"; "library"] + ~prods:["%.cmja"; x_jar] + ~dep:"%.mllib" + (Ocaml_compiler.java_library_link_mllib "%.mllib" "%.cmja");; + rule "ocaml: mllib & p.cmx* & p.o* -> p.cmxa & p.a" ~tags:["ocaml"; "native"; "profile"; "library"] ~prods:["%.p.cmxa"; x_p_a] @@ -207,6 +236,12 @@ ~dep:"%.mllib" (Ocaml_compiler.native_library_link_mllib "%.mllib" "%.cmxa");; +rule "ocaml: cmj* & jo* -> cmja & jar" + ~tags:["ocaml"; "java"; "library"] + ~prods:["%.cmja"; x_jar] + ~deps:["%.cmj"; x_jo] + (Ocaml_compiler.java_library_link "%.cmj" "%.cmja");; + rule "ocaml: p.cmx* & p.o* -> p.cmxa & p.a" ~tags:["ocaml"; "native"; "profile"; "library"] ~prods:["%.p.cmxa"; x_p_a] @@ -357,6 +392,10 @@ S (List.map (fun x -> A (x^".cmxa")) !Options.ocaml_libs) end;; +flag ["ocaml"; "java"; "link"] begin + S (List.map (fun x -> A (x^".cmja")) !Options.ocaml_libs) +end;; + let camlp4_flags camlp4s = List.iter begin fun camlp4 -> flag ["ocaml"; "pp"; camlp4] (A camlp4) @@ -395,6 +434,7 @@ A"-I"; A"+camlp4/Camlp4Filters"]);; flag ["ocaml"; "use_camlp4_bin"; "link"; "byte"] (A"+camlp4/Camlp4Bin.cmo");; flag ["ocaml"; "use_camlp4_bin"; "link"; "native"] (A"+camlp4/Camlp4Bin.cmx");; +flag ["ocaml"; "use_camlp4_bin"; "link"; "java"] (A"+camlp4/Camlp4Bin.cmj");; flag ["ocaml"; "debug"; "compile"; "byte"] (A "-g");; flag ["ocaml"; "debug"; "link"; "byte"; "program"] (A "-g");; @@ -415,6 +455,7 @@ flag ["ocaml"; "compile"; "profile"; "native"] (A "-p");; flag ["ocaml"; "compile"; "thread"] (A "-thread");; flag ["ocaml"; "doc"; "thread"] (S[A"-I"; A"+threads"]);; +flag ["ocaml"; "link"; "thread"; "java"; "program"] (S[A "threads.cmja"; A "-thread"]);; flag ["ocaml"; "link"; "thread"; "native"; "program"] (S[A "threads.cmxa"; A "-thread"]);; flag ["ocaml"; "link"; "thread"; "byte"; "program"] (S[A "threads.cma"; A "-thread"]);; flag ["ocaml"; "link"; "thread"; "native"; "toplevel"] (S[A "threads.cmxa"; A "-thread"]);; diff -aur original/ocaml_utils.ml patched/ocaml_utils.ml --- original/ocaml_utils.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/ocaml_utils.ml 2010-01-24 19:15:44.000000000 +0100 @@ -96,7 +96,7 @@ try Hashtbl.find libraries m with Not_found -> [] let use_lib m lib = Hashtbl.replace libraries m (lib :: libraries_of m) -let ocaml_lib ?(extern=false) ?(byte=true) ?(native=true) ?dir ?tag_name libpath = +let ocaml_lib ?(extern=false) ?(byte=true) ?(native=true) ?(java=true) ?dir ?tag_name libpath = let add_dir x = match dir with | Some dir -> S[A"-I"; P dir; x] @@ -117,9 +117,11 @@ flag_and_dep ["ocaml"; tag_name; "link"; "byte"] (libpath^".cma"); if native then flag_and_dep ["ocaml"; tag_name; "link"; "native"] (libpath^".cmxa"); + if java then + flag_and_dep ["ocaml"; tag_name; "link"; "java"] (libpath^".cmja"); end else begin - if not byte && not native then - invalid_arg "ocaml_lib: ~byte:false or ~native:false only works with ~extern:true"; + if not byte && not native && not java then + invalid_arg "ocaml_lib: ~byte:false or ~native:false or ~java:false only works with ~extern:true"; end; match dir with | None -> () diff -aur original/ocaml_utils.mli patched/ocaml_utils.mli --- original/ocaml_utils.mli 2010-02-06 18:26:58.000000000 +0100 +++ patched/ocaml_utils.mli 2009-08-27 21:10:56.000000000 +0200 @@ -38,6 +38,7 @@ ?extern:bool -> ?byte:bool -> ?native:bool -> + ?java:bool -> ?dir:Pathname.t -> ?tag_name:string -> Pathname.t -> unit diff -aur original/ocamlbuild.ml patched/ocamlbuild.ml --- original/ocamlbuild.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/ocamlbuild.ml 2009-08-27 21:16:22.000000000 +0200 @@ -11,5 +11,6 @@ (* Original author: Nicolas Pouillard *) -Ocamlbuild_unix_plugin.setup (); +if not (Filename.check_suffix Sys.executable_name ".jar") then + Ocamlbuild_unix_plugin.setup (); Ocamlbuild_pack.Main.main () diff -aur original/options.ml patched/options.ml --- original/options.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/options.ml 2010-01-24 19:14:21.000000000 +0100 @@ -12,7 +12,7 @@ (* Original author: Nicolas Pouillard *) -let version = "ocamlbuild "^(Sys.ocaml_version);; +let version = "ocamlbuild "^(Sys.ocaml_version)^" [ocamljava version]";; type command_spec = Command.spec @@ -33,38 +33,52 @@ let plugin = ref true let just_plugin = ref false let native_plugin = ref true +let java_plugin = ref (Filename.check_suffix Sys.executable_name ".jar") let make_links = ref true let nostdlib = ref false let use_menhir = ref false let catch_errors = ref true +let java = ref "java" + let mk_virtual_solvers = let dir = Ocamlbuild_where.bindir in List.iter begin fun cmd -> - let opt = cmd ^ ".opt" in - let a_opt = A opt in - let a_cmd = A cmd in let search_in_path = memo Command.search_in_path in - let solver () = + let try_solve suffix launcher = if sys_file_exists !dir then - let long = filename_concat !dir cmd in - let long_opt = long ^ ".opt" in - if sys_file_exists long_opt then A long_opt - else if sys_file_exists long then A long - else try let _ = search_in_path opt in a_opt - with Not_found -> a_cmd - else - try let _ = search_in_path opt in a_opt - with Not_found -> a_cmd + let long = (filename_concat !dir cmd) ^ suffix in + if sys_file_exists long then + S(launcher @ [A long]) + else + raise Not_found + else begin + ignore (search_in_path (cmd ^ suffix)); + S(launcher @ [A (cmd ^ suffix)]) + end in + let solver () = + let java_launcher = [A(!java); A"-jar"] in + let no_launcher = [] in + List.fold_left + (fun acc (suffix, launcher) -> + try + try_solve suffix launcher + with Not_found -> acc) + (A cmd) + [ (".jar", java_launcher) ; + ("-standalone.jar", java_launcher) ; + ("", no_launcher) ; + (".opt", no_launcher) ] in Command.setup_virtual_command_solver (String.uppercase cmd) solver end let () = mk_virtual_solvers - ["ocamlc"; "ocamlopt"; "ocamldep"; "ocamldoc"; + ["ocamlc"; "ocamlopt"; "ocamljava"; "ocamldep"; "ocamldoc"; "ocamlyacc"; "menhir"; "ocamllex"; "ocamlmklib"; "ocamlmktop"] let ocamlc = ref (V"OCAMLC") let ocamlopt = ref (V"OCAMLOPT") +let ocamljava = ref (V"OCAMLJAVA") let ocamldep = ref (V"OCAMLDEP") let ocamldoc = ref (V"OCAMLDOC") let ocamlyacc = ref N @@ -80,6 +94,9 @@ let ext_obj = ref Ocamlbuild_Myocamlbuild_config.o let ext_dll = ref Ocamlbuild_Myocamlbuild_config.so let exe = ref Ocamlbuild_Myocamlbuild_config.exe +let ext_java_lib = ref "jar" +let ext_java_obj = ref "jo" +let ext_java_dll = ref "jar" let targets_internal = ref [] let ocaml_libs_internal = ref [] @@ -165,7 +182,8 @@ "-no-stdlib", Set nostdlib, " Don't ignore stdlib modules"; "-dont-catch-errors", Clear catch_errors, " Don't catch and display exceptions (useful to display the call stack)"; "-just-plugin", Set just_plugin, " Just build myocamlbuild.ml"; - "-byte-plugin", Clear native_plugin, " Don't use a native plugin but bytecode"; + "-byte-plugin", Unit (fun () -> native_plugin := false; java_plugin := false), " Don't use a native/java plugin but bytecode"; + "-native-plugin", Clear java_plugin, " Don't use a java plugin but native"; "-sanitization-script", Set_string sanitization_script, " Change the file name for the generated sanitization script"; "-no-sanitize", Clear sanitize, " Do not generate sanitization script"; "-nothing-should-be-rebuilt", Set nothing_should_be_rebuilt, " Fail if something needs to be rebuilt"; @@ -182,6 +200,7 @@ "-ocamlc", set_cmd ocamlc, " Set the OCaml bytecode compiler"; "-ocamlopt", set_cmd ocamlopt, " Set the OCaml native compiler"; + "-ocamljava", set_cmd ocamljava, " Set the OCaml java compiler"; "-ocamldep", set_cmd ocamldep, " Set the OCaml dependency tool"; "-ocamlyacc", set_cmd ocamlyacc, " Set the ocamlyacc tool"; "-menhir", set_cmd ocamlyacc, " Set the menhir tool (use it after -use-menhir)"; @@ -190,6 +209,7 @@ (* "-ocamlmklib", set_cmd ocamlmklib, " Set the ocamlmklib tool"; *) "-ocamlmktop", set_cmd ocamlmktop, " Set the ocamlmktop tool"; "-ocamlrun", set_cmd ocamlrun, " Set the ocamlrun tool"; + "-java", Set_string java, " Set the java tool"; "--", Rest (fun x -> program_to_execute := true; add_to' program_args_internal x), " Stop argument processing, remaining arguments are given to the user program"; diff -aur original/plugin.ml patched/plugin.ml --- original/plugin.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/plugin.ml 2010-01-24 20:55:27.000000000 +0100 @@ -24,6 +24,7 @@ module Make(U:sig end) = struct let plugin = "myocamlbuild" + let plugin_suffix = if !Options.java_plugin then ".jar" else !Options.exe let plugin_file = plugin^".ml" let plugin_config_file = plugin^"_config.ml" let plugin_config_file_interface = plugin^"_config.mli" @@ -69,15 +70,14 @@ else P plugin_config_file else N in let cma, cmo, more_options, compiler = - if !Options.native_plugin then + if !Options.java_plugin then + "cmja", "cmj", S[A"-standalone"; A"-java-package"; A"ocaml.tools.ocamlbuild.plugin"], !Options.ocamljava + else if !Options.native_plugin then "cmxa", "cmx", (if profiling then A"-p" else N), !Options.ocamlopt else "cma", "cmo", (if debugging then A"-g" else N), !Options.ocamlc in let ocamlbuildlib, ocamlbuild, libs = - if (not !Options.native_plugin) && !*My_unix.is_degraded then - "ocamlbuildlightlib", "ocamlbuildlight", N - else "ocamlbuildlib", "ocamlbuild", A("unix"-.-cma) in let ocamlbuildlib = ocamlbuildlib-.-cma in @@ -89,7 +89,7 @@ let cmd = Cmd(S[compiler; A"-I"; P dir; libs; more_options; P(dir/ocamlbuildlib); plugin_config; P plugin_file; - P(dir/ocamlbuild); A"-o"; Px (plugin^(!Options.exe))]) + P(dir/ocamlbuild); A"-o"; Px (plugin ^ plugin_suffix)]) in Shell.chdir !Options.build_dir; Shell.rm_f (plugin^(!Options.exe)); @@ -103,8 +103,13 @@ Shell.chdir Pathname.pwd; if not !Options.just_plugin then let runner = if !Options.native_plugin then N else !Options.ocamlrun in - let spec = S[runner; P(!Options.build_dir/plugin^(!Options.exe)); - A"-no-plugin"; atomize (List.tl (Array.to_list Sys.argv))] in + let spec = + if !Options.java_plugin then + S[A(!Options.java); A"-jar"; P(!Options.build_dir/(plugin ^ plugin_suffix)); + A"-no-plugin"; atomize (List.tl (Array.to_list Sys.argv))] + else + S[runner; P(!Options.build_dir/plugin); + A"-no-plugin"; atomize (List.tl (Array.to_list Sys.argv))] in let () = Log.finish () in raise (Exit_silently_with_code (sys_command (Command.string_of_command_spec spec))) end diff -aur original/report.ml patched/report.ml --- original/report.ml 2010-02-06 18:26:58.000000000 +0100 +++ patched/report.ml 2009-08-27 21:16:20.000000000 +0200 @@ -18,7 +18,7 @@ open Format open Solver -let sources_glob = Glob.parse "<*.ml> or <*.mli> or <*.c> or <*.h>";; +let sources_glob = Glob.parse "<*.ml> or <*.mli> or <*.c> or <*.h> or <*.java>";; let rec analyze f bt = match bt with diff -aur original/signatures.mli patched/signatures.mli --- original/signatures.mli 2010-02-06 18:26:58.000000000 +0100 +++ patched/signatures.mli 2010-01-24 19:07:39.000000000 +0100 @@ -358,11 +358,13 @@ val nothing_should_be_rebuilt : bool ref val ocamlc : command_spec ref val ocamlopt : command_spec ref + val ocamljava : command_spec ref val ocamldep : command_spec ref val ocamldoc : command_spec ref val ocamlyacc : command_spec ref val ocamllex : command_spec ref val ocamlrun : command_spec ref + val java : string ref val ocamlmklib : command_spec ref val ocamlmktop : command_spec ref val hygiene : bool ref @@ -372,6 +374,7 @@ val plugin : bool ref val just_plugin : bool ref val native_plugin : bool ref + val java_plugin : bool ref val make_links : bool ref val nostdlib : bool ref val program_to_execute : bool ref @@ -398,6 +401,9 @@ val ext_lib : string ref val ext_dll : string ref val exe : string ref + val ext_java_obj : string ref + val ext_java_lib : string ref + val ext_java_dll : string ref end module type ARCH = sig @@ -564,6 +570,7 @@ ?extern:bool -> ?byte:bool -> ?native:bool -> + ?java:bool -> ?dir:Pathname.t -> ?tag_name:string -> Pathname.t -> unit