From c6cf3fc71d23bbf15e4e54ab98b72e23d494cde8 Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Thu, 23 Jun 2016 13:08:26 +0200 Subject: [PATCH] [build] autoload of module recursively (#1760) * [build] autoload of module recursively --- sw/lib/ocaml/gen_common.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sw/lib/ocaml/gen_common.ml b/sw/lib/ocaml/gen_common.ml index 56a8fd6a26..d107ab0dbc 100644 --- a/sw/lib/ocaml/gen_common.ml +++ b/sw/lib/ocaml/gen_common.ml @@ -161,11 +161,15 @@ let get_module = fun m global_targets -> | _ -> Xml2h.xml_error "module, autoload or load" (** [get_autoloaded_modules module] - * Return a list of modules to be automaticaly added *) -let get_autoloaded_modules = fun m -> + * Return a list of modules to be automaticaly added + * Only works with actual modules (no subsystems) *) +let rec get_autoloaded_modules = fun m -> let m = get_module m (Var "") in List.fold_left (fun l t -> - if ExtXml.tag_is t "autoload" then (get_module t (Var "") :: l) else l + if ExtXml.tag_is t "autoload" then + let am = get_module t (Var "") in + (am :: ((try get_autoloaded_modules am.xml with _ -> []) @ l)) + else l ) [] (Xml.children m.xml) (** [test_targets target targets]