Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[fix] plugin: use _tag file to specify used lib of a plugin

some cleanup can be done now in plugin to remove some code duplication
still it cannot be used directly to specify dependencies between plugins
  • Loading branch information...
commit 813506870b18745dce01de5afed879cf4a1e1642 1 parent c7a2af0
@OpaOnWindowsNow OpaOnWindowsNow authored
View
26 build_rules.ml
@@ -353,12 +353,28 @@ 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
+ 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 opa_plugin_builder = get_tool "opa-plugin-builder-bin" in
- let path = let p = Pathname.to_string (Pathname.dirname (env opa_plugin)) in if p = "." then "" else p^"/" in
+ 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
@@ -374,12 +390,12 @@ let opp_build opa_plugin opp oppf env build =
unsafe_js @ [A"--js-validator"] @ js_checker @ files_validation
)
in
- let options = [A"-o" ; P((Pathname.basename (env opp)))] @ js_validation @ files_lib in
+ let options = [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"
- ~dep:"%.opa_plugin"
+ ~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")
;
View
1  plugins/irc/_tags
@@ -0,0 +1 @@
+<irc.opa_plugin>: use_libirc, use_appruntime
View
1  plugins/socket/_tags
@@ -0,0 +1 @@
+<socket.opa_plugin>: use_qmlcps, use_libsecurity, use_libnet, use_appruntime
View
1  plugins/unix/_tags
@@ -0,0 +1 @@
+<unix.opa_plugin>: use_qmlflat
Please sign in to comment.
Something went wrong with that request. Please try again.