forked from ocaml/dune
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(melange): add a test showing dependent re-compilation (ocaml#10501)
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
- Loading branch information
1 parent
def6781
commit 081f7d3
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
test/blackbox-tests/test-cases/melange/recompile-dependents.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
Test Melange dependent recompilation | ||
|
||
Set up and build a Melange library and `melange.emit` | ||
|
||
$ cat > dune-project <<EOF | ||
> (lang dune 3.13) | ||
> (using melange 0.1) | ||
> EOF | ||
|
||
$ mkdir lib | ||
$ cat > lib/dune <<EOF | ||
> (library | ||
> (name foo) | ||
> (modes melange)) | ||
> EOF | ||
|
||
$ cat > lib/foo.ml <<EOF | ||
> let x () = "hello" | ||
> EOF | ||
$ cat > lib/foo.mli <<EOF | ||
> val x : unit -> string | ||
> EOF | ||
|
||
$ cat > dune <<EOF | ||
> (melange.emit | ||
> (target out) | ||
> (libraries foo)) | ||
> EOF | ||
$ cat > x.ml <<EOF | ||
> let () = Js.log (Foo.x ()) | ||
> EOF | ||
|
||
$ dune build | ||
$ node ./_build/default/out/x.js | ||
hello | ||
|
||
Now change `foo.ml`, but keep `foo.mli` intact | ||
|
||
$ cat > lib/foo.ml <<EOF | ||
> let x () = "hi" | ||
> EOF | ||
|
||
Build again, noting that x.ml could have been skipped? | ||
|
||
$ dune build --display short | ||
melc lib/.foo.objs/melange/foo.{cmj,cmt} | ||
melc .out.mobjs/melange/melange__X.{cmi,cmj,cmt} | ||
melc out/lib/foo.js | ||
melc out/x.js | ||
|
||
$ node ./_build/default/out/x.js | ||
hi |