Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the default target to @all #2449

Merged
merged 3 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
-------------------

Expand Down
12 changes: 11 additions & 1 deletion src/build_system.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/gen_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 24 additions & 2 deletions test/blackbox-tests/test-cases/dune-init/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/dune-project-edition/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/github1529/run.t
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/github1549/run.t
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/github2033/run.t
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
. should be allowed in c names
$ dune build
$ dune build @install
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/optional/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/use-meta/run.t
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/variants/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(lang dune 1.11)
(lang dune 2.0)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
(lang dune 1.10)
(lang dune 2.0)
(name vendored)
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/vendor/run.t
Original file line number Diff line number Diff line change
@@ -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
Expand Down