Permalink
Browse files

Merge branch 'master' of https://github.com/MLstate/opalang

  • Loading branch information...
2 parents 5fa634a + ee7b436 commit b0668a0d7f140a9f5a34368282a4d76d04e16a53 @mattgu74 committed Nov 8, 2011
Showing with 1,880 additions and 423 deletions.
  1. +25 −1 Makefile
  2. +3 −2 build/myocamlbuild_prefix.ml
  3. +144 −49 build_rules.ml
  4. +2 −0 compilerlib/objectFiles.ml
  5. +5 −0 compilerlib/objectFiles.mli
  6. +1 −1 dependencies/installation_helper.sh
  7. +1 −1 libbase/mlstate_platform.ml
  8. +1 −3 libbsl/bslInterface.ml
  9. +1 −1 libbsl/bslJsConf.ml
  10. +30 −1 libbsl/bslRegisterLib.ml
  11. +3 −0 libbsl/bslRegisterLib.mli
  12. +7 −51 libbsl/bslregister.ml
  13. +41 −10 opa/pass_BslLoading.ml
  14. +0 −2 opabsl/jsbsl/bsl-sources
  15. +0 −4 opabsl/mlbsl/bsl-sources
  16. +1 −0 opacapi/opacapi.ml
  17. +31 −25 opadoc/common/opaDocComment.opa
  18. +1 −1 opadoc/common/opaDocParameters.opa
  19. +25 −3 opadoc/common/opaDocUtils.opa
  20. +2 −1 opadoc/generator/opaApiFile.opa
  21. +1 −1 opadoc/generator/opaDoc.opa
  22. +56 −1 opadoc/generator/opaDocHtml.opa
  23. +4 −1 opadoc/generator/opaDocJoin.opa
  24. +4 −2 opadoc/generator/opaDocTree.opa
  25. +3 −1 opadoc/opadoc.js
  26. +41 −11 opalang/syntax/opa_parser.trx
  27. +11 −0 opalang/syntax/parser_utils.ml
  28. +2 −0 opalang/syntax/parser_utils.mli
  29. +6 −2 plugins/_tags
  30. +2 −0 plugins/browser_canvas/browser_canvas.opa_plugin
  31. +1 −0 {opabsl/jsbsl → plugins/browser_canvas}/bslCanvas.js
  32. +2 −0 plugins/browser_canvas/jschecker_browser_canvas.js
  33. 0 {opabsl/jsbsl → plugins/crypto}/bslCrypto.js
  34. 0 {opabsl/mlbsl → plugins/crypto}/bslCrypto.ml
  35. +2 −0 plugins/crypto/crypto.opa_plugin
  36. +1 −0 plugins/irc/_tags
  37. +30 −0 plugins/irc/bslIrc.ml
  38. +1 −0 plugins/irc/irc.opa_plugin
  39. +1 −0 plugins/socket/_tags
  40. +5 −0 {opabsl/mlbsl → plugins/socket}/bslSocket.ml
  41. +1 −0 plugins/socket/socket.opa_plugin
  42. +1 −0 plugins/unix/_tags
  43. +15 −3 {opabsl/mlbsl → plugins/unix}/bslUnix.ml
  44. +1 −0 plugins/unix/unix.opa_plugin
  45. +14 −0 stdlib/all_plugins.sh
  46. +1 −5 stdlib/apis/facebook/rest/rest.opa
  47. +1 −0 stdlib/apis/irc/irc.opa
  48. +275 −105 stdlib/components/calendar/calendar.opa
  49. +26 −13 stdlib/components/calendar/calendar_controls.opa
  50. +1 −0 stdlib/components/calendar/calendar_meshup.opa
  51. +63 −0 stdlib/components/fragment/fragment.opa
  52. +4 −5 stdlib/core/date/date.opa
  53. +1 −1 stdlib/core/web/core/uri.opa
  54. +6 −0 stdlib/core/web/resource/resource.opa
  55. +1 −0 stdlib/core/web/server/server_private.opa
  56. +3 −0 stdlib/core/xhtml/dom.opa
  57. +81 −11 stdlib/core/xhtml/xhtml.opa
  58. +2 −0 stdlib/crypto/crypto.opa
  59. +4 −0 stdlib/extract-import-plugin.sh
  60. +2 −0 stdlib/io/socket/socket.opa
  61. +14 −0 stdlib/system/system.opa
  62. +26 −25 stdlib/tools/markdown/markdown.opa
  63. +3 −2 stdlib/{core/xhtml → web/canvas}/canvas.opa
  64. +4 −1 stdlib/web/mail/email.opa
  65. +605 −0 stdlib/widgets/bootstrap/bootstrap.opa
  66. +1 −0 stdlib/widgets/chart/bar.opa
  67. +203 −77 stdlib/widgets/formbuilder/formbuilder.opa
  68. +24 −0 stdlib/widgets/select/select.opa
