File tree 9 files changed +36
-8
lines changed
9 files changed +36
-8
lines changed Original file line number Diff line number Diff line change @@ -136,4 +136,4 @@ let cmd =
136
136
`P " Report bugs to <[email protected] >." ;
137
137
]
138
138
in
139
- Cmd. v (Cmd. info " check" ~version: " %%VERSION%% " ~ doc ~man ) cmd_t
139
+ Cmd. v (Cmd. info " check" ~doc ~man ) cmd_t
Original file line number Diff line number Diff line change @@ -103,4 +103,4 @@ let cmd_t = Term.(const dkdep $ Config.t $ ignore $ output $ sort $ files)
103
103
104
104
let cmd =
105
105
let doc = " Dependency list generator for Dedukti files" in
106
- Cmd. (v (info " dep" ~version: " %%VERSION%% " ~ doc ) cmd_t)
106
+ Cmd. (v (info " dep" ~doc ) cmd_t)
Original file line number Diff line number Diff line change @@ -115,4 +115,4 @@ let cmd_t =
115
115
116
116
let cmd =
117
117
let doc = " Transform dk signatures using dk." in
118
- Cmdliner.Cmd. (v (info " meta" ~doc ~version: " %%VERSION%% " ) cmd_t)
118
+ Cmdliner.Cmd. (v (info " meta" ~doc ) cmd_t)
Original file line number Diff line number Diff line change @@ -28,4 +28,4 @@ let cmd_t = Term.(const beautify $ Config.t $ files)
28
28
let cmd =
29
29
let doc = " Pretty print Dedukti files" in
30
30
let man = [] in
31
- Cmd. (v (info " beautify" ~version: " %%VERSION%% " ~ doc ~man ) cmd_t)
31
+ Cmd. (v (info " beautify" ~doc ~man ) cmd_t)
Original file line number Diff line number Diff line change @@ -303,4 +303,4 @@ let cmd_t = Cmdliner.Term.(const prune $ Config.t $ log $ output $ files)
303
303
304
304
let cmd =
305
305
let doc = " Compute dependencies of a set of Dedukti files." in
306
- Cmdliner.Cmd. (v (info " prune" ~version: " %%VERSION%% " ~ doc ) cmd_t)
306
+ Cmdliner.Cmd. (v (info " prune" ~doc ) cmd_t)
Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ let cmd_t = Cmdliner.Term.(const top $ Config.t)
13
13
14
14
let cmd =
15
15
let doc = " Run a read-eval-print-loop using dk-check." in
16
- Cmdliner.Cmd. (v (info " top" ~doc ~version: " %%VERSION%% " ) cmd_t)
16
+ Cmdliner.Cmd. (v (info " top" ~doc ) cmd_t)
Original file line number Diff line number Diff line change
1
+ (rule
2
+ (targets version.ml)
3
+ (action
4
+ (with-stdout-to version.ml
5
+ (run ocaml -I +unix unix.cma %{dep:../misc/gen_version.ml})))
6
+ (mode fallback))
7
+
1
8
(executable
2
9
(name main)
3
- (modules main dkcheck dkdep dkpretty dkprune dkmeta dktop config)
10
+ (modules main dkcheck dkdep dkpretty dkprune dkmeta dktop config version )
4
11
(public_name dk)
5
12
(package dedukti)
6
13
(libraries cmdliner kernel parsers api))
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ let default_i =
13
13
Dedukti language." ;
14
14
]
15
15
in
16
- Cmd. info " dk" ~version: " %%VERSION%%" ~doc ~sdocs ~man
16
+ let version = Version. version in
17
+ Cmd. info " dk" ~version ~doc ~sdocs ~man
17
18
18
19
let cmds =
19
20
[Dkcheck. cmd; Dkdep. cmd; Dkpretty. cmd; Dkprune. cmd; Dkmeta. cmd; Dktop. cmd]
Original file line number Diff line number Diff line change
1
+ let version =
2
+ (* Trick to check whether the watermark has been substituted. *)
3
+ if " %%VERSION%%" <> " %%" ^ " VERSION%%" then " %%VERSION%%" else
4
+ (* If not, we fallback to git version. *)
5
+ let cmd = " git describe --dirty --always" in
6
+ let (oc, ic, ec) = Unix. open_process_full cmd (Unix. environment () ) in
7
+ let version =
8
+ try Printf. sprintf " dev-%s" (input_line oc)
9
+ with End_of_file -> " unknown"
10
+ in
11
+ match Unix. close_process_full (oc, ic, ec) with
12
+ | Unix. WEXITED (0 ) -> version
13
+ | _ -> " unknown"
14
+
15
+ let _ =
16
+ let line fmt = Format. printf (fmt ^^ " @." ) in
17
+ line " (** Version informations. *)" ;
18
+ line " " ;
19
+ line " (** [version] gives a version description. *)" ;
20
+ line " let version : string = %S" version
You can’t perform that action at this time.
0 commit comments