Skip to content

Commit

Permalink
melange: set min version to 3.8 (#7665)
Browse files Browse the repository at this point in the history
* melange: set min version to 3.8

Signed-off-by: Javier Chávarri <[email protected]>
  • Loading branch information
jchavarri authored May 3, 2023
1 parent f446181 commit 988b0b2
Show file tree
Hide file tree
Showing 49 changed files with 108 additions and 73 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ Unreleased
that have been globally installed, such as those coming from opam
(@ejgallego, @Alizter)

- Bump minimum version of the dune language for the melange syntax extension
from 3.7 to 3.8 (#7665, @jchavarri)

3.7.1 (2023-04-04)
------------------

Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/melange/melange_stanzas.ml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ end
let syntax =
Dune_lang.Syntax.create ~name:Dune_project.Melange_syntax.name
~desc:"the Melange extension"
[ ((0, 1), `Since (3, 7)) ]
[ ((0, 1), `Since (3, 8)) ]

let () =
Dune_project.Extension.register_simple syntax
Expand Down
49 changes: 49 additions & 0 deletions test/blackbox-tests/test-cases/lib-modes.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Test library modes field

$ cat > dune-project <<EOF
> (lang dune 3.7)
> EOF

$ mkdir lib

$ cat > lib/dune <<EOF
> (library
> (modes :standard \ native)
> (name mylib))
> EOF

$ cat > lib/mylib.ml <<EOF
> let some_binding = "string"
> EOF

$ cat > dune <<EOF
> (executable
> (name hello)
> (libraries mylib))
> EOF

$ cat > hello.ml <<EOF
> let () =
> print_endline Mylib.some_binding
> EOF

Fails with an informative error message if we parsed OSL for modes
in a version of dune lang that does not support them

$ dune build hello.exe
File "lib/dune", line 1, characters 0-51:
1 | (library
2 | (modes :standard \ native)
3 | (name mylib))
Error: Ordered set language for modes is only available since version 3.8 of
the dune language. Please update your dune-project file to have (lang dune
3.8).
[1]

$ cat > dune-project <<EOF
> (lang dune 3.8)
> EOF

Works for the most recent version

$ dune build hello.exe
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test that the target directory exists

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/aliases.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test alias field on melange.emit stanzas

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/basic-install.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test that we can install melange mode libraries

$ cat >dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (package (name foo))
> (using melange 0.1)
> EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Example using melange.emit, copy_files and include_subdirs
> EOF

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Example showing melange.emit and copy_files, where the files are copied
into the melange.emit target folder

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/copy-files-simple.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test simple interactions between melange.emit and copy_files

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
6 changes: 3 additions & 3 deletions test/blackbox-tests/test-cases/melange/depend-on-installed.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Test dependency on installed package
$ mkdir a b prefix app

$ cat > a/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (package (name a))
> (using melange 0.1)
> EOF
Expand Down Expand Up @@ -34,7 +34,7 @@ Test dependency on installed package
Installing $TESTCASE_ROOT/prefix/lib/a/melange/a__Foo.cmt

$ cat >b/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (package (name b))
> (using melange 0.1)
> EOF
Expand Down Expand Up @@ -80,7 +80,7 @@ Test dependency on installed package
Installing $TESTCASE_ROOT/prefix/lib/b/melange/b__Foo.cmt

$ cat >app/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (package (name app))
> (using melange 0.1)
> EOF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(lang dune 3.7)
(lang dune 3.8)

(using melange 0.1)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ form `foo.bar.baz`

$ mkdir a app
$ cat > a/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (package (name a))
> (using melange 0.1)
> EOF
Expand Down Expand Up @@ -39,7 +39,7 @@ form `foo.bar.baz`
(source (path Foo) (impl (path sub/foo.ml))))))

$ cat >app/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 3.7)
(lang dune 3.8)

(package
(name pkg2))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 3.7)
(lang dune 3.8)

(package
(name pkg1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Test dependency on installed package
$ mkdir a b c prefix

$ cat > a/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (package (name a))
> (using melange 0.1)
> EOF
Expand Down Expand Up @@ -39,7 +39,7 @@ Test dependency on installed package
Installing $TESTCASE_ROOT/prefix/lib/a/melange/a__Foo.cmt

$ cat >b/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand All @@ -65,7 +65,7 @@ Test dependency on installed package
foo

$ cat >c/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/melange/emit-installed.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Test dependency on installed package
$ mkdir -p lib-a lib-a/sub b prefix

$ cat > lib-a/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (package (name a))
> (using melange 0.1)
> EOF
Expand Down Expand Up @@ -43,7 +43,7 @@ Test dependency on installed package
Installing $TESTCASE_ROOT/prefix/lib/a/sub/sub.ml

$ cat >b/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/emit-private.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test dependency on a private library in the same package as melange.emit

$ cat >dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (package (name a))
> (using melange 0.1)
> EOF
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/emit-select.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using `(select ...)` in melange.emit

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF
$ cat >bar.melange.ml <<EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Test dependency on installed package
$ mkdir xyz

$ cat > xyz/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (package (name aa_fe))
> (using melange 0.1)
> EOF
Expand All @@ -19,12 +19,12 @@ Test dependency on installed package
> EOF

$ cat >dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

$ cat >dune-workspace <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> EOF

$ cat > dune <<EOF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test (modules) field can be left empty

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/empty-entries.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test (modules) field can be left empty

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/flags.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test flags and compile_flags fields on melange.emit stanza

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/melange/gh7020.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Reproduce github #7020
$ dir=_to-install
$ mkdir $dir
$ cat >$dir/dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> (package
> (name dummyfoo))
Expand Down Expand Up @@ -35,7 +35,7 @@ Reproduce github #7020
$ export OCAMLPATH=$PWD/$dir/_install/lib

$ cat >dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(lang dune 3.7)
(lang dune 3.8)

(using melange 0.1)
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/intfonly-entries.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Entry points should not allow mli only modules as entry points.

$ cat >dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(lang dune 3.7)
(lang dune 3.8)

(using melange 0.1)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Show that the merlin config knows about melange.compile_flags

$ cat >dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/merlin.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$ export BUILD_PATH_PREFIX_MAP="/MELC_STDLIB=$(ocamlfind query melange):$BUILD_PATH_PREFIX_MAP"

$ cat >dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/missing-melc.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Test cases when melc is not available

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/mli.t/dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 3.7)
(lang dune 3.8)

(using melange 0.1)

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/module-systems.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Parses the full form (<module-system> <extension>)

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 3.7)
(lang dune 3.8)

(using melange 0.1)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Make sure an error is returned if trying to nest `melange.emit` stanzas

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (lang dune 3.8)
> (using melange 0.1)
> EOF
$ mkdir -p a/output/b
Expand Down
Loading

0 comments on commit 988b0b2

Please sign in to comment.