package drom_lib

  1. Overview
  2. Docs

Source file types.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
(**************************************************************************)
(*                                                                        *)
(*    Copyright 2020 OCamlPro & Origin Labs                               *)
(*                                                                        *)
(*  All rights reserved. This file is distributed under the terms of the  *)
(*  GNU Lesser General Public License version 2.1, with the special       *)
(*  exception on linking described in the file LICENSE.                   *)
(*                                                                        *)
(**************************************************************************)

open EzCompat (* for StringMap *)

type kind =
  | Program
  | Library
  | Virtual

type version =
  | Lt of string
  | Le of string
  | Eq of string
  | Ge of string
  | Gt of string
  | Version
  | Semantic of int * int * int
  | NoVersion

type dependency =
  { depversions : version list; (* "version" *)
    depname : string option;    (* "libname" *)
    (* for dune if different *)
    deptest : bool ; (* "for-test" *)
    depdoc : bool ; (* "for-doc" *)
    depopt : bool ; (* opt *)
  }

type package =
  { name : string;
    mutable dir : string;
    mutable project : project;
    mutable kind : kind;
    mutable p_skeleton : string option;
    mutable p_pack : string option;
    mutable p_version : string option;
    mutable p_authors : string list option;
    mutable p_synopsis : string option;
    mutable p_description : string option;
    mutable p_dependencies : (string * dependency) list;
    mutable p_tools : (string * dependency) list;
    mutable p_pack_modules : bool option;
    mutable p_gen_version : string option;
    mutable p_fields : string StringMap.t;
    mutable p_generators : StringSet.t option;
    mutable p_file : string option ;
    mutable p_skip : string list option ;
    mutable p_optional : bool option ;
    mutable p_preprocess : string option ;
  }

and project =
  { package : package; (* main package *)
    (* The list of all packages, including the main package *)
    mutable packages : package list;
    mutable file : string option; (* name of the file *)
    mutable generators : StringSet.t;
    (* sub-packages *)

    (* common fields *)
    mutable skeleton : string option;
    edition : string;
    min_edition : string;
    (* not that ocamlformat => ocaml.4.04.0 *)
    github_organization : string option;
    homepage : string option;
    license : string;
    copyright : string option;
    bug_reports : string option;
    dev_repo : string option;
    doc_gen : string option;
    doc_api : string option;
    skip : string list;
    (* publish options *)
    archive : string option;
    (* sphinx options *)
    sphinx_target : string option;
    (* odoc options *)
    odoc_target : string option;
    (* CI options *)
    ci_systems : string list;
    skip_dirs : string list;
    profiles : profile StringMap.t;
    profile : string option;
    (* default fields *)
    version : string;
    authors : string list;
    synopsis : string;
    description : string;
    share_dirs : string list ;
    mutable dependencies : (string * dependency) list;
    mutable tools : (string * dependency) list;
    mutable fields : string StringMap.t;
    year : int;
    mutable dune_version : string;
  }

and profile = { flags : string StringMap.t }

type config =
  { config_author : string option;
    config_share_dir : string option;
    config_github_organization : string option;
    config_license : string option;
    config_copyright : string option;
    config_opam_repo : string option;
    config_dev_tools : string list option;
    config_auto_upgrade : bool option ;
    config_auto_opam_yes : bool option ;
  }

type opam_kind =
  | Single
  | LibraryPart
  | ProgramPart
  | Deps

type switch_arg =
  | Local
  | Global of string

(* These flags are used during file generation. They can either be set
   in the file itself, or in the 'flags' section of the skeleton. *)
type flags =
  { mutable flag_file : string;
    mutable flag_create : bool;
    mutable flag_record : bool;
    mutable flag_skips : string list;
    mutable flag_skip : bool ;
    mutable flag_subst : bool ;
    mutable flag_perm : int ;
    flag_skipper : bool list ref ;
  }

type skeleton =
  { skeleton_inherits : string option;
    skeleton_toml : string list;
    skeleton_files : (string * string * int) list;
    skeleton_flags : flags StringMap.t;
    skeleton_drom : bool ;
    skeleton_name : string ;
  }

type license = {
  license_key : string ;
  license_name : string ;
  license_header : string list ;
  license_contents : string ;
}

type deps_status =
  | Deps_build
  | Deps_devel
  | Deps_locked