diff --git a/bin/main.ml b/bin/main.ml index 2a22e5b2..2ed594e8 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -291,10 +291,11 @@ let common = Arg.(value & opt (some mode) None & info ["promote"] ~docs - ~doc:"How to interpret promote actions. $(b,check), the default, means to - only check that promoted files are equal to the source files. - $(b,ignore) means to ignore promote action altogether and $(b,copy) - means to copy generated files to the source tree.") + ~doc:"How to interpret promote actions. $(b,copy) means to print + a diff and copy the generated files to the source tree when + they differ. $(b,copy) is the default. $(b,check) means to + only print a diff without copying files. $(b,ignore) means + to ignore promote action altogether.") in let for_release = "for-release-of-packages" in let frop = @@ -327,7 +328,7 @@ let common = | None, _, _, _ -> `Ok (root, only_packages, - Option.value promote ~default:Clflags.Promote_mode.Check, + Option.value promote ~default:Clflags.Promote_mode.Copy, List.concat [ dump_opt "--root" root ; dump_opt "--only-packages" only_packages diff --git a/doc/jbuild.rst b/doc/jbuild.rst index f5aaa4b3..4e290394 100644 --- a/doc/jbuild.rst +++ b/doc/jbuild.rst @@ -563,7 +563,7 @@ With this jbuild file, running jbuilder as follow will replace the .. code:: shell - $ jbuilder build @jbuild --promote copy + $ jbuilder build @jbuild Common items ============ @@ -1158,12 +1158,13 @@ How jbuilder interprets promotions can be controlled using the ``--promote`` command line argument. The following behaviors are available: -- ``--promote check``: this is the default. Jbuilder just checks that - the two files given in each ``( as )`` form are equal. If not, - it prints a diff +- ``--promote copy``: when the two files given in a ``( as )`` + form are different, jbuilder prints a diff and copies ```` to + ```` directly in the source + tree. This is the default +- ``--promote check``: Jbuilder just checks that the two files are + equal and print a diff when there are not - ``--promote ignore``: ``promote`` actions are simply ignored -- ``--promote copy``: when the two files are different, jbuilder - prints a diff and copies ```` to ```` directly in the source tree Note that ``-p/--for-release-of-packages`` implies ``--promote ignore``. diff --git a/src/clflags.ml b/src/clflags.ml index 3f2967d3..e5d34753 100644 --- a/src/clflags.ml +++ b/src/clflags.ml @@ -28,4 +28,4 @@ module Promote_mode = struct | "copy" -> Some Copy | _ -> None end -let promote_mode = ref Promote_mode.Check +let promote_mode = ref Promote_mode.Copy diff --git a/test/blackbox-tests/test-cases/promote/run.t b/test/blackbox-tests/test-cases/promote/run.t index 8f8ffb8b..61ca9625 100644 --- a/test/blackbox-tests/test-cases/promote/run.t +++ b/test/blackbox-tests/test-cases/promote/run.t @@ -1,6 +1,6 @@ $ echo titi > x - $ $JBUILDER build --root . -j1 --diff-command false @blah + $ $JBUILDER build --root . -j1 --diff-command false @blah --promote check sh (internal) (exit 1) /usr/bin/sh -c 'false '\''x'\'' '\''_build/default/x.gen'\''' [1] @@ -11,11 +11,11 @@ $ cat x titi - $ $JBUILDER build --root . -j1 --diff-command false @blah --promote copy + $ $JBUILDER build --root . -j1 --diff-command false @blah sh (internal) (exit 1) /usr/bin/sh -c 'false '\''x'\'' '\''_build/default/x.gen'\''' Promoting _build/default/x.gen to x. [1] $ cat x toto - $ $JBUILDER build --root . -j1 --diff-command false @blah --promote copy + $ $JBUILDER build --root . -j1 --diff-command false @blah