Commit 7ba0f870 authored by Stephane Glondu's avatar Stephane Glondu Committed by Stephane Glondu

New upstream version 1.11.0

parent 2c6adf8a
1.11.0 (23/07/2019)
-------------------
- Don't select all local implementations in `dune utop`. Instead, let the
default implementation selection do its job. (#2327, fixes #2323, @TheLortex,
review by @rgrinberg)
- Check that selected implementations (either by variants or default
implementations) are indeed implementations. (#2328, @TheLortex, review by
@rgrinberg)
- Don't reserve the `Ppx` toplevel module name for ppx rewriters (#2242, @diml)
- Redesign of the library variant feature according to the #2134 proposal. The
set of variants is now computed when the virtual library is installed.
Introducing a new `external_variant` stanza. (#2169, fixes #2134, @TheLortex,
review by @diml)
- Add proper line directives when copying `.cc` and `.cxx` sources (#2275,
@rgrinberg)
- Fix error message for missing C++ sources. The `.cc` extension was always
ignored before. (#2275, @rgrinberg)
- Add `$ dune init project` subcommand to create project boilerplate according
to a common template. (#2185, fixes #159, @shonfeder)
- Allow to run inline tests in javascript with nodejs (#2266, @hhugo)
- Build `ppx.exe` as compiling host binary. (#2286, fixes #2252, @toots, review
by @rgrinberg and @diml)
- Add a `cinaps` extension and stanza for better integration with the
[cinaps tool](https://github.com/janestreet/cinaps) tool (#2269,
@diml)
- Allow to embed build info in executables such as version and list
and version of statically linked libraries (#2224, @diml)
- Set version in `META` and `dune-package` files to the one read from
the vcs when no other version is available (#2224, @diml)
- Add a variable `%{target}` to be used in situations where the context
requires at most one word, so `%{targets}` can be confusing; stdout
redirections and "-o" arguments of various tools are the main use
case; also, introduce a separate field `target` that must be used
instead of `targets` in those situations. (#2341, @aalekseyev)
- Fix dependency graph of wrapped_compat modules. Previously, the dependency on
the user written entry module was omitted. (#2305, @rgrinberg)
- Allow to promote executables built with an `executable` stanza
(#2379, @diml)
- When instantiating an implementation with a variant, make sure it matches
virtual library's list of known implementations. (#2361, fixes #2322,
@TheLortex, review by @rgrinberg)
- Add a variable `%{ignoring_promoted_rules}` that is `true` when
`--ingore-promoted-rules` is passed on the command line and false
otherwise (#2382, @diml)
- Fix a bug in `future_syntax` where the characters `@` and `&` were
not distinguished in the names of binding operators (`let@` was the
same as `let&`) (#2376, @aalekseyev, @diml)
- Workspaces with non unique project names are now supported. (#2377, fix #2325,
@rgrinberg)
- Improve opam generation to include the `dune` dependncies with the minimum
constraint set based on the dune language version specified in the
`dune-project` file. (2383, @avsm)
- The order of fields in the generated opam file now follows order preferred in
opam-lib. (@avsm, #2380)
- Fix coloring of error messages from the compiler (@diml, #2384)
- Add warning `66` to default set of warnings starting for dune projects with
language verison >= `1.11` (@rgrinberg, @diml, fixes #2299)
- Add (dialect ...) stanza
(@nojb, #2404)
- Add a `--context` argument to `dune install/uninstall` (@diml, #2412)
- Do not warn about merlin files pre 1.9. This warning can only be disabled in
1.9 (#2421, fixes #2399, @emillon)
- Add a new `inline_tests` field in the env stanza to control inline_tests
framework with a variable (#2313, @mlasson, original idea by @diml, review
by @rgrinberg).
- New binary kind `js` for executables in order to explicitly enable Javascript
targets, and a switch `(explicit_js_mode)` to require this mode in order to
declare JS targets corresponding to executables. (#1941, @nojb)
1.10.0 (04/06/2019)
-------------------
......@@ -102,7 +199,6 @@
exist before trying to install anything. This prevents partial installation of
packages (#2230, @rgrinberg)
1.9.3 (06/05/2019)
------------------
......
......@@ -19,7 +19,9 @@ guide][quick-start] or watch [this introduction video][video].
The [example][example] directory contains examples of projects using
dune.
[![Travis status][travis-img]][travis] [![AppVeyor status][appveyor-img]][appveyor]
[![Travis status][travis-img]][travis]
[![AppVeyor status][appveyor-img]][appveyor]
[![Release][release-img]][release]
[manual]: https://dune.readthedocs.io/en/latest/
[quick-start]: https://dune.readthedocs.io/en/latest/quick-start.html
......@@ -28,6 +30,8 @@ dune.
[travis-img]: https://travis-ci.org/ocaml/dune.svg?branch=master
[appveyor]: https://ci.appveyor.com/project/diml/dune/branch/master
[appveyor-img]: https://ci.appveyor.com/api/projects/status/rsxayce22e8f2jkp?svg=true
[release]: https://github.com/ocaml/dune/releases
[release-img]: https://img.shields.io/github/release/ocaml/dune.svg
[merlin]: https://github.com/ocaml/merlin
[opam]: https://opam.ocaml.org
[issues]: https://github.com/ocaml/dune/issues
......
......@@ -9,7 +9,7 @@ let setup = lazy (
let tmp = Path.External.of_string (Filename.get_temp_dir_name ()) in
Path.External.mkdir_p (Path.External.relative tmp deep_path);
Path.set_root tmp;
Path.Build.set_build_dir (Path.Kind.of_string "_build");
Path.Build.set_build_dir (Path.Build.Kind.of_string "_build");
let ft = (Dune_load.load ~ancestor_vcs:None ()).file_tree in
let path = Path.Source.of_string deep_path in
at_exit (fun () -> Sys.remove "./dune-project");
......
......@@ -5,7 +5,7 @@ open Dune
let setup = lazy (
Path.set_root (Path.External.cwd ());
Path.Build.set_build_dir (Path.Kind.of_string "_build"))
Path.Build.set_build_dir (Path.Build.Kind.of_string "_build"))
let prog =
Option.value_exn (Bin.which ~path:(Env.path Env.initial) "true")
......
open Stdune
let die = Dune.Import.die
type t =
{ name : string
; recursive : bool
......@@ -10,9 +8,9 @@ type t =
}
let to_log_string { name ; recursive; dir ; contexts = _ } =
sprintf "- %s alias %s%s/%s"
sprintf "- %salias %s%s/%s"
(if recursive then "recursive " else "")
(if recursive then "@@" else "@")
(if recursive then "@" else "@@")
(Path.Source.to_string_maybe_quoted dir)
name
......@@ -20,7 +18,8 @@ let in_dir ~name ~recursive ~contexts dir =
let checked = Util.check_path contexts dir in
match checked with
| External _ ->
die "@@ on the command line must be followed by a relative path"
User_error.raise
[ Pp.textf "@@ on the command line must be followed by a relative path" ]
| In_source_dir dir ->
{ dir
; recursive
......@@ -28,10 +27,12 @@ let in_dir ~name ~recursive ~contexts dir =
; contexts
}
| In_install_dir _ ->
die "Invalid alias: %s.\n\
There are no aliases in %s."
(Path.to_string_maybe_quoted Path.(relative build_dir "install"))
(Path.to_string_maybe_quoted dir)
User_error.raise
[ Pp.textf "Invalid alias: %s."
(Path.to_string_maybe_quoted Path.(relative build_dir "install"))
; Pp.textf "There are no aliases in %s."
(Path.to_string_maybe_quoted dir)
]
| In_build_dir (ctx, dir) ->
{ dir
; recursive
......@@ -53,7 +54,10 @@ let of_string common s ~contexts =
let s = String.drop s pos in
let path = Path.relative Path.root (Common.prefix_target common s) in
if Path.is_root path then
die "@@ on the command line must be followed by a valid alias name"
User_error.raise
[ Pp.textf
"@ on the command line must be followed by a valid alias name"
]
else
let dir = Path.parent_exn path in
let name = Path.basename path in
......
This diff is collapsed.
......@@ -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
......@@ -54,6 +55,10 @@ val term : t Cmdliner.Term.t
val context_arg : doc:string -> string Cmdliner.Term.t
(** A [--build-info] command line argument that print build
informations (included in [term]) *)
val build_info : unit Cmdliner.Term.t
val default_build_dir : string
module Let_syntax : sig
......
......@@ -58,7 +58,8 @@ let term =
| `Error msg ->
`Error (true, msg)
| `Result res ->
Format.printf "%a\n%!" Sexp.pp res;
Ansi_color.print (Dyn.pp res);
print_newline ();
`Ok ()
| `List ->
let fns = Memo.registered_functions () in
......
(library
(name main)
(libraries memo dune_lang wp fiber stdune unix dune cmdliner)
(libraries memo dune_lang wp fiber stdune unix dune cmdliner build_info)
(preprocess future_syntax))
......@@ -102,14 +102,16 @@ let term =
| None, true ->
begin match Lazy.force targets with
| [] ->
die "@{<Error>Error@}: Program %S not found!" prog
User_error.raise
[ Pp.textf "Program %S not found!" prog ]
| _::_ ->
die "@{<Error>Error@}: Program %S isn't built yet \
you need to build it first or remove the \
--no-build option." prog
User_error.raise
[ Pp.textf "Program %S isn't built yet. You need to build it \
first or remove the --no-build option." prog
]
end
| None, false ->
die "@{<Error>Error@}: Program %S not found!" prog
User_error.raise [ Pp.textf "Program %S not found!" prog ]
| Some real_prog, _ ->
let real_prog = Path.to_string real_prog in
let argv = prog :: args in
......
open Stdune
open Import
let format_external_libs libs =
Lib_name.Map.to_list libs
|> List.map ~f:(fun (name, kind) ->
let pp_external_libs libs =
Pp.enumerate (Lib_name.Map.to_list libs) ~f:(fun (name, kind) ->
match (kind : Lib_deps_info.Kind.t) with
| Optional -> sprintf "- %s (optional)" (Lib_name.to_string name)
| Required -> sprintf "- %s" (Lib_name.to_string name))
|> String.concat ~sep:"\n"
| Optional -> Pp.textf "%s (optional)" (Lib_name.to_string name)
| Required -> Pp.textf "%s" (Lib_name.to_string name))
let doc = "Print out external libraries needed to build the given targets."
......@@ -38,8 +36,8 @@ let run ~lib_deps ~by_dir ~setup ~only_missing ~sexp =
in
if only_missing then begin
if by_dir || sexp then
die "@{<error>Error@}: --only-missing cannot be used with \
--unstable-by-dir or --sexp";
User_error.raise [ Pp.textf "--only-missing cannot be used with \
--unstable-by-dir or --sexp" ];
let context =
List.find_exn setup.workspace.contexts
~f:(fun c -> c.name = context_name)
......@@ -53,57 +51,61 @@ let run ~lib_deps ~by_dir ~setup ~only_missing ~sexp =
else if Lib_name.Map.for_alli missing
~f:(fun _ kind -> kind = Lib_deps_info.Kind.Optional)
then begin
Format.eprintf
"@{<error>Error@}: The following libraries are missing \
in the %s context:\n\
%s@."
context_name
(format_external_libs missing);
User_message.prerr
(User_error.make
[ Pp.textf "The following libraries are missing \
in the %s context:"
context_name
; pp_external_libs missing
]);
false
end else begin
Format.eprintf
"@{<error>Error@}: The following libraries are missing \
in the %s context:\n\
%s\n\
Hint: try: opam install %s@."
context_name
(format_external_libs missing)
(Lib_name.Map.to_list missing
|> List.filter_map ~f:(fun (name, kind) ->
match (kind : Lib_deps_info.Kind.t) with
| Optional -> None
| Required -> Some (Lib_name.package_name name))
|> Package.Name.Set.of_list
|> Package.Name.Set.to_list
|> List.map ~f:Package.Name.to_string
|> String.concat ~sep:" ");
User_message.prerr
(User_error.make
[ Pp.textf "The following libraries are missing \
in the %s context:"
context_name
; pp_external_libs missing
]
~hints:[ Pp.concat ~sep:Pp.space
(Pp.textf "try: opam install"
:: (Lib_name.Map.to_list missing
|> List.filter_map ~f:(fun (name, kind) ->
match (kind : Lib_deps_info.Kind.t) with
| Optional -> None
| Required -> Some (Lib_name.package_name name))
|> Package.Name.Set.of_list
|> Package.Name.Set.to_list
|> List.map ~f:(fun p ->
Pp.verbatim (Package.Name.to_string p))))
]);
true
end
end else if sexp then begin
if not by_dir then
die "@{<error>Error@}: --sexp requires --unstable-by-dir";
User_error.raise [ Pp.textf "--sexp requires --unstable-by-dir" ];
let lib_deps_by_dir =
lib_deps_by_dir
|> Path.Source.Map.map ~f:(Lib_name.Map.filteri ~f:is_external)
|> Path.Source.Map.filter ~f:(fun m -> not (Lib_name.Map.is_empty m))
in
let sexp =
Map.to_sexp
Path.Source.Map.to_list
(fun p -> Atom (Path.Source.to_string p))
Lib_deps_info.to_sexp
lib_deps_by_dir
Path.Source.Map.to_dyn Lib_deps_info.to_dyn lib_deps_by_dir
|> Sexp.of_dyn
in
Format.printf "%a@." Sexp.pp (List [Atom context_name; sexp]);
acc
end else begin
if by_dir then
die "@{<error>Error@}: --unstable-by-dir cannot be used without --sexp";
Printf.printf
"These are the external library dependencies in the %s context:\n\
%s\n%!"
context_name
(format_external_libs externals);
User_error.raise
[ Pp.textf "--unstable-by-dir cannot be used without --sexp" ];
User_message.print
(User_message.make
[ Pp.textf "These are the external library dependencies in \
the %s context:"
context_name
; pp_external_libs externals
]);
acc
end)
......@@ -142,6 +144,6 @@ let term =
(setup, deps))
in
let failure = run ~by_dir ~setup ~lib_deps ~sexp ~only_missing in