diff --git a/CHANGES.md b/CHANGES.md index 76bc514f61a..a5af5b87b9c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -79,6 +79,8 @@ - Set up formatting rules by default. They can be configured through a new `(formatting)` stanza in `dune-project` (#2347, fixes #2315, @emillon) +- Change default target from `@install` to `@all`. (#2449, @rgrinberg) + 1.11.0 (23/07/2019) ------------------- diff --git a/src/build_system.ml b/src/build_system.ml index 6ac65dddf28..03d301f820d 100644 --- a/src/build_system.ml +++ b/src/build_system.ml @@ -735,10 +735,20 @@ end = struct match File_tree.find_dir t.file_tree src_dir with | None -> aliases | Some dir -> + let default_alias = + let dune_version = + File_tree.Dir.project dir + |> Dune_project.dune_version + in + if dune_version >= (2, 0) then + "all" + else + "install" + in String.Map.set aliases "default" { deps = Path.Set.empty ; dyn_deps = - (Alias0.dep_rec_internal ~name:"install" ~dir ~ctx_dir + (Alias0.dep_rec_internal ~name:default_alias ~dir ~ctx_dir >>^ fun (_ : bool) -> Path.Set.empty) ; actions = Appendable_list.empty diff --git a/src/gen_rules.ml b/src/gen_rules.ml index 760a3131bab..f9cc945d2b1 100644 --- a/src/gen_rules.ml +++ b/src/gen_rules.ml @@ -216,7 +216,6 @@ module Gen(P : sig val sctx : Super_context.t end) = struct |> SC.add_rules ~dir:ctx_dir sctx | _ -> ()); let dyn_deps = - (* DUNE2: no need to filter out js targets anymore *) let pred = let id = lazy ( let open Dyn.Encoder in diff --git a/test/blackbox-tests/test-cases/dune-init/run.t b/test/blackbox-tests/test-cases/dune-init/run.t index 2ebd7d0cdfd..fcaf063bb49 100644 --- a/test/blackbox-tests/test-cases/dune-init/run.t +++ b/test/blackbox-tests/test-cases/dune-init/run.t @@ -299,10 +299,17 @@ Can init and build a new executable project dune test_exec_proj.ml - $ cd test_exec_proj && dune build + $ dune exec --root test_exec_proj ./bin/main.exe + Entering directory 'test_exec_proj' Info: Creating file dune-project with this contents: | (lang dune 2.0) | (name test_exec_proj) + Entering directory 'test_exec_proj' + Hello, World! + + $ dune exec --root test_exec_proj ./test/test_exec_proj.exe + Entering directory 'test_exec_proj' + Entering directory 'test_exec_proj' $ rm -rf ./test_exec_proj Can init and build a new library project @@ -320,10 +327,25 @@ Can init and build a new library project dune test_lib_proj.ml - $ cd test_lib_proj && dune build + $ dune build --root test_lib_proj @install --display short + Entering directory 'test_lib_proj' Info: Creating file dune-project with this contents: | (lang dune 2.0) | (name test_lib_proj) + ocamlc lib/.test_lib_proj.objs/byte/test_lib_proj.{cmi,cmo,cmt} + ocamlc lib/test_lib_proj.cma + ocamlopt lib/.test_lib_proj.objs/native/test_lib_proj.{cmx,o} + ocamlopt lib/test_lib_proj.{a,cmxa} + ocamlopt lib/test_lib_proj.cmxs + + $ dune runtest --root test_lib_proj --display short + Entering directory 'test_lib_proj' + ocamldep test/.test_lib_proj.eobjs/test_lib_proj.ml.d + ocamlc test/.test_lib_proj.eobjs/byte/dune__exe__Test_lib_proj.{cmi,cmo,cmt} + ocamlopt test/.test_lib_proj.eobjs/native/dune__exe__Test_lib_proj.{cmx,o} + ocamlopt test/test_lib_proj.exe + test_lib_proj alias test/runtest + Can init and build a project using Esy $ dune init proj test_esy_proj --pkg esy diff --git a/test/blackbox-tests/test-cases/dune-project-edition/run.t b/test/blackbox-tests/test-cases/dune-project-edition/run.t index 3da59ccb13e..6db66e56cc1 100644 --- a/test/blackbox-tests/test-cases/dune-project-edition/run.t +++ b/test/blackbox-tests/test-cases/dune-project-edition/run.t @@ -11,7 +11,7 @@ Test that using menhir automatically update the dune-project file $ echo '(library (name x)) (menhir (modules x))' >> src/dune - $ dune build + $ dune build @install Info: Appending this line to dune-project: (using menhir 2.0) $ cat dune-project (lang dune 2.0) diff --git a/test/blackbox-tests/test-cases/github1529/run.t b/test/blackbox-tests/test-cases/github1529/run.t index 40e0494e3c8..7503ebeeec3 100644 --- a/test/blackbox-tests/test-cases/github1529/run.t +++ b/test/blackbox-tests/test-cases/github1529/run.t @@ -1,7 +1,7 @@ Reproduction case for #1529: using an extension when no dune-project file is present. - $ dune build + $ dune build @install Info: Creating file dune-project with this contents: | (lang dune 2.0) Info: Appending this line to dune-project: (using menhir 2.0) diff --git a/test/blackbox-tests/test-cases/github1549/run.t b/test/blackbox-tests/test-cases/github1549/run.t index 62a21f45a44..ed89de4e414 100644 --- a/test/blackbox-tests/test-cases/github1549/run.t +++ b/test/blackbox-tests/test-cases/github1549/run.t @@ -1,6 +1,6 @@ Reproduction case for #1549: too many parentheses in installed .dune files - $ dune build --root backend + $ dune build @install --root backend Entering directory 'backend' $ cat backend/_build/install/default/lib/dune_inline_tests/dune-package diff --git a/test/blackbox-tests/test-cases/github2033/run.t b/test/blackbox-tests/test-cases/github2033/run.t index 869c0edafa4..6400635fdc1 100644 --- a/test/blackbox-tests/test-cases/github2033/run.t +++ b/test/blackbox-tests/test-cases/github2033/run.t @@ -1,2 +1,2 @@ . should be allowed in c names - $ dune build + $ dune build @install diff --git a/test/blackbox-tests/test-cases/optional/run.t b/test/blackbox-tests/test-cases/optional/run.t index 7750d0d411b..0b1025aad19 100644 --- a/test/blackbox-tests/test-cases/optional/run.t +++ b/test/blackbox-tests/test-cases/optional/run.t @@ -4,7 +4,7 @@ Various tests for optional libraries Regression test for non-wrapped optional libraries with missing dependencies (#1281): - $ dune build + $ dune build @install Interaction between `@all` and optional libraries: diff --git a/test/blackbox-tests/test-cases/private-public-overlap/run.t b/test/blackbox-tests/test-cases/private-public-overlap/run.t index 87fc040696e..cae689ee095 100644 --- a/test/blackbox-tests/test-cases/private-public-overlap/run.t +++ b/test/blackbox-tests/test-cases/private-public-overlap/run.t @@ -52,5 +52,5 @@ However, public binaries may accept private dependencies ocamlopt publicbin.exe Private dependencies shouldn't make the library optional - $ dune build --display short --root optional + $ dune build @install --display short --root optional Entering directory 'optional' diff --git a/test/blackbox-tests/test-cases/use-meta/run.t b/test/blackbox-tests/test-cases/use-meta/run.t index da00f8014ed..4f4c5fd15b3 100644 --- a/test/blackbox-tests/test-cases/use-meta/run.t +++ b/test/blackbox-tests/test-cases/use-meta/run.t @@ -1,2 +1,2 @@ - $ dune build && dune exec -- ocamlfind opt -package foobarlib -linkpkg main.ml -o main.exe && ./main.exe + $ dune build @install && dune exec -- ocamlfind opt -package foobarlib -linkpkg main.ml -o main.exe && ./main.exe foobarlib diff --git a/test/blackbox-tests/test-cases/variants/run.t b/test/blackbox-tests/test-cases/variants/run.t index a04d7f37fba..fb6d9819d2d 100644 --- a/test/blackbox-tests/test-cases/variants/run.t +++ b/test/blackbox-tests/test-cases/variants/run.t @@ -38,7 +38,7 @@ variants and finally default implementation. Check that variant data is installed in the dune package file. - $ dune build --root dune-package + $ dune build @install --root dune-package Entering directory 'dune-package' $ cat dune-package/_build/install/default/lib/a/dune-package (lang dune 2.0) diff --git a/test/blackbox-tests/test-cases/vendor/duniverse/dune-project b/test/blackbox-tests/test-cases/vendor/duniverse/dune-project index 0636ab6acf4..929c696e561 100644 --- a/test/blackbox-tests/test-cases/vendor/duniverse/dune-project +++ b/test/blackbox-tests/test-cases/vendor/duniverse/dune-project @@ -1 +1 @@ -(lang dune 1.11) +(lang dune 2.0) diff --git a/test/blackbox-tests/test-cases/vendor/duniverse/duniverse/vendored/dune-project b/test/blackbox-tests/test-cases/vendor/duniverse/duniverse/vendored/dune-project index bc29044968d..d58b8a48151 100644 --- a/test/blackbox-tests/test-cases/vendor/duniverse/duniverse/vendored/dune-project +++ b/test/blackbox-tests/test-cases/vendor/duniverse/duniverse/vendored/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 2.0) (name vendored) diff --git a/test/blackbox-tests/test-cases/vendor/run.t b/test/blackbox-tests/test-cases/vendor/run.t index 7af417fcd32..5d40424194d 100644 --- a/test/blackbox-tests/test-cases/vendor/run.t +++ b/test/blackbox-tests/test-cases/vendor/run.t @@ -1,6 +1,6 @@ Vendored directories should be traversed to find targets so that they are built when they are depend upon - $ dune build --root duniverse + $ dune build --root duniverse --debug-dependency-path Entering directory 'duniverse' Aliases should not be resolved in vendored sub directories