-
Notifications
You must be signed in to change notification settings - Fork 415
/
Copy pathmissing-melc.t
91 lines (74 loc) · 2.34 KB
/
missing-melc.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Test cases when melc is not available
$ cat > dune-project <<EOF
> (lang dune 3.8)
> (using melange 0.1)
> EOF
$ cat > main_melange.ml <<EOF
> let () =
> print_endline "hello from melange"
> EOF
Set up some fake environment without melc
$ mkdir _path
$ ln -s $(command -v dune) _path/
$ ln -s $(command -v ocamlc) _path/
$ ln -s $(command -v ocamldep) _path/
For melange.emit stanzas, an error is shown
$ cat > dune <<EOF
> (melange.emit
> (target output)
> (modules main_melange)
> (alias mel))
> EOF
$ (unset INSIDE_DUNE; PATH=_path dune build --always-show-command-line --root . @mel 2>&1 | grep Program)
Error: Program melc not found in the tree or in PATH
Error: Program melc not found in the tree or in PATH
Error: Program melc not found in the tree or in PATH
Error: Program melc not found in the tree or in PATH
For libraries, if no melange.emit stanza is found, build does not fail
$ cat > dune <<EOF
> (library
> (name lib1)
> (modules :standard \ main_native)
> (modes byte melange))
> (executable
> (name main_native)
> (modules main_native)
> (modes exe byte)
> (libraries lib1))
> EOF
$ cat > main_native.ml <<EOF
> let () =
> print_endline Lib1.Lib.t
> EOF
$ cat > lib.ml <<EOF
> let t = "hello from native"
> EOF
$ (unset INSIDE_DUNE; PATH=_path dune build --always-show-command-line --root . main_native.bc)
$ dune exec ./main_native.bc
hello from native
If melange.emit stanza is found, but no rules are executed, build does not fail
$ cat > dune <<EOF
> (library
> (name lib1)
> (modules :standard \ main_native main_melange)
> (modes byte melange))
> (executable
> (name main_native)
> (modules main_native)
> (modes exe byte)
> (libraries lib1))
> (melange.emit
> (target output)
> (modules main_melange)
> (libraries lib1))
> EOF
$ (unset INSIDE_DUNE; PATH=_path dune build --always-show-command-line --root . main_native.bc)
$ dune exec ./main_native.bc
hello from native
But trying to build any melange artifacts will fail
$ (unset INSIDE_DUNE; PATH=_path dune build --always-show-command-line --root . output/main_melange.js)
File ".lib1.objs/melange/_unknown_", line 1, characters 0-0:
Error: Program melc not found in the tree or in PATH
(context: default)
Hint: opam install melange
[1]