Delete old odoc artifacts before running odoc
This commit is contained in:
parent
37d7131a11
commit
500f224098
|
@ -80,8 +80,9 @@ module Mini_shexp = struct
|
||||||
| Copy_and_add_line_directive of 'path * 'path
|
| Copy_and_add_line_directive of 'path * 'path
|
||||||
| System of 'a
|
| System of 'a
|
||||||
| Bash of 'a
|
| Bash of 'a
|
||||||
| Update_file of 'path * 'a
|
| Update_file of 'path * 'a
|
||||||
| Rename of 'path * 'path
|
| Rename of 'path * 'path
|
||||||
|
| Remove_tree of 'path
|
||||||
|
|
||||||
let rec t a p sexp =
|
let rec t a p sexp =
|
||||||
sum
|
sum
|
||||||
|
@ -137,6 +138,7 @@ module Mini_shexp = struct
|
||||||
| Bash x -> List [Atom "bash"; f x]
|
| Bash x -> List [Atom "bash"; f x]
|
||||||
| Update_file (x, y) -> List [Atom "update-file"; g x; f y]
|
| Update_file (x, y) -> List [Atom "update-file"; g x; f y]
|
||||||
| Rename (x, y) -> List [Atom "rename"; g x; g y]
|
| Rename (x, y) -> List [Atom "rename"; g x; g y]
|
||||||
|
| Remove_tree x -> List [Atom "remove-tree"; g x]
|
||||||
|
|
||||||
let rec fold t ~init:acc ~f =
|
let rec fold t ~init:acc ~f =
|
||||||
match t with
|
match t with
|
||||||
|
@ -156,6 +158,7 @@ module Mini_shexp = struct
|
||||||
| Bash x -> f acc x
|
| Bash x -> f acc x
|
||||||
| Update_file (x, y) -> f (f acc x) y
|
| Update_file (x, y) -> f (f acc x) y
|
||||||
| Rename (x, y) -> f (f acc x) y
|
| Rename (x, y) -> f (f acc x) y
|
||||||
|
| Remove_tree x -> f acc x
|
||||||
|
|
||||||
let fold_one_step t ~init:acc ~f =
|
let fold_one_step t ~init:acc ~f =
|
||||||
match t with
|
match t with
|
||||||
|
@ -174,7 +177,8 @@ module Mini_shexp = struct
|
||||||
| System _
|
| System _
|
||||||
| Bash _
|
| Bash _
|
||||||
| Update_file _
|
| Update_file _
|
||||||
| Rename _ -> acc
|
| Rename _
|
||||||
|
| Remove_tree _ -> acc
|
||||||
|
|
||||||
let rec map
|
let rec map
|
||||||
: 'a 'b 'c 'd. ('a, 'b) t -> f1:('a -> 'c) -> f2:('b -> 'd) -> ('c, 'd) t
|
: 'a 'b 'c 'd. ('a, 'b) t -> f1:('a -> 'c) -> f2:('b -> 'd) -> ('c, 'd) t
|
||||||
|
@ -203,6 +207,7 @@ module Mini_shexp = struct
|
||||||
| Bash x -> Bash (f1 x)
|
| Bash x -> Bash (f1 x)
|
||||||
| Update_file (x, y) -> Update_file (f2 x, f1 y)
|
| Update_file (x, y) -> Update_file (f2 x, f1 y)
|
||||||
| Rename (x, y) -> Rename (f2 x, f2 y)
|
| Rename (x, y) -> Rename (f2 x, f2 y)
|
||||||
|
| Remove_tree x -> Remove_tree (f2 x)
|
||||||
end
|
end
|
||||||
open Ast
|
open Ast
|
||||||
|
|
||||||
|
@ -277,6 +282,8 @@ module Mini_shexp = struct
|
||||||
| Update_file (x, y) -> Update_file (expand_path ~dir ~f x, expand_str ~dir ~f y)
|
| Update_file (x, y) -> Update_file (expand_path ~dir ~f x, expand_str ~dir ~f y)
|
||||||
| Rename (x, y) ->
|
| Rename (x, y) ->
|
||||||
Rename (expand_path ~dir ~f x, expand_path ~dir ~f y)
|
Rename (expand_path ~dir ~f x, expand_path ~dir ~f y)
|
||||||
|
| Remove_tree x ->
|
||||||
|
Remove_tree (expand_path ~dir ~f x)
|
||||||
end
|
end
|
||||||
|
|
||||||
open Future
|
open Future
|
||||||
|
@ -376,6 +383,9 @@ module Mini_shexp = struct
|
||||||
| Rename (src, dst) ->
|
| Rename (src, dst) ->
|
||||||
Unix.rename (Path.to_string src) (Path.to_string dst);
|
Unix.rename (Path.to_string src) (Path.to_string dst);
|
||||||
return ()
|
return ()
|
||||||
|
| Remove_tree path ->
|
||||||
|
Path.rm_rf path;
|
||||||
|
return ()
|
||||||
|
|
||||||
and redirect outputs fn t ~purpose ~dir ~env ~env_extra ~stdout_to ~stderr_to =
|
and redirect outputs fn t ~purpose ~dir ~env ~env_extra ~stdout_to ~stderr_to =
|
||||||
let fn = Path.to_string fn in
|
let fn = Path.to_string fn in
|
||||||
|
|
|
@ -30,6 +30,7 @@ module Mini_shexp : sig
|
||||||
| Bash of 'a
|
| Bash of 'a
|
||||||
| Update_file of 'path * 'a
|
| Update_file of 'path * 'a
|
||||||
| Rename of 'path * 'path
|
| Rename of 'path * 'path
|
||||||
|
| Remove_tree of 'path
|
||||||
val t : 'a Sexp.Of_sexp.t -> 'b Sexp.Of_sexp.t -> ('a, 'b) t Sexp.Of_sexp.t
|
val t : 'a Sexp.Of_sexp.t -> 'b Sexp.Of_sexp.t -> ('a, 'b) t Sexp.Of_sexp.t
|
||||||
val sexp_of_t : 'a Sexp.To_sexp.t -> 'b Sexp.To_sexp.t -> ('a, 'b) t Sexp.To_sexp.t
|
val sexp_of_t : 'a Sexp.To_sexp.t -> 'b Sexp.To_sexp.t -> ('a, 'b) t Sexp.To_sexp.t
|
||||||
end
|
end
|
||||||
|
|
|
@ -254,6 +254,10 @@ let symlink ~src ~dst =
|
||||||
let create_file fn =
|
let create_file fn =
|
||||||
action_context_independent ~targets:[fn] (Create_file fn)
|
action_context_independent ~targets:[fn] (Create_file fn)
|
||||||
|
|
||||||
|
let remove_tree dir =
|
||||||
|
arr (fun _ ->
|
||||||
|
{ Action. context = None; action = Remove_tree dir })
|
||||||
|
|
||||||
let progn ts =
|
let progn ts =
|
||||||
all ts >>^ fun (actions : Action.t list) ->
|
all ts >>^ fun (actions : Action.t list) ->
|
||||||
let rec loop context acc actions =
|
let rec loop context acc actions =
|
||||||
|
|
|
@ -117,6 +117,7 @@ val copy : src:Path.t -> dst:Path.t -> (unit, Action.t) t
|
||||||
val symlink : src:Path.t -> dst:Path.t -> (unit, Action.t) t
|
val symlink : src:Path.t -> dst:Path.t -> (unit, Action.t) t
|
||||||
|
|
||||||
val create_file : Path.t -> (_, Action.t) t
|
val create_file : Path.t -> (_, Action.t) t
|
||||||
|
val remove_tree : Path.t -> (_, Action.t) t
|
||||||
|
|
||||||
(** Merge a list of actions *)
|
(** Merge a list of actions *)
|
||||||
val progn : ('a, Action.t) t list -> ('a, Action.t) t
|
val progn : ('a, Action.t) t list -> ('a, Action.t) t
|
||||||
|
|
|
@ -47,7 +47,8 @@ let to_html sctx (m : Module.t) odoc_file ~doc_dir ~odoc ~dir ~includes
|
||||||
includes
|
includes
|
||||||
>>>
|
>>>
|
||||||
Build.progn
|
Build.progn
|
||||||
[ Build.run ~context ~dir odoc ~extra_targets:[html_file]
|
[ Build.remove_tree html_dir
|
||||||
|
; Build.run ~context ~dir odoc ~extra_targets:[html_file]
|
||||||
[ A "html"
|
[ A "html"
|
||||||
; Dyn (fun x -> x)
|
; Dyn (fun x -> x)
|
||||||
; A "-I"; Path dir
|
; A "-I"; Path dir
|
||||||
|
|
Loading…
Reference in New Issue