Skip to content

Commit

Permalink
Add --no-print-directory command line argument (#1668)
Browse files Browse the repository at this point in the history
Suppresses the `Entering directory` message, as in GNU make.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
  • Loading branch information
dra27 authored and jeremiedimino committed Dec 15, 2018
1 parent 3a73efd commit 8e1b566
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.md
Expand Up @@ -40,6 +40,9 @@ unreleased

- Add `--trace-file` option to trace dune internals (#1639, fix #1180, @emillon)

- Add `--no-print-directory` (borrowed from GNU make) to suppress
`Entering directory` messages. (#1668, @dra27)

- Remove `--stats` and track fd usage in `--trace-file` (#1667, @emillon)

1.6.2 (05/12/2018)
Expand Down
8 changes: 8 additions & 0 deletions bin/common.ml
Expand Up @@ -20,6 +20,7 @@ type t =
; force : bool
; ignore_promoted_rules : bool
; build_dir : string
; no_print_directory : bool
; (* Original arguments for the external-lib-deps hint *)
orig_args : string list
; config : Config.t
Expand All @@ -46,6 +47,7 @@ let set_common_other c ~targets =
Clflags.auto_promote := c.auto_promote;
Clflags.force := c.force;
Clflags.watch := c.watch;
Clflags.no_print_directory := c.no_print_directory;
Clflags.external_lib_deps_hint :=
List.concat
[ ["dune"; "external-lib-deps"; "--missing"]
Expand Down Expand Up @@ -333,6 +335,11 @@ let term =
& info ["trace-file"] ~docs ~docv:"FILE"
~doc:"Output trace data in catapult format
(compatible with chrome://tracing)")
and no_print_directory =
Arg.(value
& flag
& info ["no-print-directory"] ~docs
~doc:"Suppress \"Entering directory\" messages")
in
let build_dir = Option.value ~default:"_build" build_dir in
let root, to_cwd =
Expand Down Expand Up @@ -384,6 +391,7 @@ let term =
; x
; config
; build_dir
; no_print_directory
; default_target
; watch
; stats_trace_file
Expand Down
1 change: 1 addition & 0 deletions bin/common.mli
Expand Up @@ -16,6 +16,7 @@ type t =
; force : bool
; ignore_promoted_rules : bool
; build_dir : string
; no_print_directory : bool
; (* Original arguments for the external-lib-deps hint *)
orig_args : string list
; config : Config.t
Expand Down
3 changes: 3 additions & 0 deletions doc/usage.rst
Expand Up @@ -48,6 +48,9 @@ to setup the configuration of the workspace unless the ``--workspace``
command line option is used. See the section `Workspace
configuration`_ for the syntax of this file.

The ``Entering directory`` message can be suppressed with the
``--no-print-directory`` command line option (as in GNU make).

Current directory
-----------------

Expand Down
1 change: 1 addition & 0 deletions src/clflags.ml
Expand Up @@ -7,3 +7,4 @@ let diff_command = ref None
let auto_promote = ref false
let force = ref false
let watch = ref false
let no_print_directory = ref false
3 changes: 3 additions & 0 deletions src/clflags.mli
Expand Up @@ -26,3 +26,6 @@ val force : bool ref

(** Instead of terminating build after completion, watch for changes *)
val watch : bool ref

(** Do not print "Entering directory" messages *)
val no_print_directory : bool ref
2 changes: 1 addition & 1 deletion src/scheduler.ml
Expand Up @@ -642,7 +642,7 @@ let prepare ?(log=Log.no_log) ?(config=Config.default)
Signal_watcher.init ();
Process_watcher.init ();
let cwd = Sys.getcwd () in
if cwd <> initial_cwd then
if cwd <> initial_cwd && not !Clflags.no_print_directory then
Printf.eprintf "Entering directory '%s'\n%!"
(if Config.inside_dune then
let descendant_simple p ~of_ =
Expand Down

0 comments on commit 8e1b566

Please sign in to comment.