This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
$ cat > dune-workspace << EOF
|
||||
> (lang dune 3.13)
|
||||
> (context default)
|
||||
> (context
|
||||
> (default
|
||||
> (name log)))
|
||||
> EOF
|
||||
|
||||
$ dune build
|
||||
File "dune-workspace", line 5, characters 8-11:
|
||||
5 | (name log)))
|
||||
^^^
|
||||
Error: "log" is an invalid context name.
|
||||
[1]
|
||||
|
||||
$ cat > dune-workspace << EOF
|
||||
> (lang dune 3.13)
|
||||
> (context default)
|
||||
> (context
|
||||
> (default
|
||||
> (name install)))
|
||||
> EOF
|
||||
$ dune build 2>&1 | grep "must not crash"
|
||||
I must not crash. Uncertainty is the mind-killer. Exceptions are the
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(alias
|
||||
(name runtest)
|
||||
(action (echo "build profile: %{profile}")))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.0)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(lang dune 1.0)
|
||||
|
||||
(context (default (profile foobar)))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Workspaces let you set custom profiles
|
||||
|
||||
$ dune runtest
|
||||
build profile: foobar
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(lang dune 1.0)
|
||||
|
||||
(context (default))
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
specifying the workspace file is possible:
|
||||
|
||||
$ dune build --workspace dune-workspace.dev
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(cram
|
||||
(applies_to multiple-merlin-contexts opam)
|
||||
(deps %{bin:opam}))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(context (default))
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
dune uses a versioned file. If the version is missing, then we get an error.
|
||||
|
||||
$ dune build
|
||||
File "dune-workspace", line 1, characters 0-19:
|
||||
1 | (context (default))
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
Error: Invalid first line, expected: (lang <lang> <version>)
|
||||
[1]
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
(context (does-not-exist))
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
dune ignores jbuild-workspace files:
|
||||
|
||||
$ dune build
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
(lang dune 1.0)
|
||||
|
||||
(context
|
||||
(default
|
||||
(merlin)))
|
||||
|
||||
(context
|
||||
(opam
|
||||
(switch foo-switch)
|
||||
(name foo-name)
|
||||
(profile foo-profile)
|
||||
(merlin)))
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
Only a single context may be marked for merlin
|
||||
|
||||
$ dune build
|
||||
File "dune-workspace", lines 8-12, characters 1-82:
|
||||
8 | (opam
|
||||
9 | (switch foo-switch)
|
||||
10 | (name foo-name)
|
||||
11 | (profile foo-profile)
|
||||
12 | (merlin)))
|
||||
Error: you can only have one context for merlin
|
||||
[1]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
(lang dune 1.0)
|
||||
|
||||
(context
|
||||
(opam
|
||||
(switch foo-switch)
|
||||
(name foo-name)
|
||||
(profile foo-profile)
|
||||
(merlin false)))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
A workspace context can be defined using an opam switch. This test is disabled
|
||||
because we don't really have a way to mock an opam switch.
|
||||
|
||||
# $ dune build --display quiet 2>&1
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
(executable (name foo))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.0)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(lang dune 1.0)
|
||||
|
||||
(context (default (targets native)))
|
||||
|
|
@ -0,0 +1 @@
|
|||
print_endline "message from targets-native test";;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
Workspaces also allow you to set "target" for cross compilation. This feature is
|
||||
a bit hard to test since it requires mocking more than one context. But we can
|
||||
see how we can set a "native" target. Which is the default.
|
||||
|
||||
$ dune exec ./foo.exe
|
||||
message from targets-native test
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.1)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
(lang dune 1.7)
|
||||
|
||||
(env
|
||||
(default
|
||||
(ocamlc_flags (:standard -verbose))
|
||||
(c_flags ())
|
||||
(cxx_flags ())))
|
||||
|
||||
(context
|
||||
(default
|
||||
(env
|
||||
(default
|
||||
(flags (:standard -machin))))))
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
Workspaces also allow you to set the env for a context:
|
||||
|
||||
$ dune printenv --profile default
|
||||
(flags
|
||||
(-w -40 -machin))
|
||||
(ocamlc_flags
|
||||
(-g -verbose))
|
||||
(ocamlopt_flags (-g))
|
||||
(melange.compile_flags (-g))
|
||||
(c_flags ())
|
||||
(cxx_flags ())
|
||||
(link_flags ())
|
||||
(menhir_flags ())
|
||||
(menhir_explain ())
|
||||
(coq_flags (-q))
|
||||
(coqdep_flags ())
|
||||
(coqdoc_flags (--toc))
|
||||
(js_of_ocaml_flags ())
|
||||
(js_of_ocaml_build_runtime_flags ())
|
||||
(js_of_ocaml_link_flags ())
|
||||
(wasm_of_ocaml_flags ())
|
||||
(wasm_of_ocaml_build_runtime_flags ())
|
||||
(wasm_of_ocaml_link_flags ())
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(executable
|
||||
(name hello)
|
||||
(promote (until-clean)))
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
let () =
|
||||
Printf.printf "Hello: %s\n%!" (Sys.getenv "FOO")
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
(alias
|
||||
(name default)
|
||||
(deps bin/hello.exe)
|
||||
(action (run hello.exe)))
|
||||
|
||||
;; Note that if you try the above on Windows it will fail because the program in
|
||||
;; the (run ...) action is supposed to **not** contain the .exe extension, but
|
||||
;; if we remove it then it will fail on Unix systems.
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.12)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(lang dune 1.12)
|
||||
|
||||
(context
|
||||
(default
|
||||
(paths (PATH bin :standard) (FOO a b /c \ b))))
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
Duplicate hello.exe before writing to it, as modifying a produced file
|
||||
is prohibited.
|
||||
|
||||
$ cp bin/hello.exe.source bin/hello.exe
|
||||
$ chmod u+w bin/hello.exe
|
||||
|
||||
$ dune build
|
||||
Hello: $TESTCASE_ROOT/a:/c
|
||||
|
||||
$ mkdir sub
|
||||
$ cat > sub/dune-workspace <<EOF
|
||||
> (lang dune 1.12)
|
||||
> (context
|
||||
> (default
|
||||
> (paths (FOO a) (FOO b))))
|
||||
> EOF
|
||||
$ cat > sub/dune-project <<EOF
|
||||
> (lang dune 1.12)
|
||||
> EOF
|
||||
$ dune build --root sub
|
||||
Entering directory 'sub'
|
||||
File "dune-workspace", line 4, characters 19-22:
|
||||
4 | (paths (FOO a) (FOO b))))
|
||||
^^^
|
||||
Error: the variable "FOO" can appear at most once in this stanza.
|
||||
Leaving directory 'sub'
|
||||
[1]
|
||||
Loading…
Add table
Add a link
Reference in a new issue