Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not open the log file in "dune clean" #2965

Merged
1 commit merged into from Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
- Fix `dune --version`. The bootstrap didn't compute the version
correctly. (#2929, fixes #2911, @diml)

- Do not open the log file in `dune clean`. (#2965, fixes #2964 and
#2921, @diml)

2.0.0 (20/11/2019)
------------------

Expand Down
8 changes: 4 additions & 4 deletions bin/common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ let set_dirs c =
Path.set_root (Path.External.cwd ());
Path.Build.set_build_dir (Path.Build.Kind.of_string c.build_dir)

let set_common_other c ~targets =
let set_common_other ?log_file c ~targets =
Console.init c.config.display;
Log.init ();
Log.init () ?file:log_file;
Clflags.debug_dep_path := c.debug_dep_path;
Clflags.debug_findlib := c.debug_findlib;
Clflags.debug_backtraces := c.debug_backtraces;
Expand All @@ -92,9 +92,9 @@ let set_common_other c ~targets =
Clflags.ignore_promoted_rules := c.ignore_promoted_rules;
Option.iter ~f:Dune.Stats.enable c.stats_trace_file

let set_common c ~targets =
let set_common ?log_file c ~targets =
set_dirs c;
set_common_other c ~targets
set_common_other ?log_file c ~targets

let footer =
`Blocks
Expand Down
11 changes: 7 additions & 4 deletions bin/common.mli
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
open Stdune

type t

val workspace_file : t -> Arg.Path.t option
Expand All @@ -20,16 +22,17 @@ val default_target : t -> Arg.Dep.t

val prefix_target : t -> string -> string

(** [set_common common ~targets] is [set_dirs common] followed by
(** [set_common ?log common ~targets] is [set_dirs common] followed by
[set_common_other common ~targets]. In general, [set_common] executes
sequence of side-effecting actions to initialize Dune's working environment
based on the options determined in a [Common.t] record *)
val set_common : t -> targets:Arg.Dep.t list -> unit
based on the options determined in a [Common.t] record.contents. *)
val set_common : ?log_file:Log.File.t -> t -> targets:Arg.Dep.t list -> unit

(** [set_common_other common ~targets] sets all stateful values dictated by
[common], except those accounted for by [set_dirs]. [targets] are used to
obtain external library dependency hints, if needed. *)
val set_common_other : t -> targets:Arg.Dep.t list -> unit
val set_common_other :
?log_file:Log.File.t -> t -> targets:Arg.Dep.t list -> unit

(** [set_dirs common] sets the workspace root and build directories, and makes
the root the current working directory *)
Expand Down
7 changes: 6 additions & 1 deletion bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ let clean =
in
let term =
let+ common = Common.term in
Common.set_common common ~targets:[];
(* Pass [No_log_file] to prevent the log file from being created. Indeed, we
are going to delete the whole build directory right after and that
includes deleting the log file. Not only creating the log file would be
useless but with some FS this also causes [dune clean] to fail (cf
https://github.com/ocaml/dune/issues/2964). *)
Common.set_common common ~targets:[] ~log_file:No_log_file;
Build_system.files_in_source_tree_to_delete ()
|> Path.Set.iter ~f:Path.unlink_no_err;
Path.rm_rf Path.build_dir
Expand Down