diff --git a/CHANGES.md b/CHANGES.md index 19dd01fbdbe..558ffb360a9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -91,6 +91,8 @@ next - Make `(diff a b)` ignore trailing cr on Windows and add `(cmp a b)` for comparing binary files (#904, fix #844, @diml) +- Make `dev` the default build profile (#920, @diml) + 1.0+beta20 (10/04/2018) ----------------------- diff --git a/Makefile b/Makefile index 722497e54c1..0c65c2519e7 100644 --- a/Makefile +++ b/Makefile @@ -4,10 +4,10 @@ BIN := ./_build/default/bin/main_dune.exe -include Makefile.dev default: boot.exe - ./boot.exe --dev + ./boot.exe release: boot.exe - ./boot.exe + ./boot.exe --release boot.exe: bootstrap.ml ocaml bootstrap.ml @@ -21,13 +21,13 @@ uninstall: reinstall: uninstall reinstall test: - $(BIN) runtest --dev + $(BIN) runtest test-js: - $(BIN) build @runtest-js --dev + $(BIN) build @runtest-js test-all: - $(BIN) build @runtest @runtest-js --dev + $(BIN) build @runtest @runtest-js promote: $(BIN) promote @@ -35,7 +35,7 @@ promote: accept-corrections: promote all-supported-ocaml-versions: - $(BIN) build --dev @install @runtest --workspace dune-workspace.dev --root . + $(BIN) build @install @runtest --workspace dune-workspace.dev --root . clean: $(BIN) clean @@ -52,7 +52,7 @@ livedoc: -p 8888 -q --host $(shell hostname) -r '\.#.*' update-jbuilds: $(BIN) - $(BIN) build --dev @doc/runtest --auto-promote + $(BIN) build @doc/runtest --auto-promote .PHONY: default install uninstall reinstall clean test doc .PHONY: promote accept-corrections opam-release diff --git a/appveyor.yml b/appveyor.yml index a426458418a..71016ad4d6c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ install: build_script: - cd "%APPVEYOR_BUILD_FOLDER%" - ocaml bootstrap.ml - - boot.exe --dev + - boot.exe - copy _build\install\default\bin\dune.exe dune.exe - dune.exe build @test\blackbox-tests\windows-diff diff --git a/bin/main.ml b/bin/main.ml index 6ffdfdd953e..7e5d872bba4 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -347,12 +347,26 @@ let common = & info ["dev"] ~docs ~doc:{|Same as $(b,--profile dev)|}) in + let dev = + match Which_program.t with + | Jbuilder -> dev + | Dune -> + let check = function + | false -> `Ok false + | true -> + `Error (true, "--dev is no longer accepted as it is now the default.") + in + Term.(ret (const check $ dev)) + in let profile = Arg.(value & opt (some string) None & info ["profile"] ~docs - ~doc:{|Select the build profile, for instance $(b,dev) or $(b,release). - The default is $(b,default).|}) + ~doc: + (sprintf + {|Select the build profile, for instance $(b,dev) or + $(b,release). The default is $(b,%s).|} + Config.default_build_profile)) in let profile = let merge dev profile = @@ -567,7 +581,7 @@ let installed_libraries = Scheduler.go ~log:(Log.create common) ~common (Context.create (Default { targets = [Native] - ; profile = "default" }) + ; profile = Config.default_build_profile }) ~env >>= fun ctxs -> let ctx = List.hd ctxs in diff --git a/doc/jbuild.rst b/doc/jbuild.rst index 9009f45757b..369c69eefd9 100644 --- a/doc/jbuild.rst +++ b/doc/jbuild.rst @@ -1159,8 +1159,9 @@ using ``(js_of_ocaml ())``. ```` is specified in the `Ordered set language`_. -The default value for ``(flags ...)`` depends on whether ``--dev`` is passed to -Jbuilder. ``--dev`` will enable sourcemap and the pretty JavaScript output. +The default value for ``(flags ...)`` depends on the selected build +profile. The build profile ``dev`` (the default) will enable sourcemap +and the pretty JavaScript output. .. _user-actions: diff --git a/doc/terminology.rst b/doc/terminology.rst index 5339c962408..0afb5801959 100644 --- a/doc/terminology.rst +++ b/doc/terminology.rst @@ -64,9 +64,9 @@ Terminology - **build profile**: a global setting that influence various defaults. It can be set from the command line using ``--profile - `` or from ``jbuild-workspace`` files. The following + `` or from ``dune-workspace`` files. The following profiles are standard: - - ``default`` which is the default profile when none is set explicitely - ``release`` which is the profile used for opam releases - - ``dev`` which has stricter warnings + - ``dev`` which is the default profile when none is set explicitely, it + has stricter warnings that the ``release`` one diff --git a/doc/usage.rst b/doc/usage.rst index f62605a6362..4a5a9a9e1f9 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -224,7 +224,7 @@ follows: :: - build: [["jbuilder" "build" "-p" name "-j" jobs]] + build: [["dune" "build" "-p" name "-j" jobs]] ``-p pkg`` is a shorthand for ``--root . --only-packages pkg --profile release``. ``-p`` is the short version of @@ -364,7 +364,7 @@ write a ``(profile ...)`` stanza. For instance: .. code:: scheme - (profile dev) + (profile release) Note that the command line option ``--profile`` has precedence over this stanza. @@ -436,8 +436,9 @@ It supports two modes of compilation: separately and then linked together. This mode is useful during development as it builds more quickly. -The separate compilation mode will be selected when passing ``--dev`` to -jbuilder. There is currently no other way to control this behaviour. +The separate compilation mode will be selected when the build profile +is ``dev``, which is the default. There is currently no other way to +control this behaviour. See the section about :ref:`jbuild-jsoo` for passing custom flags to the js_of_ocaml compiler diff --git a/dune.opam b/dune.opam index f87556a7719..6dad0a7828a 100644 --- a/dune.opam +++ b/dune.opam @@ -8,8 +8,8 @@ license: "MIT" build: [ ["ocaml" "configure.ml" "--libdir" lib] ["ocaml" "bootstrap.ml"] - ["./boot.exe" "--subst"] {pinned} - ["./boot.exe" "-j" jobs] + ["./boot.exe" "--release" "--subst"] {pinned} + ["./boot.exe" "--release" "-j" jobs] ] available: [ ocaml-version >= "4.02.3" ] conflicts: [ diff --git a/src/config.ml b/src/config.ml index ea381510ecb..28d4d45eca6 100644 --- a/src/config.ml +++ b/src/config.ml @@ -24,6 +24,11 @@ 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") +let default_build_profile = + match Which_program.t with + | Dune -> "dev" + | Jbuilder -> "release" + open Sexp.Of_sexp module Display = struct diff --git a/src/config.mli b/src/config.mli index e82b847aae5..7e03b92e78d 100644 --- a/src/config.mli +++ b/src/config.mli @@ -21,6 +21,8 @@ val inside_emacs : bool (** Are we running insinde Dune? *) val inside_dune : bool +val default_build_profile : string + (** Jbuilder configuration *) module Display : sig diff --git a/src/dune b/src/dune index 254d8cf3658..0baaf2a05d8 100644 --- a/src/dune +++ b/src/dune @@ -7,7 +7,8 @@ re opam_file_format usexp - ocaml_config) + ocaml_config + which_program) (synopsis "Internal Dune library, do not use!")) (ocamllex meta_lexer glob_lexer dune_lexer) diff --git a/src/main.ml b/src/main.ml index 33c1f649ac5..22c8754fd85 100644 --- a/src/main.ml +++ b/src/main.ml @@ -77,7 +77,9 @@ let setup ?(log=Log.no_log) | None -> Native | Some x -> Named x ] - ; profile = Option.value profile ~default:"default" + ; profile = + Option.value profile + ~default:Config.default_build_profile }] } in @@ -229,8 +231,8 @@ let bootstrap () = let profile = ref None in Arg.parse [ "-j" , String concurrency_arg, "JOBS concurrency" - ; "--dev" , Unit (fun () -> profile := Some "dev"), - " set development mode" + ; "--release" , Unit (fun () -> profile := Some "release"), + " set release mode" ; "--display" , display_mode , " set the display mode" ; "--subst" , Unit subst , " substitute watermarks in source files" @@ -242,7 +244,7 @@ let bootstrap () = Clflags.debug_dep_path := true; let config = (* Only load the configuration with --dev *) - if !profile = Some "dev" then + if !profile <> Some "release" then Config.load_user_config_file () else Config.default diff --git a/src/workspace.ml b/src/workspace.ml index 1ac468c6b1d..cc177cf8f22 100644 --- a/src/workspace.ml +++ b/src/workspace.ml @@ -120,7 +120,7 @@ let t ?x ?profile:cmdline_profile sexps = | _ :: (loc, _) :: _, _ -> Loc.fail loc "profile defined too many times" | _, Some p -> p - | [], None -> "default" + | [], None -> Config.default_build_profile | [(_, p)], None -> p in let { merlin_context; contexts } = diff --git a/test/blackbox-tests/test-cases/env/run.t b/test/blackbox-tests/test-cases/env/run.t index 3f9588ed6d3..77562762a24 100644 --- a/test/blackbox-tests/test-cases/env/run.t +++ b/test/blackbox-tests/test-cases/env/run.t @@ -1,34 +1,34 @@ - $ dune printenv . + $ dune printenv --profile default . ( (flags (-w -40 -plop)) (ocamlc_flags (-g)) (ocamlopt_flags (-g)) ) - $ dune printenv src + $ dune printenv --profile default src ( (flags (-w -40 -plop -truc)) (ocamlc_flags (-g)) (ocamlopt_flags (-g)) ) - $ dune printenv bin + $ dune printenv --profile default bin ( (flags (-machin)) (ocamlc_flags (-g)) (ocamlopt_flags (-g)) ) - $ dune printenv vendor + $ dune printenv --profile default vendor ( (flags (-w -40 -plop)) (ocamlc_flags (-g)) (ocamlopt_flags (-g)) ) - $ dune printenv vendor/a + $ dune printenv --profile default vendor/a ( (flags (-w -40 -bidule)) (ocamlc_flags (-g)) (ocamlopt_flags (-g)) ) - $ dune printenv vendor/a/src + $ dune printenv --profile default vendor/a/src ( (flags (-w -40 -bidule -pouet)) (ocamlc_flags (-g)) diff --git a/test/blackbox-tests/test-cases/exec-cmd/run.t b/test/blackbox-tests/test-cases/exec-cmd/run.t index e11282b8b4b..8942780ce1b 100644 --- a/test/blackbox-tests/test-cases/exec-cmd/run.t +++ b/test/blackbox-tests/test-cases/exec-cmd/run.t @@ -8,7 +8,7 @@ ocamlopt .foo.eobjs/foo.{cmx,o} ocamlopt foo.exe Foo - $ dune exec --dev ./foo.exe --display short + $ dune exec --profile release ./foo.exe --display short ocamlc .foo.eobjs/foo.{cmi,cmo,cmt} ocamlopt .foo.eobjs/foo.{cmx,o} ocamlopt foo.exe diff --git a/test/blackbox-tests/test-cases/github660/explicit-interfaces/lib_sub.ml b/test/blackbox-tests/test-cases/github660/explicit-interfaces/lib_sub.ml deleted file mode 100644 index e33bd25c296..00000000000 --- a/test/blackbox-tests/test-cases/github660/explicit-interfaces/lib_sub.ml +++ /dev/null @@ -1 +0,0 @@ -let hello = "hello" diff --git a/test/blackbox-tests/test-cases/github660/no-interfaces/lib_sub.ml b/test/blackbox-tests/test-cases/github660/no-interfaces/lib_sub.ml deleted file mode 100644 index e33bd25c296..00000000000 --- a/test/blackbox-tests/test-cases/github660/no-interfaces/lib_sub.ml +++ /dev/null @@ -1 +0,0 @@ -let hello = "hello" diff --git a/test/blackbox-tests/test-cases/github660/run.t b/test/blackbox-tests/test-cases/github660/run.t index 9eff5181bd6..ef75ae81bb1 100644 --- a/test/blackbox-tests/test-cases/github660/run.t +++ b/test/blackbox-tests/test-cases/github660/run.t @@ -1,10 +1,13 @@ + $ echo 'let hello = "hello"' > explicit-interfaces/lib_sub.ml + $ echo 'let hello = "hello"' > no-interfaces/lib_sub.ml + When there are explicit interfaces, modules must be rebuilt. $ dune runtest --root explicit-interfaces Entering directory 'explicit-interfaces' main alias runtest hello - $ echo 'let x = 1' >> explicit-interfaces/lib_sub.ml + $ echo 'let _x = 1' >> explicit-interfaces/lib_sub.ml $ dune runtest --root explicit-interfaces Entering directory 'explicit-interfaces' main alias runtest @@ -17,7 +20,7 @@ to rely on these. Entering directory 'no-interfaces' main alias runtest hello - $ echo 'let x = 1' >> no-interfaces/lib_sub.ml + $ echo 'let _x = 1' >> no-interfaces/lib_sub.ml $ dune runtest --root no-interfaces Entering directory 'no-interfaces' main alias runtest diff --git a/test/blackbox-tests/test-cases/js_of_ocaml/run.t b/test/blackbox-tests/test-cases/js_of_ocaml/run.t index adfb925f7e2..f046a83e7da 100644 --- a/test/blackbox-tests/test-cases/js_of_ocaml/run.t +++ b/test/blackbox-tests/test-cases/js_of_ocaml/run.t @@ -1,4 +1,4 @@ - $ dune build --display short --dev bin/technologic.bc.js @install lib/x.cma.js lib/x__Y.cmo.js bin/z.cmo.js + $ dune build --display short bin/technologic.bc.js @install lib/x.cma.js lib/x__Y.cmo.js bin/z.cmo.js ocamlc lib/stubs$ext_obj ocamlmklib lib/dllx_stubs$ext_dll,lib/libx_stubs$ext_lib ocamlopt .ppx/js_of_ocaml-ppx/ppx.exe @@ -34,7 +34,7 @@ use it break it fix it - $ dune build --display short bin/technologic.bc.js @install + $ dune build --display short bin/technologic.bc.js @install --profile release ocamlc lib/.x.objs/x__.{cmi,cmo,cmt} ocamlc lib/.x.objs/x__Y.{cmi,cmo,cmt} ocamlc lib/.x.objs/x.{cmi,cmo,cmt} diff --git a/test/blackbox-tests/test-cases/merlin-tests/run.t b/test/blackbox-tests/test-cases/merlin-tests/run.t index 53ee57d9d39..91b53db185d 100644 --- a/test/blackbox-tests/test-cases/merlin-tests/run.t +++ b/test/blackbox-tests/test-cases/merlin-tests/run.t @@ -1,4 +1,4 @@ - $ dune build @print-merlins --display short + $ dune build @print-merlins --display short --profile release ocamldep sanitize-dot-merlin/.sanitize_dot_merlin.eobjs/sanitize_dot_merlin.ml.d ocamlc sanitize-dot-merlin/.sanitize_dot_merlin.eobjs/sanitize_dot_merlin.{cmi,cmo,cmt} ocamlopt sanitize-dot-merlin/.sanitize_dot_merlin.eobjs/sanitize_dot_merlin.{cmx,o} diff --git a/test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t b/test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t index 617a8322e50..8513f582eb4 100644 --- a/test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t +++ b/test/blackbox-tests/test-cases/ocamldep-multi-stanzas/run.t @@ -1,4 +1,4 @@ - $ dune exec ./test.exe --debug-dep --display short --root jbuild + $ dune exec ./test.exe --debug-dep --display short --root jbuild --profile release Entering directory 'jbuild' File "jbuild", line 1, characters 0-0: Warning: Module "Lib" is used in several stanzas: diff --git a/test/blackbox-tests/test-cases/ppx-rewriter/ppx/fooppx.ml b/test/blackbox-tests/test-cases/ppx-rewriter/ppx/fooppx.ml index d66308a9708..ceca278aeb1 100644 --- a/test/blackbox-tests/test-cases/ppx-rewriter/ppx/fooppx.ml +++ b/test/blackbox-tests/test-cases/ppx-rewriter/ppx/fooppx.ml @@ -8,7 +8,7 @@ let () = ; "-arg", Arg.Set_string arg, "" ]) Migrate_parsetree.Versions.ocaml_405 - (fun _ cookies -> + (fun _ _cookies -> if not !flag then ( Format.eprintf "pass -flag to fooppx@.%!"; exit 1 diff --git a/test/blackbox-tests/test-cases/use-meta/foobarlib/foobarlib.ml b/test/blackbox-tests/test-cases/use-meta/foobarlib/foobarlib.ml index a691c05551a..5bde92ff950 100644 --- a/test/blackbox-tests/test-cases/use-meta/foobarlib/foobarlib.ml +++ b/test/blackbox-tests/test-cases/use-meta/foobarlib/foobarlib.ml @@ -1,4 +1,4 @@ -open Str +open! Str let foo () = print_endline "foobarlib" diff --git a/test/bulk-update.sh b/test/bulk-update.sh index 5a526dfd005..da4add3cf8d 100644 --- a/test/bulk-update.sh +++ b/test/bulk-update.sh @@ -6,15 +6,15 @@ # the current test succeeds. It uses inotifywait to detect changes to # the test. -DUNE=_build/default/bin/main.exe +DUNE=_build/default/bin/main_dune.exe LIST=$(mktemp) trap "rm -f $LIST" EXIT echo "Computing the list of failing tests..." $DUNE runtest test/blackbox-tests \ - --diff-command "echo >> $LIST" --dev &> /dev/null -TESTS=$(cat /tmp/list |cut -d/ -f4 |sed 's/^//') + --diff-command "echo >> $LIST" &> /dev/null +TESTS=$(cat $LIST |cut -d/ -f4 |sed 's/^//') rm -f $LIST count=0 @@ -32,7 +32,7 @@ for t in $TESTS; do echo "$title" echo "${title//?/=}" echo - $DUNE build --dev @test/blackbox-tests/$t && break + $DUNE build @test/blackbox-tests/$t && break inotifywait $(find test/blackbox-tests/test-cases/$t -type d) \ -e modify,attrib,close_write,move,create,delete done diff --git a/test/unit-tests/dune b/test/unit-tests/dune index 42e50646215..b5355c99546 100644 --- a/test/unit-tests/dune +++ b/test/unit-tests/dune @@ -3,7 +3,7 @@ (modules expect_test) (link_flags (-linkall)) (modes byte) - (libraries unix dune compiler-libs.toplevel test_common)) + (libraries which_program_dune unix dune compiler-libs.toplevel test_common)) (ocamllex expect_test)