Add INSIDE_DUNE to detect when we are running from unside Dune

And use the following defaults: -j 1 --root . --display quiet
This commit is contained in:
Jeremie Dimino 2018-03-29 12:09:23 -04:00 committed by Rudi Grinberg
parent 31858c9680
commit a1812fccd5
5 changed files with 22 additions and 13 deletions

View File

@ -218,7 +218,11 @@ let common =
let root, to_cwd =
match root with
| Some dn -> (dn, [])
| None -> find_root ()
| None ->
if Config.inside_dune then
(".", [])
else
find_root ()
in
let orig_args =
List.concat

View File

@ -19,6 +19,9 @@ let dev_null = Path.of_string (if Sys.win32 then "nul" else "/dev/null")
let jbuilder_keep_fname = ".jbuilder-keep"
let inside_emacs = Option.is_some (Env.get Env.initial "INSIDE_EMACS")
let inside_dune = Option.is_some (Env.get Env.initial "INSIDE_DUNE")
open Sexp.Of_sexp
module Display = struct
@ -61,8 +64,8 @@ let merge t (partial : Partial.t) =
}
let default =
{ display = Progress
; concurrency = 4
{ display = if inside_dune then Quiet else Progress
; concurrency = if inside_dune then 1 else 4
}
let t =
@ -86,11 +89,6 @@ let load_user_config_file () =
else
default
let inside_emacs =
match Env.get Env.initial "INSIDE_EMACS" with
| Some _ -> true
| None -> false
let adapt_display config ~output_is_a_tty =
if config.display = Progress &&
not output_is_a_tty &&

View File

@ -18,6 +18,9 @@ val jbuilder_keep_fname : string
(** Are we running inside an emacs shell? *)
val inside_emacs : bool
(** Are we running insinde Dune? *)
val inside_dune : bool
(** Jbuilder configuration *)
module Display : sig

View File

@ -20,10 +20,13 @@ let package_install_file { packages; _ } pkg =
(Utils.install_file ~package:p.name ~findlib_toolchain:None))
let setup_env ~capture_outputs =
if capture_outputs || not (Lazy.force Colors.stderr_supports_colors) then
Env.initial
else
Colors.setup_env_for_colors Env.initial
let env =
if capture_outputs || not (Lazy.force Colors.stderr_supports_colors) then
Env.initial
else
Colors.setup_env_for_colors Env.initial
in
Env.add env ~var:"INSIDE_DUNE" ~value:"1"
let setup ?(log=Log.no_log)
?filter_out_optional_stanzas_with_missing_deps

View File

@ -40,5 +40,6 @@ val setup_env : capture_outputs:bool -> Env.t
(**/**)
(* This is used to bootstrap jbuilder itself. It is not part of the public API. *)
(* This is used to bootstrap jbuilder itself. It is not part of the
public API. *)
val bootstrap : unit -> unit