File: B0.ml

package info (click to toggle)
ocaml-bos 0.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 360 kB
  • sloc: ml: 2,765; makefile: 13
file content (129 lines) | stat: -rw-r--r-- 4,191 bytes parent folder | download | duplicates (2)
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
128
129
open B0_kit.V000
open B00_std
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_os = B0_ocaml.libname "mtime.clock.os"

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 = [rresult; 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

(* Tools *)

(* 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_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_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 =
    [ logs_fmt; fmt_tty; mtime; mtime_clock_os; rresult; fpath; bos; bos_setup ]
  in
  B0_ocaml.exe "watch" ~doc:"Watch files for changes." ~srcs ~meta ~requires

(* Packs *)

let default =
  let meta =
    let open B0_meta in
    empty
    |> add authors ["The bos programmers"]
    |> add maintainers ["Daniel Bünzli <daniel.buenzl i@erratique.ch>"]
    |> add homepage "https://erratique.ch/software/bos"
    |> add online_doc "https://erratique.ch/software/bos/doc"
    |> add licenses ["ISC"]
    |> add repo "git+https://erratique.ch/repos/bos.git"
    |> add issues "https://github.com/dbuenzli/bos/issues"
    |> add description_tags
      ["os"; "system"; "cli"; "command"; "file"; "path"; "log"; "unix";
       "org:erratique"]
    |> tag B0_opam.tag
    |> add B0_opam.Meta.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", {|test|};
      ]
    |> add B0_opam.Meta.build
      {|[["ocaml" "pkg/pkg.ml" "build" "--dev-pkg" "%{dev}%"]]|}
  in
  B0_pack.v "default" ~doc:"bos package" ~meta ~locked:true @@
  B0_unit.list ()