-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathB0.ml
127 lines (113 loc) · 4.16 KB
/
B0.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
open B0_kit.V000
open Result.Syntax
(* OCaml library names *)
let unix = B0_ocaml.libname "unix"
let compiler_libs_toplevel = B0_ocaml.libname "compiler-libs.toplevel"
let rresult = B0_ocaml.libname "rresult"
let rresult_top = B0_ocaml.libname "rresult.top"
let astring = B0_ocaml.libname "astring"
let astring_top = B0_ocaml.libname "astring.top"
let fpath = B0_ocaml.libname "fpath"
let fpath_top = B0_ocaml.libname "fpath.top"
let fmt = B0_ocaml.libname "fmt"
let fmt_top = B0_ocaml.libname "fmt.tty"
let fmt_tty = B0_ocaml.libname "fmt.tty"
let logs = B0_ocaml.libname "logs"
let logs_fmt = B0_ocaml.libname "logs.fmt"
let logs_top = B0_ocaml.libname "logs.top"
let mtime = B0_ocaml.libname "mtime"
let mtime_clock = B0_ocaml.libname "mtime.clock"
let bos = B0_ocaml.libname "bos"
let bos_setup = B0_ocaml.libname "bos.setup"
let bos_top = B0_ocaml.libname "bos.top"
(* Libraries *)
let bos_lib =
let srcs =
Fpath.[ `Dir (v "src");
`X (v "src/bos_setup.ml");
`X (v "src/bos_setup.mli");
`X (v "src/bos_top.ml");
`X (v "src/bos_top_init.ml") ]
in
let requires = [astring; fpath; fmt; unix; logs]
in
B0_ocaml.lib bos ~doc:"The bos library" ~srcs ~requires
let bos_setup_lib =
let srcs = Fpath.[ `File (v "src/bos_setup.ml");
`File (v "src/bos_setup.mli") ]
in
let requires = [rresult; fmt_tty; logs_fmt; astring; fpath; logs; fmt; bos]
in
B0_ocaml.lib bos_setup ~doc:"The bos.setup library" ~srcs ~requires
let bos_top_lib =
let srcs = Fpath.[ `File (v "src/bos_top.ml") ] in
let requires =
[ rresult_top; astring_top; fpath_top; fmt_top; logs_top;
compiler_libs_toplevel]
in
B0_ocaml.lib bos_top ~doc:"The bos.top library" ~srcs ~requires
(* Tests *)
let test =
let srcs =
Fpath.[ `File (v "test/testing.mli");
`File (v "test/testing.ml");
`File (v "test/test.ml");
`File (v "test/test_cmd.ml");
`File (v "test/test_os_cmd.ml");
`File (v "test/test_pat.ml"); ]
in
let meta = B0_meta.(empty |> tag test) in
let requires = [ rresult; astring; fpath; logs_fmt; bos] in
B0_ocaml.exe "test" ~doc:"Test suite" ~srcs ~meta ~requires
let test_arg =
let srcs = Fpath.[ `File (v "test/test_arg.ml")] in
let meta = B0_meta.(empty |> tag test) in
let requires = [ astring; fmt; fpath; logs; logs_fmt; bos ] in
B0_ocaml.exe "test-arg" ~doc:"Test argument parsing" ~srcs ~meta ~requires
let test_arg_pos =
let srcs = Fpath.[ `File (v "test/test_arg_pos.ml")] in
let meta = B0_meta.(empty |> tag test) in
let requires = [ fmt; logs; logs_fmt; bos ] in
B0_ocaml.exe "test-arg-pos" ~doc:"Test argument parsing" ~srcs ~meta ~requires
let watch =
let srcs = Fpath.[`File (v "test/watch.ml")] in
let meta = B0_meta.(empty |> tag test) in
let requires =
[ unix; logs_fmt; fmt_tty; mtime; mtime_clock; rresult; fpath; bos;
bos_setup ]
in
B0_ocaml.exe "watch" ~doc:"Watch files for changes." ~srcs ~meta ~requires
(* Packs *)
let default =
let meta =
B0_meta.empty
|> B0_meta.(add authors) ["The bos programmers"]
|> B0_meta.(add maintainers)
["Daniel Bünzli <daniel.buenzl i@erratique.ch>"]
|> B0_meta.(add homepage) "https://erratique.ch/software/bos"
|> B0_meta.(add online_doc) "https://erratique.ch/software/bos/doc"
|> B0_meta.(add licenses) ["ISC"]
|> B0_meta.(add repo) "git+https://erratique.ch/repos/bos.git"
|> B0_meta.(add issues) "https://github.com/dbuenzli/bos/issues"
|> B0_meta.(add description_tags)
["os"; "system"; "cli"; "command"; "file"; "path"; "log"; "unix";
"org:erratique"]
|> B0_meta.tag B0_opam.tag
|> B0_meta.add B0_opam.depends
[ "ocaml", {|>= "4.08.0"|};
"ocamlfind", {|build|};
"ocamlbuild", {|build|};
"topkg", {|build & >= "1.0.3"|};
"base-unix", "";
"rresult", {|>= "0.7.0"|};
"astring", "";
"fpath", "";
"fmt", {|>= "0.8.10"|};
"logs", "";
"mtime", {|with-test|};
]
|> B0_meta.add B0_opam.build
{|[["ocaml" "pkg/pkg.ml" "build" "--dev-pkg" "%{dev}%"]]|}
in
B0_pack.make "default" ~doc:"bos package" ~meta ~locked:true @@
B0_unit.list ()