-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(melange): support
enabled_if
in melange.emit
- Loading branch information
1 parent
d4ceaa9
commit e7e6422
Showing
4 changed files
with
77 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
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,55 @@ | ||
`enabled_if` in `melange.emit` | ||
|
||
$ cat > dune-project <<EOF | ||
> (lang dune 3.8) | ||
> (using melange 0.1) | ||
> EOF | ||
|
||
$ cat > dune <<EOF | ||
> (melange.emit | ||
> (target out) | ||
> (emit_stdlib false) | ||
> (enabled_if %{bin-available:melc})) | ||
> EOF | ||
$ cat > x.ml <<EOF | ||
> let () = Js.log "hello" | ||
> EOF | ||
|
||
Not available until dune lang 3.9 | ||
|
||
$ dune build @melange --display short | ||
File "dune", line 4, characters 1-35: | ||
4 | (enabled_if %{bin-available:melc})) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: 'enabled_if' is only available since version 3.9 of the dune language. | ||
Please update your dune-project file to have (lang dune 3.9). | ||
[1] | ||
|
||
$ cat > dune-project <<EOF | ||
> (lang dune 3.9) | ||
> (using melange 0.1) | ||
> EOF | ||
|
||
$ dune rules @melange | grep '\.cmj' | ||
(File (In_build_dir _build/default/.out.mobjs/melange/melange__X.cmj)))) | ||
.out.mobjs/melange/melange__X.cmj)))) | ||
$ dune build @melange --display short | ||
melc .out.mobjs/melange/melange__X.{cmi,cmj,cmt} | ||
melc out/x.js | ||
|
||
$ dune clean | ||
|
||
`(enabled_if false)` shouldn't build any JS | ||
|
||
$ cat > dune <<EOF | ||
> (melange.emit | ||
> (target out) | ||
> (emit_stdlib false) | ||
> (enabled_if false)) | ||
> EOF | ||
|
||
$ dune build @melange --display short | ||
|
||
No rules attached to the alias | ||
|
||
$ dune rules @melange |