Skip to content

Commit

Permalink
Enable variants in lang dune 1.7
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Dec 15, 2018
1 parent 09aad34 commit cad0b6a
Show file tree
Hide file tree
Showing 37 changed files with 98 additions and 196 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ unreleased

- Remove `--stats` and track fd usage in `--trace-file` (#1667, @emillon)

- Add virtual libraries feature and enable it by default (#1430 fixes #921,
@rgrinberg)

1.6.2 (05/12/2018)
------------------

Expand Down
10 changes: 3 additions & 7 deletions doc/variants.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
*******************************************
Virtual Libraries & Variants (experimental)
*******************************************

.. attention::
This feature is experimental. It is expected to land in dune in a next
release, but the precise syntax and semantics are not yet defined.
****************************
Virtual Libraries & Variants
****************************

Virtual libraries correspond to dune's ability to compile parameterized
libraries and delay the selection of concrete implementations until linking an
Expand Down
6 changes: 2 additions & 4 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
(lang dune 1.6)
(name dune)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
(name dune)
16 changes: 2 additions & 14 deletions src/dune_file.ml
Original file line number Diff line number Diff line change
Expand Up @@ -737,18 +737,6 @@ module Mode_conf = struct
end

module Library = struct
module Variants = struct
let syntax =
let syntax =
Syntax.create ~name:"in_development_do_not_use_variants"
~desc:"the experimental variants feature"
[ (0, 1) ]
in
Dune_project.Extension.register_simple ~experimental:true
syntax (Dune_lang.Decoder.return []);
syntax
end

module Wrapped = struct
type t =
| Simple of bool
Expand Down Expand Up @@ -870,11 +858,11 @@ module Library = struct
and dune_version = Syntax.get_exn Stanza.syntax
and virtual_modules =
field_o "virtual_modules" (
Syntax.since Variants.syntax (0, 1)
Syntax.since Stanza.syntax (1, 7)
>>= fun () -> Ordered_set_lang.decode)
and implements =
field_o "implements" (
Syntax.since Variants.syntax (0, 1)
Syntax.since Stanza.syntax (1, 7)
>>= fun () -> located Lib_name.decode)
and private_modules =
field_o "private_modules" (
Expand Down
2 changes: 1 addition & 1 deletion src/stanza.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ end
let syntax =
Syntax.create ~name:"dune" ~desc:"the dune language"
[ (0, 0) (* Jbuild syntax *)
; (1, 6)
; (1, 7)
]

module File_kind = struct
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/dune-package/run.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ dune build
$ cat _build/install/default/lib/a/dune-package
(lang dune 1.6)
(lang dune 1.7)
(name a)
(library
(name a)
Expand Down
6 changes: 3 additions & 3 deletions test/blackbox-tests/test-cases/dune-project-edition/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
$ mkdir src
$ echo '(alias (name runtest) (action (progn)))' > src/dune
$ dune build
Info: creating file dune-project with this contents: (lang dune 1.6)
Info: creating file dune-project with this contents: (lang dune 1.7)
$ cat dune-project
(lang dune 1.6)
(lang dune 1.7)

Test that using menhir automatically update the dune-project file

$ echo '(library (name x)) (menhir (modules x))' >> src/dune
$ dune build
Info: appending this line to dune-project: (using menhir 2.0)
$ cat dune-project
(lang dune 1.6)
(lang dune 1.7)
(using menhir 2.0)
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/github1529/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ Reproduction case for #1529: using an extension when no dune-project
file is present.

$ dune build
Info: creating file dune-project with this contents: (lang dune 1.6)
Info: creating file dune-project with this contents: (lang dune 1.7)
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
Expand Up @@ -4,7 +4,7 @@ Reproduction case for #1549: too many parentheses in installed .dune files
Entering directory 'backend'

$ cat backend/_build/install/default/lib/dune_inline_tests/dune-package
(lang dune 1.6)
(lang dune 1.7)
(name dune_inline_tests)
(library
(name dune_inline_tests)
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/inline_tests/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
backend_mbc1

$ dune runtest dune-file
(lang dune 1.6)
(lang dune 1.7)
(name foo)
(library
(name foo)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.2)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.5)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.2)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.4)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.6)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.6)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
(lang dune 1.2)
(using in_development_do_not_use_variants 0.1)
(lang dune 1.5)
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
(lang dune 1.2)
(using in_development_do_not_use_variants 0.1)
(lang dune 1.5)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.2)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.2)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.2)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
(lang dune 1.2)
(using in_development_do_not_use_variants 0.1)
(lang dune 1.5)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.1)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.5)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.2)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.5)
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ let gen_test ~impl ~modules_without_implementation ~virtual_modules
let _ = Sys.command (sprintf "mkdir -p %s" dir) in
chdir dir ~f:(fun () ->
write_file ~file:"dune-project"
~contents:"(lang dune 1.2)\n\
(using in_development_do_not_use_variants 0.1)";
~contents:"(lang dune 1.5)\n";
write_file ~file:"m.mli" ~contents:"";
if impl then
write_file ~file:"m.ml" ~contents:"";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.6)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
(lang dune 1.4)

(using in_development_do_not_use_variants 0.1)
(lang dune 1.7)
Loading

0 comments on commit cad0b6a

Please sign in to comment.