View
@@ -83,7 +83,17 @@ define install-package
@$(INSTALL) $(BUILD_DIR)/$*.opx/_build/*.cmxa "$(STDLIB_DIR)/$*.opx/_build/"
endef
+define install-plugin
+@printf "Installing into $(STDLIB_DIR)/$*.opp^[[K\r"
+@mkdir -p "$(STDLIB_DIR)/$*.opp"
+@$(INSTALL) $(BUILD_DIR)/$*.opp/*.bypass "$(STDLIB_DIR)/$*.opp/";
+@$(INSTALL) $(BUILD_DIR)/$*.opp/*MLRuntime.* "$(STDLIB_DIR)/$*.opp/";
+endef
+
+
+
OPA_PACKAGES := $(shell cd stdlib && ./all_packages.sh)
+OPA_PLUGINS := $(shell cd stdlib && ./all_plugins.sh)
# Rules installing everything that has been compiled
#
@@ -109,6 +119,20 @@ install-packages: $(addprefix install-packageopt-,$(OPA_PACKAGES))
install-all-packages: $(addprefix install-package-,$(OPA_PACKAGES))
@printf "Installation to $(STDLIB_DIR) done.\n"
+install-pluginopt-%:
+ $(if $(wildcard $(BUILD_DIR)/$*.opp/),$(install-plugin))
+
+install-plugin-%:
+ $(install-plugin)
+
+install-plugins: $(addprefix install-pluginopt-,$(OPA_PLUGINS))
+ @printf "Installation to $(STDLIB_DIR) done.\n"
+
+install-all-plugins: $(addprefix install-plugin-,$(OPA_PLUGINS))
+ @printf "Installation to $(STDLIB_DIR) done.\n"
+
+
+
install-bin:
@printf "Installing into $(INSTALL_DIR)/bin\r"
@mkdir -p $(INSTALL_DIR)/bin
@@ -136,7 +160,7 @@ install-doc:
fi
@printf "Installation to $(INSTALL_DIR)/share/doc/opa done.\n"
-install: install-bin install-lib install-share install-packages install-doc
+install: install-bin install-lib install-share install-plugins install-packages install-doc
@printf "Installation into $(INSTALL_DIR) done.\n"
.PHONY: uninstall
@@ -431,6 +431,7 @@ let _ = dispatch begin function
~prods:["%.ml"; "%.mli"]
(trx_build "%" N);
+
(* -- Macro-rules generating ML files -- *)
(* aspell custom dictionnary *)
@@ -476,11 +477,11 @@ let _ = dispatch begin function
| Not_found -> false
) in
(if cond then (A a)::acc else acc) in
- List.fold_left fold []
+ List.fold_left fold [A"--js-validator-off"] (* until bsl is a standard plugin *)
[
("bsl_debug", "-debug");
("bsl_unsafe", "-unsafe") ;
- ("bsl_no_js_validator", "--no-js-validator");
+ ("bsl_no_js_validator", "--js-validator-off");
]
in
View
@@ -299,9 +299,110 @@ rule "mlidl: mlidl -> types.ml & types.mli"
; P (env "%.mlidl")
]));
-(* -- BSL compilation (using bslregister) -- *)
+(* -- js validation -- *)
+(*
+ TODO: enable all of them as soon as possible.
+*)
+let google_closure_compiler_options =
+ A"--warning_level" :: A"VERBOSE"::
+ (*
+ Turn on every available warning as errors.
+ Keep synchronized with the checker.
+ *)
+ (
+ List.fold_left (fun acc s -> A"--jscomp_error" :: A s :: acc)
+ [] [
+ "accessControls" ;
+ "checkRegExp" ;
+ (* "checkTypes" ; *)
+ "checkVars" ;
+ "deprecated" ;
+ "fileoverviewTags" ;
+ "invalidCasts" ;
+ "missingProperties" ;
+ (* "nonStandardJsDocs" ; *)
+ "strictModuleDepCheck" ;
+ "undefinedVars" ;
+ "unknownDefines" ;
+ "visibility" ;
+ ]
+ )
+in
+
+let js_checker =
+ let local = windows_mode in
+ A"java" :: A"-jar" :: (get_tool ~local "jschecker.jar") ::
+(* A"--externs" :: (get_tool ~local "jschecker_externals.js") ::
+ A"--externs" :: (get_tool ~local "jschecker_jquery.js") ::
+ A"--externs" :: (get_tool ~local "jschecker_clientliblib.js") ::
+ A"--js_output_file" :: A output_file :: *)
+ google_closure_compiler_options (*@
+ A"--js" :: A clientlib ::
+ A"--js" :: A "opabsl/jsbsl/jquery_ext_bslanchor.extern.js" ::
+ A"--js" :: A "opabsl/jsbsl/jquery_ext_jQueryExtends.extern.js" ::
+ A"--js" :: A "opabsl/jsbsl/selection_ext_bsldom.extern.js" ::
+ A"--js" :: A "opabsl/jsbsl/jquery_extra.externs.js" ::
+ A"--js" :: A"qmlcps/qmlCpsClientLib.js" ::
+ []*)
+in
+
+(* -- opa plugin -- *)
+(* -- plugin that fails to validate -- *)
+let accept_js_validation_failure = []
+in
+(* -- file that are only needed for validation process -- *)
+let jschecker_file s =
+ let prefix = "jschecker_" in
+ try String.sub (Pathname.basename s) 0 (String.length prefix) = prefix with _ -> false
+in
+let use_tag s =
+ let lenp = String.length "use_" in
+ let t = try String.sub s 0 lenp = "use_" with _ -> false in
+ if t then Some(String.sub s lenp ((String.length s) -lenp))
+ else None
+in
+let opa_plugin_builder_name = "opa-plugin-builder-bin" in
+let opa_plugin_builder = get_tool opa_plugin_builder_name in
+let opp_build opa_plugin opp oppf env build =
+ let dir = Pathname.dirname (env opa_plugin) in
+ let path = let p = Pathname.to_string dir in if p = "." then "" else p^"/" in
+ let files = string_list_of_file (env "%.opa_plugin") in
+ let caml_use_lib = Tags.fold (fun tag list ->
+ match use_tag tag with
+ | None -> list
+ | Some dep -> dep::list
+ ) (tags_of_pathname (env "%.opa_plugin")) []
+ in
+ let lib_dir s = [A"--ml";A"-I";A"--ml";P (if Pathname.exists s then ".." / s else ("+"^s))] in
+ let include_dirs = List.flatten (List.map lib_dir caml_use_lib) in
+ let files = List.map ((^) path) files in
+ build_list build files;
+ let files_validation, files_lib = List.partition jschecker_file files in
+ let files_lib = List.map (fun s -> P s) files_lib in
+ let plugin_name = Pathname.basename (env "%") in
+ let files_js = List.filter (fun f-> Pathname.check_extension f "js") files in
+ let js_validation = if files_js=[]
+ then [A"--js-validator-off"]
+ else (
+ let files_validation = List.flatten (List.map (fun s -> [A"--js-validator-file";P s]) files_validation) in
+ let unsafe_js = if List.mem plugin_name accept_js_validation_failure then [A"--unsafe-js"] else [] in
+ let js_checker = List.tl (List.flatten (List.map (fun opt -> [A"--js-validator-opt";opt]) js_checker)) in
+ unsafe_js @ [A"--js-validator"] @ js_checker @ files_validation
+ )
+ in
+ let options = [A"--static" ; A"-o" ; P((Pathname.basename (env opp)))] @ include_dirs @ js_validation @ files_lib in
+ Seq[Cmd(S(opa_plugin_builder::options));
+ Cmd(S[A"touch"; P(env oppf) ] )]
+in
+rule "opa_plugin_dir: opa_plugin -> oppf"
+ ~deps:("%.opa_plugin" :: (tool_deps opa_plugin_builder_name))
+ ~prod:"%.oppf" (* use a dummy target because ocamlbuild don't want directory target *)
+ (opp_build "%.opa_plugin" "%" "%oppf")
+;
+
+(* -- BSL compilation (using bslregister) -- *)
let ml_sources_bsl = dir_sources_bsl "opabsl/mlbsl" in
let js_sources_bsl = dir_sources_bsl "opabsl/jsbsl" in
let js_dest_bsl = dir_sources_bsl ~prefix:"opabslgen_" "opabsl/jsbsl" in
@@ -377,35 +478,6 @@ rule "preprocess JS files for validation"
Cmd(S (ppjs::A"--output-suffix"::A ".pp"::List.map (fun x -> A x) js_dest_bsl))
);
-(*
- TODO: enable all of them as soon as possible.
-*)
-let google_closure_compiler_options =
- A"--warning_level" :: A"VERBOSE"::
- (*
- Turn on every available warning as errors.
- Keep synchronized with the checker.
- *)
- (
- List.fold_left (fun acc s -> A"--jscomp_error" :: A s :: acc)
- [] [
- "accessControls" ;
- "checkRegExp" ;
- (* "checkTypes" ; *)
- "checkVars" ;
- "deprecated" ;
- "fileoverviewTags" ;
- "invalidCasts" ;
- "missingProperties" ;
- (* "nonStandardJsDocs" ; *)
- "strictModuleDepCheck" ;
- "undefinedVars" ;
- "unknownDefines" ;
- "visibility" ;
- ]
- ) in
-
-
rule "Client lib JS validation"
~deps: (
"qmljsimp/qmlJsImpClientLib.js" ::
@@ -427,20 +499,19 @@ rule "Client lib JS validation"
[
Cmd(S [Sh"mkdir"; A"-p";P "opabsl/js_validation"]);
Cmd(S(
- A"java" :: A"-jar" :: (get_tool ~local "jschecker.jar") ::
- A"--externs" :: (get_tool ~local "jschecker_externals.js") ::
- A"--externs" :: (get_tool ~local "jschecker_jquery.js") ::
- A"--externs" :: (get_tool ~local "jschecker_clientliblib.js") ::
- A"--js_output_file" :: A output_file ::
- google_closure_compiler_options @
- A"--js" :: A clientlib ::
- A"--js" :: A "opabsl/jsbsl/jquery_ext_bslanchor.extern.js" ::
- A"--js" :: A "opabsl/jsbsl/jquery_ext_jQueryExtends.extern.js" ::
- A"--js" :: A "opabsl/jsbsl/selection_ext_bsldom.extern.js" ::
- A"--js" :: A "opabsl/jsbsl/jquery_extra.externs.js" ::
- A"--js" :: A"qmlcps/qmlCpsClientLib.js" ::
- []
- ))
+ js_checker @
+ A"--externs" :: (get_tool ~local "jschecker_externals.js") ::
+ A"--externs" :: (get_tool ~local "jschecker_jquery.js") ::
+ A"--externs" :: (get_tool ~local "jschecker_clientliblib.js") ::
+ A"--js_output_file" :: A output_file ::
+ A"--js" :: A clientlib ::
+ A"--js" :: A "opabsl/jsbsl/jquery_ext_bslanchor.extern.js" ::
+ A"--js" :: A "opabsl/jsbsl/jquery_ext_jQueryExtends.extern.js" ::
+ A"--js" :: A "opabsl/jsbsl/selection_ext_bsldom.extern.js" ::
+ A"--js" :: A "opabsl/jsbsl/jquery_extra.externs.js" ::
+ A"--js" :: A"qmlcps/qmlCpsClientLib.js" ::
+ []
+ ))
]
in
Seq (
@@ -484,7 +555,7 @@ rule "opa-bslgenMLRuntime JS validation"
A"--externs" :: A "opabsl/jsbsl/jquery_ext_jQueryExtends.extern.js" ::
A"--externs" :: A "opabsl/jsbsl/selection_ext_bsldom.extern.js" ::
A"--externs" :: A "opabsl/jsbsl/jquery_extra.externs.js" ::
- A"--js_output_file" :: A"opabsl/js_validation/bsl.js" ::
+ A"--js_output_file" :: A "opabsl/js_validation/bsl.js" ::
google_closure_compiler_options @
(List.fold_right (fun s acc -> arg_of_file s acc) js_pp_bsl [])
@ [ A"--js" ; A "opabsl/opabslgenJSkeys.js" ]
@@ -650,9 +721,15 @@ rule "opadep: .opa -> .opa.depends"
~dep: "%.opa"
~prod: "%.opa.depends"
(fun env build ->
- let dep_regex = "^ *import \\*\\(.\\+\\) *$" in
- Cmd(S[sed; A"-n"; A("s%"^dep_regex^"%\\1.opx%p"); P(env "%.opa");
- Sh">";P(env "%.opa.depends")]));
+ let dep_opx_regex = "^ *import \\*\\(.\\+\\) *$" in
+ let dep_opp_regex = "^ *import-plugin \\*\\(.\\+\\) *$" in
+ let sed_dep dep_regex redir dest = S[sed; A"-n"; A("s%"^dep_regex^"%\\1.opx%p"); P(env "%.opa"); Sh redir; P dest] in
+ Seq[
+ Cmd(sed_dep dep_opp_regex ">" (env "%.opa.depends"));
+ Cmd(sed_dep dep_opx_regex ">>" (env "%.opa.depends"))
+ ]
+ )
+;
rule "opacomp: .opa -> .native"
~deps: ("%.opa"::"%.opa.depends"::"opacomp.stamp"::[])
@@ -733,13 +810,31 @@ rule "all.packages"
])
);
+let make_all_plugins = stdlib_packages_dir/"all_plugins.sh" in
+let all_plugins_file = stdlib_packages_dir/"all.plugins" in
+
+rule "all.plugins"
+ ~dep: make_all_plugins
+ ~prod: all_plugins_file
+ (fun env build ->
+ Cmd(S[
+ Sh"cd"; P (Pathname.pwd / stdlib_packages_dir); Sh"&&";
+ P"./all_plugins.sh"; Sh">"; P (Pathname.pwd / !Options.build_dir / all_plugins_file);
+ ])
+ );
+
+
+
let package_building ~name ~stamp ~stdlib_only ~rebuild =
rule name
- ~deps:[opacapi_validation;all_packages_file;"opacomp.stamp"]
+ ~deps:[opacapi_validation;all_plugins_file;all_packages_file;"opacomp.stamp"]
~stamp
~prod:"i_dont_exist" (* forces ocamlbuild to always run the command *)
(fun env build ->
try
+ let plugins = string_list_of_file all_plugins_file in
+ let plugins = List.map (fun f -> "plugins" / f / f -.- "oppf") plugins in
+ build_list build plugins;
let packages = string_list_of_file all_packages_file in
let packages =
if stdlib_only
@@ -1754,6 +1754,8 @@ let stdlib_package_names name =
let stdlib_packages (package_name,_pos) = stdlib_package_names package_name
+let get_paths () = !extrapaths
+
module Arg =
struct
module Arg = Base.Arg
@@ -89,6 +89,11 @@ val get_compilation_directory_or_current_dir : unit -> filename
val set_extrapaths : no_stdlib:bool -> filename list -> unit
(**
+ Get all paths where the compiler should search its objects
+*)
+val get_paths : unit -> filename list
+
+(**
Set plugins version, from the loaded plugins
*)
val set_bsl_plugins : (basename * hash) list -> unit
@@ -190,7 +190,7 @@ sources () {
camlidl) echo "http://caml.inria.fr/pub/old_caml_site/distrib/bazar-ocaml/camlidl-1.05.tar.gz";;
libnatpmp) echo "http://miniupnp.free.fr/files/download.php?file=libnatpmp-20110103.tar.gz";;
miniupnpc) echo "http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.5.20110418.tar.gz";;
- cairo-ocaml) echo "http://cgit.freedesktop.org/cairo-ocaml/snapshot/cairo-ocaml-master.tar.gz";;
+ cairo-ocaml) echo "http://cgit.freedesktop.org/cairo-ocaml/snapshot/cairo-ocaml-1.2.0.tar.gz";;
*) msg_red "Error: don't know about package $1" >&2; exit 2
esac
}
@@ -25,7 +25,7 @@ type mlstate_platform = Unix | Cygwin | Windows
(** the current platform value *)
let mlstate_platform = match Sys.os_type with
| "Unix" -> Unix
- | "Cywin" -> Cygwin
+ | "Cygwin" -> Cygwin
| "Windows"
| "Win32" -> Windows
| _ -> failwith ("mlstate_platform : unknown platform "^(Sys.os_type))
View
@@ -709,11 +709,9 @@ type options = {
of jsconf files.
*)
- js_syntax_checker : ( (executable * shell_options) * filename list ) option ;
js_validator : ( (executable * shell_options) * filename list ) option ;
(**
- The executable for performing syntax check.
- TODO(maxime) merge them both. Not in one year please.
+ The executable for performing js validation (syntax at least).
*)
ml_plugin_filename : filename ;
View
@@ -287,7 +287,7 @@ let parse_line pos files line =
FilePos.pp pos
message
in
- let filter s = Str.string_match regexp s 0 in
+ let filter s = Str.string_match regexp (Filename.basename s) 0 in
let files = List.rev_filter filter files in
if files = [] then
OManager.warning ~wclass:WarningClass.bsl_register (
Oops, something went wrong.

0 comments on commit b0668a0

Please sign in to comment.