Skip to content
Newer
Older
100644 70 lines (57 sloc) 1.91 KB
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (* CF mli *)
19
20 (* depends *)
21 module List = Base.List
22 module String = Base.String
23 let (|>) = InfixOperator.(|>)
24
25 (* alias for Constructors and Fields *)
26 module O = OpaEnv
27
28 (* type alias, for readability *)
29 type filename = string
30
31 (* -- *)
32
33 (*
34 Filtering all the files from the stdlib.
35 WARNING: only used with --no-embedded-stdlib
36 In this case, the path starts with "stdlib" (see s3Passes.ml)
37 *)
38 let filtering_files path =
39 let kept =
40 (
41 String.is_suffix ".opa" path
42 )
43 in
44 let _ =
45 #<If:ADD_STDLIB$islevel 1> if not kept then OManager.printf "Rejecting : %S@." path #<End> ;
46 #<If:ADD_STDLIB$islevel 2> if kept then OManager.printf "Keeping : %S@." path #<End> ;
47 #<If:ADD_STDLIB$minlevel 3>
48 if not kept
49 then OManager.printf "Rejecting : %S@." path
50 else OManager.printf "Keeping : %S@." path
51 #<End>
52 in
53 kept
54
55 let folder acc path =
56 if filtering_files path then path::acc else acc
57
58 let of_basedir basedirs options =
59 if not options.O.stdlib then []
60 else (
61 let folder acc ~name:_ ~path = folder acc path in
62 List.fold_left (fun acc basedir -> acc @ (File.fold_dir_rec folder [] basedir)) [] basedirs
63 )
64
65 let of_static_include options =
66 if not options.O.stdlib then []
67 else (
68 List.fold_left folder [] StaticsInclude.file_list
69 )
Something went wrong with that request. Please try again.