-
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.
Add support for -H compiler flag (#10644)
* Add support for -H Signed-off-by: HasanA <[email protected]> Signed-off-by: Nicolás Ojeda Bär <[email protected]>
- Loading branch information
Showing
23 changed files
with
245 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- Add support for the -H flag (introduced in OCaml compiler 5.2) in dune | ||
(requires lang versions 3.17). This adaptation gives | ||
the correct semantics for `(implicit_transitive_deps false)`. | ||
(#10644, fixes #9333, ocsigen/tyxml#274, #2733, #4963, @MA0100) |
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
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
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/hidden-deps-supported.t/bar.ml
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,2 @@ | ||
let x = 5 | ||
let y = Foo.v |
18 changes: 18 additions & 0 deletions
18
test/blackbox-tests/test-cases/hidden-deps-supported.t/dune
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,18 @@ | ||
(library | ||
(name foo) | ||
(modules foo)) | ||
|
||
(library | ||
(name bar) | ||
(modules bar) | ||
(libraries foo)) | ||
|
||
(executable | ||
(name run) | ||
(modules run) | ||
(libraries bar)) | ||
|
||
(executable | ||
(name runf) | ||
(modules runf) | ||
(libraries bar)) |
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/hidden-deps-supported.t/foo.ml
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,2 @@ | ||
let v = 9 | ||
let w = 4 |
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 @@ | ||
let _ = Bar.y |
57 changes: 57 additions & 0 deletions
57
test/blackbox-tests/test-cases/hidden-deps-supported.t/run.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,57 @@ | ||
This test is guarded by ocaml version >= 5.2, so it should include foo with -H when | ||
implicit_transitive_deps is set to false. | ||
|
||
$ getincludes () { | ||
> dune build --verbose ./run.exe 2>&1 | grep run.ml | grep -Eo '\-[IH] [a-z/.]+' | sort | ||
> } | ||
$ cat >dune-project <<EOF | ||
> (lang dune 3.17) | ||
> (implicit_transitive_deps true) | ||
> EOF | ||
$ getincludes | ||
-I .bar.objs/byte | ||
-I .bar.objs/byte | ||
-I .bar.objs/native | ||
-I .foo.objs/byte | ||
-I .foo.objs/byte | ||
-I .foo.objs/native | ||
-I .run.eobjs/byte | ||
-I .run.eobjs/byte | ||
-I .run.eobjs/native | ||
$ cat >dune-project <<EOF | ||
> (lang dune 3.17) | ||
> (implicit_transitive_deps false) | ||
> EOF | ||
$ getincludes | ||
-H .foo.objs/byte | ||
-H .foo.objs/byte | ||
-H .foo.objs/native | ||
-I .bar.objs/byte | ||
-I .bar.objs/byte | ||
-I .bar.objs/native | ||
-I .run.eobjs/byte | ||
-I .run.eobjs/byte | ||
-I .run.eobjs/native | ||
Test transitive deps can not be directly accessed, both for compiler versions supporting -H or not: | ||
$ cat >dune-project <<EOF | ||
> (lang dune 3.17) | ||
> (implicit_transitive_deps false) | ||
> EOF | ||
$ dune build ./runf.exe 2>&1 | grep -v ocamlc | ||
File "runf.ml", line 1, characters 16-21: | ||
1 | let a = Bar.y + Foo.v | ||
^^^^^ | ||
Error: Unbound module Foo | ||
Test if #274 is fixed: | ||
$ dune build --root=./tyxml | ||
Entering directory 'tyxml' | ||
Leaving directory 'tyxml' |
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 @@ | ||
let a = Bar.y + Foo.v |
4 changes: 4 additions & 0 deletions
4
test/blackbox-tests/test-cases/hidden-deps-supported.t/tyxml/dune
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,4 @@ | ||
(executable | ||
(name run) | ||
(libraries tyxml)) | ||
|
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/hidden-deps-supported.t/tyxml/dune-project
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,2 @@ | ||
(lang dune 3.17) | ||
(implicit_transitive_deps false) |
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/hidden-deps-supported.t/tyxml/run.ml
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,2 @@ | ||
open Tyxml.Html | ||
let _ = p [ a [ txt "a" ] ] |
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/hidden-deps-unsupported.t/bar.ml
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,2 @@ | ||
let x = 5 | ||
let y = Foo.v |
14 changes: 14 additions & 0 deletions
14
test/blackbox-tests/test-cases/hidden-deps-unsupported.t/dune
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,14 @@ | ||
(library | ||
(name foo) | ||
(modules foo)) | ||
|
||
(library | ||
(name bar) | ||
(modules bar) | ||
(libraries foo)) | ||
|
||
(executable | ||
(name run) | ||
(modules run) | ||
(libraries bar)) | ||
|
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/hidden-deps-unsupported.t/foo.ml
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,2 @@ | ||
let v = 9 | ||
let w = 4 |
2 changes: 2 additions & 0 deletions
2
test/blackbox-tests/test-cases/hidden-deps-unsupported.t/run.ml
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,2 @@ | ||
let _ = Bar.y | ||
let _ = print_endline "yes" |
Oops, something went wrong.