Ignore test/ and example/ during bootstrap
This commit is contained in:
parent
4f0d733e25
commit
acb54677d4
|
@ -146,10 +146,10 @@ let load ~dir ~visible_packages ~closest_packages =
|
|||
; closest_packages
|
||||
}
|
||||
|
||||
let load () =
|
||||
let load ?(extra_ignored_subtrees=Path.Set.empty) () =
|
||||
let ftree = File_tree.load Path.root in
|
||||
let packages, ignored_subtrees =
|
||||
File_tree.fold ftree ~init:([], Path.Set.empty) ~f:(fun dir (pkgs, ignored) ->
|
||||
File_tree.fold ftree ~init:([], extra_ignored_subtrees) ~f:(fun dir (pkgs, ignored) ->
|
||||
let path = File_tree.Dir.path dir in
|
||||
let files = File_tree.Dir.files dir in
|
||||
let pkgs =
|
||||
|
@ -220,18 +220,14 @@ let load () =
|
|||
else
|
||||
jbuilds
|
||||
in
|
||||
let sub_dirs =
|
||||
if String_set.mem "jbuild-ignore" files then
|
||||
String_map.filter sub_dirs ~f:(fun _ dir ->
|
||||
not (Path.Set.mem (File_tree.Dir.path dir) ignored_subtrees))
|
||||
else
|
||||
sub_dirs
|
||||
in
|
||||
let children, jbuilds =
|
||||
String_map.fold sub_dirs ~init:([], jbuilds)
|
||||
~f:(fun ~key:_ ~data:dir (children, jbuilds) ->
|
||||
let child, jbuilds = walk dir jbuilds visible_packages closest_packages in
|
||||
(child :: children, jbuilds))
|
||||
if Path.Set.mem (File_tree.Dir.path dir) ignored_subtrees then
|
||||
(children, jbuilds)
|
||||
else
|
||||
let child, jbuilds = walk dir jbuilds visible_packages closest_packages in
|
||||
(child :: children, jbuilds))
|
||||
in
|
||||
(Alias.Node (path, children), jbuilds)
|
||||
in
|
||||
|
|
|
@ -13,4 +13,4 @@ type conf =
|
|||
; packages : Package.t String_map.t
|
||||
}
|
||||
|
||||
val load : unit -> conf
|
||||
val load : ?extra_ignored_subtrees:Path.Set.t -> unit -> conf
|
||||
|
|
19
src/main.ml
19
src/main.ml
|
@ -16,8 +16,10 @@ let package_install_file { packages; _ } pkg =
|
|||
let setup ?(log=Log.no_log) ?filter_out_optional_stanzas_with_missing_deps
|
||||
?workspace ?(workspace_file="jbuild-workspace")
|
||||
?(use_findlib=true)
|
||||
?only_packages () =
|
||||
let conf = Jbuild_load.load () in
|
||||
?only_packages
|
||||
?extra_ignored_subtrees
|
||||
() =
|
||||
let conf = Jbuild_load.load ?extra_ignored_subtrees () in
|
||||
Option.iter only_packages ~f:(fun set ->
|
||||
String_set.iter set ~f:(fun pkg ->
|
||||
if not (String_map.mem pkg conf.packages) then
|
||||
|
@ -131,6 +133,13 @@ let report_error ?map_fname ppf exn =
|
|||
let backtrace = Printexc.get_raw_backtrace () in
|
||||
report_error ?map_fname ppf exn ~backtrace
|
||||
|
||||
let ignored_during_bootstrap =
|
||||
Path.Set.of_list
|
||||
(List.map ~f:Path.of_string
|
||||
[ "test"
|
||||
; "example"
|
||||
])
|
||||
|
||||
(* Called by the script generated by ../build.ml *)
|
||||
let bootstrap () =
|
||||
Ansi_color.setup_err_formatter_colors ();
|
||||
|
@ -146,7 +155,9 @@ let bootstrap () =
|
|||
let log = Log.create () in
|
||||
Future.Scheduler.go ~log
|
||||
(setup ~log ~workspace:{ merlin_context = Some "default"; contexts = [Default] }
|
||||
~use_findlib:false ()
|
||||
~use_findlib:false
|
||||
~extra_ignored_subtrees:ignored_during_bootstrap
|
||||
()
|
||||
>>= fun { build_system = bs; _ } ->
|
||||
Build_system.do_build_exn bs [Path.(relative root) (pkg ^ ".install")])
|
||||
in
|
||||
|
@ -156,4 +167,4 @@ let bootstrap () =
|
|||
Format.eprintf "%a@?" (report_error ?map_fname:None) exn;
|
||||
exit 1
|
||||
|
||||
let setup = setup ~use_findlib:true
|
||||
let setup = setup ~use_findlib:true ~extra_ignored_subtrees:Path.Set.empty
|
||||
|
|
Loading…
Reference in New Issue