Make the default build profile be dev

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jeremie Dimino 2018-06-27 19:06:38 +01:00 committed by Jérémie Dimino
parent 16d34f4a07
commit 2982567639
25 changed files with 79 additions and 50 deletions

View File

@ -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)
-----------------------

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1159,8 +1159,9 @@ using ``(js_of_ocaml (<js_of_ocaml-options>))``.
``<flags>`` 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:

View File

@ -64,9 +64,9 @@ Terminology
- **build profile**: a global setting that influence various
defaults. It can be set from the command line using ``--profile
<profile>`` or from ``jbuild-workspace`` files. The following
<profile>`` 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

View File

@ -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

View File

@ -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: [

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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 } =

View File

@ -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))

View File

@ -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

View File

@ -1 +0,0 @@
let hello = "hello"

View File

@ -1 +0,0 @@
let hello = "hello"

View File

@ -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

View File

@ -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}

View File

@ -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}

View File

@ -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:

View File

@ -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

View File

@ -1,4 +1,4 @@
open Str
open! Str
let foo () =
print_endline "foobarlib"

View File

@ -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

View File

@ -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)