Skip to content

Commit

Permalink
Do not promote install files by default
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
  • Loading branch information
jeremiedimino committed Jun 20, 2019
1 parent 83278d2 commit c691a79
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
the cost of building unnecessary artifacts in some cases. Some of these extra
artifacts can fail to built, so this is a breaking change. (#2268, @rgrinberg)

- Do not put the `<package>.install` files in the source tree unless
`-p` or `--promote-install-files` is passed on the command line (#..., @diml)

1.11.0 (unreleased)
-------------------

Expand Down
13 changes: 13 additions & 0 deletions bin/common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type t =
; watch : bool
; stats_trace_file : string option
; always_show_command_line : bool
; promote_install_files : bool
}

let prefix_target common s = common.target_prefix ^ s
Expand All @@ -62,6 +63,7 @@ let set_common_other c ~targets =
Clflags.watch := c.watch;
Clflags.no_print_directory := c.no_print_directory;
Clflags.store_orig_src_dir := c.store_orig_src_dir;
Clflags.promote_install_files := c.promote_install_files;
Clflags.external_lib_deps_hint :=
List.concat
[ ["dune"; "external-lib-deps"; "--missing"]
Expand Down Expand Up @@ -122,6 +124,7 @@ module Options_implied_by_dash_p = struct
; profile : string option
; default_target : string
; always_show_command_line : bool
; promote_install_files : bool
}

let docs = copts_sect
Expand Down Expand Up @@ -225,6 +228,12 @@ module Options_implied_by_dash_p = struct
Arg.(value
& flag
& info ["always-show-command-line"] ~docs ~doc)
and+ promote_install_files =
let doc =
"Promote the generated <package>.install files to the source tree" in
Arg.(value
& flag
& info ["promote-install-files"] ~docs ~doc)
in
{ root
; only_packages
Expand All @@ -233,6 +242,7 @@ module Options_implied_by_dash_p = struct
; profile
; default_target
; always_show_command_line
; promote_install_files
}

let for_release = "for-release-of-packages"
Expand All @@ -256,6 +266,7 @@ module Options_implied_by_dash_p = struct
; profile = Some "release"
; default_target = "@install"
; always_show_command_line = true
; promote_install_files = true
}

let term = one_of options dash_p
Expand Down Expand Up @@ -356,6 +367,7 @@ let term =
; profile
; default_target
; always_show_command_line
; promote_install_files
} = Options_implied_by_dash_p.term
and+ x =
Arg.(value
Expand Down Expand Up @@ -443,6 +455,7 @@ let term =
; watch
; stats_trace_file
; always_show_command_line
; promote_install_files
}

let term =
Expand Down
1 change: 1 addition & 0 deletions bin/common.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type t =
; watch : bool
; stats_trace_file : string option
; always_show_command_line : bool
; promote_install_files : bool
}

val prefix_target : t -> string -> string
Expand Down
4 changes: 2 additions & 2 deletions doc/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ directory. Although, some are sometimes copied to the source tree for
the need of external tools. These includes:

- ``.merlin`` files

- ``<package>.install`` files
- ``<package>.install`` files (when either ``-p`` or
``--promote-install-files`` is passed on the command line)

As a result, if you want to ask ``dune`` to produce a particular ``.exe``
file you would have to type:
Expand Down
1 change: 1 addition & 0 deletions src/clflags.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ let watch = ref false
let no_print_directory = ref false
let store_orig_src_dir = ref false
let always_show_command_line = ref false
let promote_install_files = ref false
3 changes: 3 additions & 0 deletions src/clflags.mli
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ val store_orig_src_dir : bool ref

(** Always show full command on error *)
val always_show_command_line : bool ref

(** Promote the generated [<package>.install] files to the source tree *)
val promote_install_files : bool ref
1 change: 1 addition & 0 deletions src/install_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ let symlink_installed_artifacts_to_build_install
Install.Entry.set_src entry dst)

let promote_install_file (ctx : Context.t) =
!Clflags.promote_install_files &&
not ctx.implicit &&
match ctx.kind with
| Default -> true
Expand Down

0 comments on commit c691a79

Please sign in to comment.