This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,79 @@
|
|||
(dirs sub sub2 sub3)
|
||||
|
||||
(rule (with-stdout-to a.ml (progn)))
|
||||
(rule (with-stdout-to b.ml (progn)))
|
||||
(rule (with-stdout-to c.ml (progn)))
|
||||
(rule (with-stdout-to d.ml (progn)))
|
||||
|
||||
(library
|
||||
(name a1)
|
||||
(modules a))
|
||||
|
||||
(executable
|
||||
(name b)
|
||||
(modules b))
|
||||
|
||||
(library
|
||||
(name c1)
|
||||
(wrapped false)
|
||||
(modules c))
|
||||
|
||||
(library
|
||||
(name c2)
|
||||
(wrapped (transition now))
|
||||
(modules d))
|
||||
|
||||
(rule (with-stdout-to foo.ml (progn)))
|
||||
|
||||
(library
|
||||
(name foo)
|
||||
(modules foo))
|
||||
|
||||
(alias
|
||||
(name t1)
|
||||
(deps %{cmo:a} %{cmo:b} %{cmo:c} %{cmo:d}))
|
||||
|
||||
(alias
|
||||
(name t2)
|
||||
(deps %{cmi:a}))
|
||||
|
||||
(alias
|
||||
(name t4)
|
||||
(deps %{cmxa:a1}))
|
||||
|
||||
(alias
|
||||
(name t6)
|
||||
(deps %{cma:sub2/bar2}))
|
||||
|
||||
(alias
|
||||
(name t7)
|
||||
(deps %{cmo:sub/x}))
|
||||
|
||||
(alias
|
||||
(name t8)
|
||||
(deps %{cmo:sub3/x}))
|
||||
|
||||
(alias
|
||||
(name t9)
|
||||
(deps %{cma:sub3/c1}))
|
||||
|
||||
(alias
|
||||
(name t10)
|
||||
(deps %{cma:c1}))
|
||||
|
||||
(rule (with-stdout-to x1.ml (progn)))
|
||||
(rule (with-stdout-to x2.ml (progn)))
|
||||
(rule (with-stdout-to x3.ml (progn)))
|
||||
|
||||
(library
|
||||
(name plugin)
|
||||
(modules x1 x2))
|
||||
|
||||
(library
|
||||
(name dummy)
|
||||
(modules x3))
|
||||
|
||||
(rule
|
||||
(targets my.cmxs)
|
||||
(deps plugin%{ext_lib} .dummy.objs/native/dummy__X3%{ext_obj})
|
||||
(action (run %{ocamlopt} -shared -o %{targets} %{cmxa:plugin} %{cmx:x3})))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 2.0)
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
Most tests have two versions: one where the variable is used inside a dune file,
|
||||
and one where the same variables are used in the command line.
|
||||
|
||||
$ export DUNE_SANDBOX=symlink
|
||||
|
||||
We begin with a that tries to build several modules defined in the current
|
||||
directory.
|
||||
|
||||
- a belongs to a wrapped library
|
||||
- b belongs to an executable
|
||||
- c belongs to an unwrapped library
|
||||
- d belongs to a wrapped library (transition mode) : in this case, both the
|
||||
prefixed and unprefixed modules are built.
|
||||
|
||||
$ dune clean
|
||||
$ dune build @t1
|
||||
|
||||
Command line version.
|
||||
|
||||
$ dune build --verbose %{cmo:a} %{cmo:b} %{cmo:c} 2>&1 | grep -A100 'Actual targets'
|
||||
Actual targets:
|
||||
- _build/default/.a1.objs/byte/a1__A.cmo
|
||||
- _build/default/.b.eobjs/byte/dune__exe__B.cmo
|
||||
- _build/default/.c1.objs/byte/c.cmo
|
||||
|
||||
The next test tries to build a .cmi file (of a module in a wrapped library).
|
||||
|
||||
$ dune clean
|
||||
$ dune build @t2
|
||||
|
||||
Command line version.
|
||||
|
||||
$ dune build --verbose %{cmi:a} 2>&1 | grep -A100 'Actual targets'
|
||||
Actual targets:
|
||||
- _build/default/.a1.objs/byte/a1__A.cmi
|
||||
|
||||
Command line version; note that the error message is slightly different.
|
||||
|
||||
$ dune build %{cmo:xxxx}
|
||||
File "command line", line 1, characters 0-11:
|
||||
Error: Module Xxxx does not exist.
|
||||
[1]
|
||||
|
||||
The next test builds a native .cmxa.
|
||||
|
||||
$ dune clean
|
||||
$ dune build @t4
|
||||
|
||||
Command line version.
|
||||
|
||||
$ dune build --verbose %{cmxa:a1} 2>&1 | grep -A100 'Actual targets'
|
||||
Actual targets:
|
||||
- _build/default/a1.cmxa
|
||||
|
||||
Command line version.
|
||||
|
||||
$ dune build %{cma:bar_}
|
||||
File "command line", line 1, characters 0-11:
|
||||
Error: Library bar_ does not exist.
|
||||
[1]
|
||||
|
||||
This test tries to build a .cma in a subdirectory, where a different project is
|
||||
defined. The library is public in this case, but we use the local name.
|
||||
|
||||
$ dune clean
|
||||
$ dune build @t6
|
||||
|
||||
Command line version.
|
||||
|
||||
$ dune build --verbose %{cma:sub2/bar2} 2>&1 | grep -A100 'Actual targets'
|
||||
Actual targets:
|
||||
- _build/default/sub2/bar2.cma
|
||||
|
||||
This test builds a .cmo in a subdirectory (same project).
|
||||
|
||||
$ dune clean
|
||||
$ dune build @t7
|
||||
|
||||
Command line version.
|
||||
|
||||
$ dune build --verbose %{cmo:sub/x} 2>&1 | grep -A100 'Actual targets'
|
||||
Actual targets:
|
||||
- _build/default/sub/.bar.objs/byte/bar__X.cmo
|
||||
|
||||
This test builds a module in a subdirectory (different project) belonging to a
|
||||
private library.
|
||||
|
||||
$ dune clean
|
||||
$ dune build @t8
|
||||
|
||||
COmmand line version.
|
||||
|
||||
$ dune build --verbose %{cmo:sub3/x} 2>&1 | grep -A100 'Actual targets'
|
||||
Actual targets:
|
||||
- _build/default/sub3/.c1.objs/byte/c1__X.cmo
|
||||
|
||||
This test builds a private library in a subdirectory belonging to a different
|
||||
project.
|
||||
|
||||
$ dune clean
|
||||
$ dune build @t9
|
||||
|
||||
Command line version.
|
||||
|
||||
$ dune build --verbose %{cma:sub3/c1} 2>&1 | grep -A100 'Actual targets'
|
||||
Actual targets:
|
||||
- _build/default/sub3/c1.cma
|
||||
|
||||
This test builds a library in the current directory that has the same name as a
|
||||
public library defined in a subdirectory.
|
||||
|
||||
$ dune clean
|
||||
$ dune build @t10
|
||||
|
||||
Command line version.
|
||||
|
||||
$ dune build --verbose %{cma:c1} 2>&1 | grep -A100 'Actual targets'
|
||||
Actual targets:
|
||||
- _build/default/c1.cma
|
||||
|
||||
This test checks error handling.
|
||||
|
||||
$ dune build %{cma:../x}
|
||||
File "command line", line 1, characters 0-11:
|
||||
Error: cannot escape the workspace root directory
|
||||
[1]
|
||||
$ dune build %{cma:../../x}
|
||||
Error: path outside the workspace: ../../x from default
|
||||
-> required by %{cma:../../x} at command line:1
|
||||
[1]
|
||||
|
||||
This test checks that everything still works if we invoke dune from a
|
||||
subdirectory.
|
||||
|
||||
$ (cd sub && dune build %{cmx:x})
|
||||
|
||||
The following test checks that the variables can be used in the (action) field
|
||||
of a (rule).
|
||||
|
||||
$ dune build _build/default/my.cmxs
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(rule (with-stdout-to x.ml (progn)))
|
||||
|
||||
(library
|
||||
(name bar))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 2.1)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
(rule (with-stdout-to y.ml (progn)))
|
||||
(rule (with-stdout-to y2.ml (progn)))
|
||||
|
||||
(library
|
||||
(name bar)
|
||||
(modules y))
|
||||
|
||||
(library
|
||||
(name bar2)
|
||||
(public_name bar2)
|
||||
(modules y2))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 2.0)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(rule (with-stdout-to x.ml (progn)))
|
||||
|
||||
(library
|
||||
(name c1))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 2.0)
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
The following (failing) test shows that the variables cannot yet be used in the (deps)
|
||||
field of a (rule).
|
||||
|
||||
This test is no longer failing. It should fail because
|
||||
%{cmo:...} wasn't allowed in the deps field in (lang dune <3.0).
|
||||
|
||||
$ echo "(lang dune 2.1)" > dune-project
|
||||
$ cat > dune << EOF
|
||||
> (rule
|
||||
> (target t)
|
||||
> (deps %{cmo:x2})
|
||||
> (action (with-stdout-to %{target} (progn))))
|
||||
> EOF
|
||||
$ dune build t
|
||||
File "dune", line 3, characters 7-16:
|
||||
3 | (deps %{cmo:x2})
|
||||
^^^^^^^^^
|
||||
Error: Module X2 does not exist.
|
||||
[1]
|
||||
|
||||
The above restriction also applies to other stanzas. Any stanzas that introduces
|
||||
new files for Dir_contents, for example copy_files:
|
||||
|
||||
$ cat > dune << EOF
|
||||
> (copy_files "%{cmo:x2}")
|
||||
> EOF
|
||||
$ dune build t
|
||||
File "dune", line 1, characters 13-22:
|
||||
1 | (copy_files "%{cmo:x2}")
|
||||
^^^^^^^^^
|
||||
Error: %{cmo:..} isn't allowed in this position.
|
||||
[1]
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
This test tries to build a non-existent .cma.
|
||||
|
||||
$ echo "(lang dune 2.1)" > dune-project
|
||||
$ cat > dune << EOF
|
||||
> (alias
|
||||
> (name t)
|
||||
> (deps %{cma:bar}))
|
||||
> EOF
|
||||
$ dune build @t
|
||||
File "dune", line 3, characters 7-17:
|
||||
3 | (deps %{cma:bar}))
|
||||
^^^^^^^^^^
|
||||
Error: Library bar does not exist.
|
||||
[1]
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
The next test tries to build a module that does not exist.
|
||||
|
||||
$ echo "(lang dune 2.1)" > dune-project
|
||||
$ cat > dune << EOF
|
||||
> (alias
|
||||
> (name t)
|
||||
> (deps %{cmo:foo}))
|
||||
> EOF
|
||||
$ dune build @t
|
||||
File "dune", line 3, characters 7-17:
|
||||
3 | (deps %{cmo:foo}))
|
||||
^^^^^^^^^^
|
||||
Error: Module Foo does not exist.
|
||||
[1]
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue