From 99e068644715426ec25fecdcb1c8faa3a86b986f Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 7 Aug 2018 00:34:35 +0300 Subject: [PATCH 1/2] Test case for --dev bug jbuilder doesn't accept --dev like it should Signed-off-by: Rudi Grinberg --- test/blackbox-tests/dune.inc | 10 ++++++++++ .../blackbox-tests/test-cases/dev-flag-1103/run.t | 15 +++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/blackbox-tests/test-cases/dev-flag-1103/run.t diff --git a/test/blackbox-tests/dune.inc b/test/blackbox-tests/dune.inc index c41db9a7dd7..af7c5ab8e32 100644 --- a/test/blackbox-tests/dune.inc +++ b/test/blackbox-tests/dune.inc @@ -95,6 +95,14 @@ test-cases/depend-on-the-universe (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) +(alias + (name dev-flag-1103) + (deps (package dune) (source_tree test-cases/dev-flag-1103)) + (action + (chdir + test-cases/dev-flag-1103 + (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) + (alias (name dune-jbuild-var-case) (deps (package dune) (source_tree test-cases/dune-jbuild-var-case)) @@ -755,6 +763,7 @@ (alias custom-build-dir) (alias dep-vars) (alias depend-on-the-universe) + (alias dev-flag-1103) (alias dune-jbuild-var-case) (alias dune-ppx-driver-system) (alias dune-project-edition) @@ -848,6 +857,7 @@ (alias custom-build-dir) (alias dep-vars) (alias depend-on-the-universe) + (alias dev-flag-1103) (alias dune-jbuild-var-case) (alias dune-ppx-driver-system) (alias dune-project-edition) diff --git a/test/blackbox-tests/test-cases/dev-flag-1103/run.t b/test/blackbox-tests/test-cases/dev-flag-1103/run.t new file mode 100644 index 00000000000..bcac035f40e --- /dev/null +++ b/test/blackbox-tests/test-cases/dev-flag-1103/run.t @@ -0,0 +1,15 @@ +jbuilder --dev flag is accepted + + $ jbuilder build --dev + dune: --dev is no longer accepted as it is now the default. + Usage: dune build [OPTION]... [TARGET]... + Try `dune build --help' or `dune --help' for more information. + [1] + +dune --dev flag is rejected + + $ dune build --dev + dune: --dev is no longer accepted as it is now the default. + Usage: dune build [OPTION]... [TARGET]... + Try `dune build --help' or `dune --help' for more information. + [1] From f74a064aed444464a4111bcd472f4e3698780862 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 7 Aug 2018 00:36:27 +0300 Subject: [PATCH 2/2] Fix #1103 Signed-off-by: Rudi Grinberg --- CHANGES.md | 6 ++++++ bin/main.ml | 7 ++++--- test/blackbox-tests/test-cases/dev-flag-1103/run.t | 4 ---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3b4bdd3938d..e4b4238d8bb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +next +---- + +- Fix `$ jbuilder --dev` (#1104, fixes #1103, @rgrinberg) + + 1.1.0 (06/08/2018) ------------------ diff --git a/bin/main.ml b/bin/main.ml index 6f9e6009e75..d9a8f494807 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -399,9 +399,10 @@ let common = & info ["dev"] ~docs ~doc:{|Same as $(b,--profile dev)|}) in - match dev with - | false -> `Ok false - | true -> + match dev, Which_program.t with + | false, (Dune | Jbuilder) -> `Ok false + | true, Jbuilder -> `Ok true + | true, Dune -> `Error (true, "--dev is no longer accepted as it is now the default.") and profile = diff --git a/test/blackbox-tests/test-cases/dev-flag-1103/run.t b/test/blackbox-tests/test-cases/dev-flag-1103/run.t index bcac035f40e..42eb527e8f8 100644 --- a/test/blackbox-tests/test-cases/dev-flag-1103/run.t +++ b/test/blackbox-tests/test-cases/dev-flag-1103/run.t @@ -1,10 +1,6 @@ jbuilder --dev flag is accepted $ jbuilder build --dev - dune: --dev is no longer accepted as it is now the default. - Usage: dune build [OPTION]... [TARGET]... - Try `dune build --help' or `dune --help' for more information. - [1] dune --dev flag is rejected