-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for (empty_module_interface_if_absent) #4955
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
70 changes: 70 additions & 0 deletions
70
test/blackbox-tests/test-cases/buildable-empty-intf-if-absent.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,70 @@ | ||
Generate empty interfaces when using (empty_module_interface_if_absent) | ||
|
||
$ cat >dune-project <<EOF | ||
> (lang dune 3.0) | ||
> EOF | ||
|
||
Executables | ||
|
||
$ cat >main.ml <<EOF | ||
> module D = Dep | ||
> EOF | ||
|
||
$ touch dep.ml | ||
|
||
$ cat >dune <<EOF | ||
> (executable (name main) (empty_module_interface_if_absent)) | ||
> EOF | ||
|
||
$ dune build ./main.exe | ||
|
||
$ cat _build/default/dep.mli | ||
(* Auto-generated by Dune *) | ||
|
||
Libraries | ||
|
||
$ cat >dune <<EOF | ||
> (library (name l) (modules a b) (empty_module_interface_if_absent)) | ||
> EOF | ||
|
||
$ touch a.ml b.ml | ||
|
||
$ dune build | ||
|
||
$ cat _build/default/a.mli | ||
(* Auto-generated by Dune *) | ||
$ cat _build/default/b.mli | ||
(* Auto-generated by Dune *) | ||
|
||
Version check | ||
|
||
$ cat >dune-project <<EOF | ||
> (lang dune 2.9) | ||
> EOF | ||
|
||
$ dune build | ||
File "dune", line 1, characters 32-66: | ||
1 | (library (name l) (modules a b) (empty_module_interface_if_absent)) | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: 'empty_module_interface_if_absent' is only available since version 3.0 | ||
of the dune language. Please update your dune-project file to have (lang dune | ||
3.0). | ||
[1] | ||
|
||
Check that interfaces are *not* generated if field is not used | ||
|
||
$ cat >dune <<EOF | ||
> (lang dune 3.0) | ||
> EOF | ||
|
||
$ cat >dune <<EOF | ||
> (library (name l) (modules a b)) | ||
> EOF | ||
|
||
$ touch a.mli | ||
|
||
$ dune build | ||
|
||
$ test -f _build/default/a.mli | ||
|
||
$ test ! -f _build/default/b.mli |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not specific to this PR, but it's a shame we have to duplicate the doc. At some point we should re-organise the doc so we don't need this duplication. /cc @christinerose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed about duplicating doc and reorganization! Is dune-files.rst file duplicated in different PRs or in another directory in the repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The duplication is inside dune-files.rst. There are fields, such as
empty_module_interafe_if_absent
and a few other ones, that are allowed in both(library ...)
and(executable ...)
stanzas. Currently, these flags are described twice, once for each stanza.